GenerateKeyPair
Jump to navigation
Jump to search
This function creates a new public key and private key for encrypting data
Script Example Missing Function GenerateKeyPair needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
Syntax
string, string GenerateKeyPair ( string algorithm, table options [, function callback ] )
Required Arguments
- algorithm: The algorithm to use:
- RSA: use the RSA public-key algorithm
- options: table with options for the hashing algorithm, as detailed below.
Optional Arguments
- callback: providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.
Options for each hashing algorithm
- RSA:
- size (int), default: 0 . Size of a key.
Returns
Returns 2 strings if successful: private key and public key. Otherwise returns false