GenerateKeyPair
[<Interface>]
type GenerateKeyPair =
abstract member Invoke (type: string, options: X448KeyPairKeyObjectOptions option, callback: Callback40) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback39) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback38) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback37) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback36) : unit
abstract member Invoke (type: string, options: X25519KeyPairKeyObjectOptions option, callback: Callback35) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback34) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback33) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback32) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback31) : unit
abstract member Invoke (type: string, options: ED448KeyPairKeyObjectOptions option, callback: Callback30) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback29) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback28) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback27) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback26) : unit
abstract member Invoke (type: string, options: ED25519KeyPairKeyObjectOptions option, callback: Callback25) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback24) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback23) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback22) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback21) : unit
abstract member Invoke (type: string, options: ECKeyPairKeyObjectOptions, callback: Callback20) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback19) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback18) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback17) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback16) : unit
abstract member Invoke (type: string, options: DSAKeyPairKeyObjectOptions, callback: Callback15) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback14) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback13) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback12) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback11) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairKeyObjectOptions, callback: Callback10) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback9) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback8) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback7) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback6) : unit
abstract member Invoke (type: string, options: RSAKeyPairKeyObjectOptions, callback: Callback5) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback4) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback3) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback2) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback) : unit
abstract member __promisify__Dsa (options: DSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Dsa (options: DSAKeyPairOptions<string,string>) : Promise<Item9>
abstract member __promisify__Ec (options: ECKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ec (options: ECKeyPairOptions<string,string>) : Promise<Item13>
abstract member __promisify__Ed25519 (?options: ED25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed25519 (options: ED25519KeyPairOptions<string,string>) : Promise<Item17>
abstract member __promisify__Ed448 (?options: ED448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed448 (options: ED448KeyPairOptions<string,string>) : Promise<Item21>
abstract member __promisify__Rsa (options: RSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Rsa (options: RSAKeyPairOptions<string,string>) : Promise<Item>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairOptions<string,string>) : Promise<Item5>
abstract member __promisify__X25519 (?options: X25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__X25519 (options: X25519KeyPairOptions<string,string>) : Promise<Item25>
abstract member __promisify__X448 (?options: X448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__X448 (options: X448KeyPairOptions<string,string>) : Promise<Item29>| Assembly | Xantham.Fable.Node |
Declared inside
Methods
abstract member Invoke (type: string, options: X448KeyPairKeyObjectOptions option, callback: Callback40) : unit
abstract member Invoke (type: string, options: X448KeyPairKeyObjectOptions option, callback: Callback40) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback39) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback39) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback38) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback38) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback37) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback37) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback36) : unit
abstract member Invoke (type: string, options: X448KeyPairOptions<string,string>, callback: Callback36) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X25519KeyPairKeyObjectOptions option, callback: Callback35) : unit
abstract member Invoke (type: string, options: X25519KeyPairKeyObjectOptions option, callback: Callback35) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback34) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback34) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback33) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback33) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback32) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback32) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback31) : unit
abstract member Invoke (type: string, options: X25519KeyPairOptions<string,string>, callback: Callback31) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED448KeyPairKeyObjectOptions option, callback: Callback30) : unit
abstract member Invoke (type: string, options: ED448KeyPairKeyObjectOptions option, callback: Callback30) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback29) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback29) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback28) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback28) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback27) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback27) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback26) : unit
abstract member Invoke (type: string, options: ED448KeyPairOptions<string,string>, callback: Callback26) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED25519KeyPairKeyObjectOptions option, callback: Callback25) : unit
abstract member Invoke (type: string, options: ED25519KeyPairKeyObjectOptions option, callback: Callback25) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback24) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback24) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback23) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback23) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback22) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback22) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback21) : unit
abstract member Invoke (type: string, options: ED25519KeyPairOptions<string,string>, callback: Callback21) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ECKeyPairKeyObjectOptions, callback: Callback20) : unit
abstract member Invoke (type: string, options: ECKeyPairKeyObjectOptions, callback: Callback20) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback19) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback19) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback18) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback18) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback17) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback17) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback16) : unit
abstract member Invoke (type: string, options: ECKeyPairOptions<string,string>, callback: Callback16) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: DSAKeyPairKeyObjectOptions, callback: Callback15) : unit
abstract member Invoke (type: string, options: DSAKeyPairKeyObjectOptions, callback: Callback15) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback14) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback14) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback13) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback13) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback12) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback12) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback11) : unit
abstract member Invoke (type: string, options: DSAKeyPairOptions<string,string>, callback: Callback11) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAPSSKeyPairKeyObjectOptions, callback: Callback10) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairKeyObjectOptions, callback: Callback10) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback9) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback9) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback8) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback8) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback7) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback7) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback6) : unit
abstract member Invoke (type: string, options: RSAPSSKeyPairOptions<string,string>, callback: Callback6) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAKeyPairKeyObjectOptions, callback: Callback5) : unit
abstract member Invoke (type: string, options: RSAKeyPairKeyObjectOptions, callback: Callback5) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback4) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback4) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback3) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback3) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback2) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback2) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback) : unit
abstract member Invoke (type: string, options: RSAKeyPairOptions<string,string>, callback: Callback) : unitGenerates 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 or privateKeyEncoding was specified, this function behaves as if keyObject.export() had been called on its result. Otherwise, the respective part of the key is returned as a KeyObject.
It is recommended to encode public keys as 'spki' and private keys as 'pkcs8' with encryption for long-term storage:
const {
generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: 'top secret',
},
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
On completion, callback will be called with err set to undefined and publicKey / privateKey representing the generated key pair.
If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with publicKey and privateKey properties.
@since v10.12.0
| Parameter | |
|---|---|
type | Must be 'rsa', 'rsa-pss', 'dsa', 'ec', 'ed25519', 'ed448', 'x25519', 'x448', or 'dh'. |
abstract member __promisify__Dsa (options: DSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Dsa (options: DSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__Dsa (options: DSAKeyPairOptions<string,string>) : Promise<Item9>
abstract member __promisify__Dsa (options: DSAKeyPairOptions<string,string>) : Promise<Item9>function __promisify__(type: "dsa", options: DSAKeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__Ec (options: ECKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ec (options: ECKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ec (options: ECKeyPairOptions<string,string>) : Promise<Item13>
abstract member __promisify__Ec (options: ECKeyPairOptions<string,string>) : Promise<Item13>function __promisify__(type: "ec", options: ECKeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__Ed25519 (?options: ED25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed25519 (?options: ED25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed25519 (options: ED25519KeyPairOptions<string,string>) : Promise<Item17>
abstract member __promisify__Ed25519 (options: ED25519KeyPairOptions<string,string>) : Promise<Item17>function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__Ed448 (?options: ED448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed448 (?options: ED448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__Ed448 (options: ED448KeyPairOptions<string,string>) : Promise<Item21>
abstract member __promisify__Ed448 (options: ED448KeyPairOptions<string,string>) : Promise<Item21>function __promisify__(type: "ed448", options: ED448KeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__Rsa (options: RSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__Rsa (options: RSAKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__Rsa (options: RSAKeyPairOptions<string,string>) : Promise<Item>
abstract member __promisify__Rsa (options: RSAKeyPairOptions<string,string>) : Promise<Item>function __promisify__(type: "rsa", options: RSAKeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairOptions<string,string>) : Promise<Item5>
abstract member __promisify__RsaPss (options: RSAPSSKeyPairOptions<string,string>) : Promise<Item5>function __promisify__(type: "rsa-pss", options: RSAPSSKeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__X25519 (?options: X25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__X25519 (?options: X25519KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "x25519", options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__X25519 (options: X25519KeyPairOptions<string,string>) : Promise<Item25>
abstract member __promisify__X25519 (options: X25519KeyPairOptions<string,string>) : Promise<Item25>function __promisify__(type: "x25519", options: X25519KeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>
abstract member __promisify__X448 (?options: X448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>
abstract member __promisify__X448 (?options: X448KeyPairKeyObjectOptions) : Promise<KeyPairKeyObjectResult>function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>
abstract member __promisify__X448 (options: X448KeyPairOptions<string,string>) : Promise<Item29>
abstract member __promisify__X448 (options: X448KeyPairOptions<string,string>) : Promise<Item29>function __promisify__(type: "x448", options: X448KeyPairOptions<"pem", "pem">): Promise<{ publicKey: string; privateKey: string; }>