Asymmetric Cryptography

Learn how to encrypt or decrypt using the Asymmetric Cryptography component.

Asymmetric Cryptography encrypts and decrypts based on public and private keys.

Parameters

Take a look at the configuration options for the component. Parameters supported by Double Braces expressions are marked with (DB).

Parameter
Description
Default value
Data type

Account

Account to be used by the component. Supported accounts: Public key or Private key.

N/A

String

Crypto Operation

Available operation types (Encrypt and Decrypt).

Encrypt

String

Fields To Encrypt/Decrypt

Fields to be encrypted/decrypted using a dotted notation (eg.: body.field1, body.field2, body).

body.field1,body.field2

String

Algorithm

Algorithm to be used to encrypt/decrypt data.

RSA

String

Operation Mode

Operation mode to be used.

ECB

String

Padding

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

OAEPWithSHA1AndMGF1Padding

String

Fail On Error

If the option is enabled, the execution of the pipeline with an error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

False

Boolean

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 or pass the property key via body with the respective key.

If the key isn't configured in the account, you must specify it in the request as the model below:

{	
    "encryptionKey": "-- THE FOLLOWING PUBLIC KEY--"
}

Asymmetric Cryptography in Action

KEY by ACCOUNT

Config

{	
    "operation": "encrypt",	
    "algorithm": "RSA",	
    "operationMode": "ECB",	
    "padding": "OAEPWithSHA1AndMGF1Padding",	
    "encryptedFields": "data,data1",	
    "failOnError": true
}

Payload

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

Output

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

Config

{	
    "operation": "decrypt",	
    "algorithm": "RSA",	
    "operationMode": "ECB",	
    "padding": "OAEPWithSHA1AndMGF1Padding",	
    "encryptedFields": "data,data1",	
    "failOnError": true
}

Payload

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

Output

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

KEY by REQUEST BODY

Config

{	
    "operation": "encrypt",	
    "algorithm": "RSA",	
    "operationMode": "ECB",	
    "padding": "OAEPWithSHA1AndMGF1Padding",	
    "encryptedFields": "data,data1",	
    "failOnError": true
}

Payload

{	
    "encryptionKey": "-- THE FOLLOWING PUBLIC KEY--"	
    "data": someData,	
    "data1": someData1
}

Output

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

Config

{	
    "operation": "decrypt",	
    "algorithm": "RSA",	
    "operationMode": "ECB",	
    "padding": "OAEPWithSHA1AndMGF1Padding",	
    "encryptedFields": "data,data1",	
    "failOnError": true 
}

Payload

{	
    "encryptionKey": "-- THE FOLLOWING PRIVATE KEY--"	
    "data": "RXZlbiBpZiBwZXJmZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH=",	
    "data1": "RXZlbiBpZifd441mZWN0IGNyeXB0b2dyYXBoaWMgcm91dGluZXMgYXJlIH="
}

Last updated