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.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2    Statistic  

RSA.EncryptPrivateKey

Encrypts a private key.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Encryption 7.5 Yes Yes Yes Yes Yes

MBS( "RSA.EncryptPrivateKey"; KeyType; KeyData; KeyEncoding; Algorithm; PasswordType; PasswordData { ; PasswordEncoding } )

Parameters

Parameter Description Example value
KeyType The type of input for private key.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Path"
KeyData The actual input data for the key.
Text, container or file path. Must not be longer than the maximum key length of the given algorithm. If key is too short, we pad it with zero bytes.
"/Users/cs/desktop/test.pem"
KeyEncoding The text encoding for text input for the key.
Parameter is ignored for other cases.
Algorithm Which algorithm to use. Can be for example RC2, blowfish, AES128, AES192, AES256. See Encryption.Cipher. "AES-128-CFB"
PasswordType The type of input for optional password.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Text"
PasswordData 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.
"UTF-8"

Result

Returns key as text or error.

Description

Encrypts a private key.
Returns error if key could not be read, e.g. because it is already encrypted.

Examples

Encrypt private key and decrypt it:

Set Variable [ $key1 ; Value: MBS( "RSA.GeneratePrivateKey") ]
Set Variable [ $key2 ; Value: MBS( "RSA.EncryptPrivateKey"; "Text"; $key1; "UTF-8"; "AES-128-CFB"; "text"; "Hello") ]
Set Variable [ $key3 ; Value: MBS( "RSA.DecryptPrivateKey"; "Text"; $key1; "UTF-8"; "text"; "Hello") ]

See also


RSA.DecryptPrivateKey   -   RSA.GeneratePrivateKey

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos