RSA Cryptography

Know the component and how to use it.

Erick Rubiales avatar
Written by Erick Rubiales
Updated over a week ago

IMPORTANT: This documentation has been discontinued. Read the updated RSA Cryptography documentation on our new documentation portal.

RSA Cryptography encrypts and decrypts based on the RSA algorithm.

Take a look at the configuration parameters of the component:

  • Account: account to be used by the component.

  • Crypto Operation: available operation types - ENCRYPT FIELDS, DECRYPT FIELDS, ENCRYPT PAYLOAD and DECRYPT PAYLOAD.

  • Fields To Encrypt/Decrypt: fields to be encrypted/decrypted using a dotted notation (eg.: body.field1,body.field2,body).

  • Operation Mode: operation mode to be used.

  • Padding: is used in a block cipher where we fill up the blocks with padding bytes (eg.: AES 128 bits uses 16 padding bytes).

  • Charset: charset of the provided key of type string.

  • Encrypted Message As Hexa: if the option is activated, the secret key response will be in hexadecimal; otherwise, it will be in base64.

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

To encrypt, you must configure a PUBLIC KEY account or pass the property key via body with the respective key.

To decrypt, you must configure a PRIVATE KEY account.

Messages flow

KEY por ACCOUNT

Operation ENCRYPT FIELDS

Input

{
"operation": "encrypt_fields",
"operationMode": "ECB",
"padding": "OAEPWithSHA1AndMGF1Padding",
"encryptedFields": "data,data1",
"failOnError": true
}

Payload

{
"data": someData,
"data1": someData1
}

Output

{
"data": "RXZlbiBpZiBwZXJmZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH=",
"data1": "RXZlbiBpZifd441mZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH="
}

Operation DECRYPT FIELDS

Input

{
"operation": "decrypt_fields",
"operationMode": "ECB",
"padding": "OAEPWithSHA1AndMGF1Padding",
"encryptedFields": "data,data1",
"failOnError": true
}

Payload

{
"data": "RXZlbiBpZiBwZXJmZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH=",
"data1": "RXZlbiBpZifd441mZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH="
}

Output

{
"data": someData,
"data1": someData1
}

Did this answer your question?