Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  


Creates a new private key.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Sign 6.2 Yes Yes Yes Yes Yes

MBS( "RSA.GeneratePrivateKey" { ; Bits; Exp; Algorithm; PasswordType; PasswordData; PasswordEncoding } )


Parameter Description Example value
Bits Optional
The bit size.
e.g. 1024, 2048, 4096, etc.
Default is 4096.
Exp Optional
The exponent to use.
Default is 65537.
Algorithm Optional
Which algorithm to use. Can be for example RC2, blowfish, AES128, AES192, AES256. See Encryption.Cipher.
PasswordType Optional
The type of input for optional password.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
PasswordData Optional
The actual input data for the password.
Text, container or file path.
"Hello World"
PasswordEncoding Optional
The text encoding for text input.
Parameter is ignored for other cases.


Returns key as text or error.


Creates a new private key.
Returns the PEM formatted key as text.

As the PEM format contains base64 encoded DER data, you can remove header and footer line and use the result as base64 encoded DER key.

If you specify an algorithm and a key, we encrypt the PEM file. (New in 7.5)


Generate keys:

Set Variable [$privateKey; Value:MBS( "RSA.GeneratePrivateKey")]
Set Variable [$publickey; Value:MBS( "RSA.GetPublicKey"; "text"; $privateKey; "UTF-8")]
Set Field [Table::PrivateKey; $privateKey]
Set Field [Table::PublicKey; $publicKey]

Generate key with text password:

MBS( "RSA.GeneratePrivateKey"; 4096; 65537; "AES-128-CBC"; "text"; "Hello" )

See also

Example Databases

RSA.EncryptPrivateKey   -   RSA.GetPublicKey

Feedback: Report problem or ask question.

MBS Xojo tutorial videos