Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RSA.PublicDecrypt
Decrypts data using public key.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Encryption | 6.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "RSA.PublicDecrypt"; InputType; InputData; InputEncoding; KeyType; KeyData; KeyEncoding; OutputType { ; OutputInfo; PasswordType; PasswordData; PasswordEncoding; Padding } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
InputType | The type of input data. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Base64" | |
InputData | The actual input data. Text, container or file path. |
$EncryptedData | |
InputEncoding | The text encoding for text input. Parameter is ignored for other cases. |
"" | |
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. |
||
OutputType | The output type. Can be Base64, Hex, Text, File, Path. |
"Text" | |
OutputInfo | The addition info for output. For text it is the text encoding, for file container the file name and for path the actual native file path. |
"UTF-8" | Optional |
PasswordType | The type of input for the password of the private key. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Text" | Optional |
PasswordData | The actual input data for the password of the private 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. |
"Hello World" | Optional |
PasswordEncoding | The text encoding for text input. Parameter is ignored for other cases. |
"UTF-8" | Optional |
Padding | Which padding to use. 1: PKCS #1 v1.5 padding. This currently is the most widely used mode. 2: PKCS #1 v1.5 padding with an SSL-specific modification that denotes that the server is SSL3 capable. 3: Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code. Encrypting user data directly with RSA is insecure. 4: EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty encoding parameter. This mode is recommended for all new applications. 5: X931 padding. Default if not specified is 1. |
1 | Optional |
Result
Returns decrypted data or error.
Description
Decrypts data using public key.Using RSA keys with any key size.
Password is optional for decrypting encrypted keys.
You can decrypt the data here after encrypting it with RSA.PrivateEncrypt.
You can create a new private key using RSA.GeneratePrivateKey function. The RSA.GetPublicKey function extracts the public key from a private key.
Examples
Decrypt with public key:
Set Variable [$r; Value:MBS( "RSA.PublicDecrypt"; "base64"; RSA Public Private Encryption::EncryptedText; ""; "Text"; RSA Public Private Encryption::PublicKey; "UTF-8"; "Text"; "UTF-8")]
If [MBS("IsError")]
Show Custom Dialog ["Error"; $r]
Else
Set Field [RSA Public Private Encryption::DecryptedText; $r]
End If
See also
Example Databases
Blog Entries
This function is free to use.
Created 21st April 2016, last changed 30th May 2016