generate Key Pair ( type , options , callback ) : void Parameters type : "rsa" options : RSAKeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2810 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa" options : RSAKeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2815 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa" options : RSAKeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2820 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa" options : RSAKeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2825 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2830 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa-pss" options : RSAPSSKeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2835 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa-pss" options : RSAPSSKeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2840 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa-pss" options : RSAPSSKeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2845 generate Key Pair ( type , options , callback ) : void Parameters type : "rsa-pss" options : RSAPSSKeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2850 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2855 generate Key Pair ( type , options , callback ) : void Parameters type : "dsa" options : DSAKeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2860 generate Key Pair ( type , options , callback ) : void Parameters type : "dsa" options : DSAKeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2865 generate Key Pair ( type , options , callback ) : void Parameters type : "dsa" options : DSAKeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2870 generate Key Pair ( type , options , callback ) : void Parameters type : "dsa" options : DSAKeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2875 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2880 generate Key Pair ( type , options , callback ) : void Parameters type : "ec" options : ECKeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2885 generate Key Pair ( type , options , callback ) : void Parameters type : "ec" options : ECKeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2890 generate Key Pair ( type , options , callback ) : void Parameters type : "ec" options : ECKeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2895 generate Key Pair ( type , options , callback ) : void Parameters type : "ec" options : ECKeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2900 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2905 generate Key Pair ( type , options , callback ) : void Parameters type : "ed25519" options : ED25519KeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2910 generate Key Pair ( type , options , callback ) : void Parameters type : "ed25519" options : ED25519KeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2915 generate Key Pair ( type , options , callback ) : void Parameters type : "ed25519" options : ED25519KeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2920 generate Key Pair ( type , options , callback ) : void Parameters type : "ed25519" options : ED25519KeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2925 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2930 generate Key Pair ( type , options , callback ) : void Parameters type : "ed448" options : ED448KeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2935 generate Key Pair ( type , options , callback ) : void Parameters type : "ed448" options : ED448KeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2940 generate Key Pair ( type , options , callback ) : void Parameters type : "ed448" options : ED448KeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2945 generate Key Pair ( type , options , callback ) : void Parameters type : "ed448" options : ED448KeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2950 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2955 generate Key Pair ( type , options , callback ) : void Parameters type : "x25519" options : X25519KeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2960 generate Key Pair ( type , options , callback ) : void Parameters type : "x25519" options : X25519KeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2965 generate Key Pair ( type , options , callback ) : void Parameters type : "x25519" options : X25519KeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2970 generate Key Pair ( type , options , callback ) : void Parameters type : "x25519" options : X25519KeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2975 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2980 generate Key Pair ( type , options , callback ) : void Parameters type : "x448" options : X448KeyPairOptions < "pem" , "pem" > callback : ( ( err : null | Error , publicKey : string , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2985 generate Key Pair ( type , options , callback ) : void Parameters type : "x448" options : X448KeyPairOptions < "pem" , "der" > callback : ( ( err : null | Error , publicKey : string , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : string privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2990 generate Key Pair ( type , options , callback ) : void Parameters type : "x448" options : X448KeyPairOptions < "der" , "pem" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : string ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : string Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:2995 generate Key Pair ( type , options , callback ) : void Parameters type : "x448" options : X448KeyPairOptions < "der" , "der" > callback : ( ( err : null | Error , publicKey : Buffer , privateKey : Buffer ) => void ) ( err , publicKey , privateKey ) : void Parameters err : null | Error publicKey : Buffer privateKey : Buffer Returns void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:3000 generate Key Pair ( type , options , callback ) : void Returns void Defined in node_modules/.store/@types-node-npm-22.9.0-643fcf7450/package/crypto.d.ts:3005
Generates a new asymmetric key pair of the given
type
. RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448, and DH are currently supported.If a
publicKeyEncoding
orprivateKeyEncoding
was specified, this function behaves as ifkeyObject.export()
had been called on its result. Otherwise, the respective part of the key is returned as aKeyObject
.It is recommended to encode public keys as
'spki'
and private keys as'pkcs8'
with encryption for long-term storage:On completion,
callback
will be called witherr
set toundefined
andpublicKey
/privateKey
representing the generated key pair.If this method is invoked as its
util.promisify()
ed version, it returns aPromise
for anObject
withpublicKey
andprivateKey
properties.