Skip to main content

decrypt using rsa

Type​

command

Summary​

Used to decrypt a file or string with RSA public or private keys and an optional passphrase.

Syntax​

decrypt <message> using rsa with {public | private} key <key> [and passphrase <passphrase>] [and padding <padding>]

Description​

Use the decrypt using rsa command to decrypt a message using RSA public key encryption.

To decode a message that a sender has encrypted with its corresponding public key, use the form:

    decrypt tMessage with private key tPrivateKey

As a verify operation to ensure that a message has been encoded with the corresponding private key and it has come from one of its holders, use the form:

    decrypt tMessage with public key tPublicKey

The optional padding phrase determines the padding mode used when performing the operation. It can be one of:

  • none: no padding is done, the application must pad the message appropriately
  • pkcs1: PKCS #1 v1.5 padding is used.
  • pkcs1-oaep: EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty encoding parameter.

If no padding phrase is provided, then the pkcs1 is used. Note:The pkcs1-oaep mode is only supported when decrypting with a private key, trying to use it when decrypting with a public key will return an error. Important:It is recommended that all new applications use the pkcs1-oaep padding mode when using private key decryption.

*Generating key pairs -

Public-private key pairs can be generated using the OpenSSL suite of command-line tools. For example: openssl genrsa -out private_key.pem 512 openssl rsa -pubout -in private_key.pem -out public_key.pem Will generate a key pair of size 512-bits, placing the private key in private_key.pem and the public key in public_key.pem.

For more information on these utilities see https://www.openssl.org/docs/manmaster/man1/rsa.html and https://www.openssl.org/docs/manmaster/man1/genrsa.html.

Parameters​

NameTypeDescription

key

The key to be used for the decryption, in PEM format

passphrase

An optional passphrase

padding

An optional padding mode

message

The message to be decrypted

Examples​

decrypt tMessage using rsa with public key tPublicKey
decrypt field 1 using rsa with private key tPrivateKey

command: decrypt, encrypt, encrypt using rsa

Compatibility and Support​

Introduced

LiveCode 4.6

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?