GenerateKeyPair

From Multi Theft Auto: Wiki
Revision as of 09:26, 19 August 2022 by Tracer (talk | contribs) (Created page with "__NOTOC__ {{Shared function}} {{Added feature/item|1.6.0|1.5.9|21055|This function creates a new public key and private key for encrypting data}} {{Needs Example}} Category:Incomplete ==Syntax== <syntaxhighlight lang="lua"> string, string GenerateKeyPair ( string algorithm, table options [, function callback ] ) </syntaxhighlight> ===Required Arguments=== *'''algorithm:''' The algorithm to use: ** ''RSA'': use the RSA public-key algorithm *'''options:''' table...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function creates a new public key and private key for encrypting data


Accessories-text-editor.png 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

Example