Symmetric Cryptography

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

Symmetric Cryptography encrypts and decrypts based on symmetric cryptography.

Parameters

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

Parameter
Description
Default value
Data type

Crypto Operation

Available operation types - Encrypt and Decrypt.

Encrypt

String

Account

Account which will be used by the component. A Private key account is expected. The size configured on the Algorithm Key Size parameter must match the Private key algorithm size. Otherwise, an error message will be returned.

N/A

String

Fields To Encrypt/Decrypt

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

body.field1,body.field2

String

Algorithm

Algorithm to be used to encrypt/decrypt data.

AES

String

Algorithm Key Size

Size of the algorithm key. As stated previously, the size configured in this parameter must match the Private key algorithm size.

256 bits

Integer

Operation Mode

Operation mode to be used.

CBC

String

Padding

Used in a block cipher where we fill up the blocks with padding bytes (e.g., AES 128 bits uses 16 padding bytes).

PKCS5Padding

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.

True

Boolean

Advanced Settings

Advanced configurations.

False

Boolean

Use IV

This option is valid only for the Encrypt operation. If selected, the option determines the IV (initialization vector) for the CBC mode.

False

Boolean

Use Your Own Key

If selected, the option will use your own key generated to encrypt and decrypt data.

False

Boolean

Encryption Key As Hex Value

If selected, the option expects/produces an Encryption Key as Hex; otherwise, it will be expected/produced as base64.

False

Boolean

Concatenate IV

An encrypted message is expected/produced with Concatenate IV (IV+MESSAGE); otherwise, an IV parameter will be produced during the encryption and IV in IV will be expected in the "Decryption" field.

False

Boolean

IV as Hex Value

This option is not available if Concatenate IV is enabled. If selected, the option expects/produces an IV parameter in Hex format; otherwise, it will be expected/produced as base64.

False

Boolean

Encrypted Message As Hex

If selected, the option expects/produces an encrypted message in Hex format; otherwise, it will be expected/produced as base64.

False

Boolean

Messages flow

Key by Account - Operation Encrypt

Input

{    
    "operation": "encrypt",    
    "useOwnKey": true,    
    "useIV": true,    
    "algorithm": "AES",    
    "operationMode": "CBC",    
    "padding": "PKCS5Padding",    
    "failOnError": true,    
    "encryptedMessageAsHex": false,    
    "iVAsHex": false,    
    "encryptedFields": "data,data1"
}

Payload

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

Output

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

Input

{    
    "operation": "encrypt",    
    "useOwnKey": true,    
    "useIV": true,    
    "algorithm": "AES",    
    "operationMode": "CBC",    
    "padding": "PKCS5Padding",    
    "failOnError": true,    
    "encryptedMessageAsHex": false,    
    "iVAsHex": false,    
    "encryptedFields": "data,data1"    
}

Payload

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

Output

{    
    "ivParameterSpec": "RXZlbiBpZiBwZXJmZWN0IGNy==",    
    "data": someData,    
    "data1": someData1
}

Key by Request Body - Operation Encrypt

Input

{    
    "operation": "encrypt",    
    "useOwnKey": true,    
    "useIV": true,    
    "algorithm": "AES",    
    "operationMode": "CBC",    
    "padding": "PKCS5Padding",    
    "failOnError": true,    
    "encryptedMessageAsHex": false,    
    "iVAsHex": false,    
    "encryptedFields": "data,data1"    
}

Payload

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

Output

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

Input

{    
    "operation": "decrypt",    
    "useOwnKey": true,    
    "useIV": true,    
    "algorithm": "AES",    
    "operationMode": "CBC",    
    "padding": "PKCS5Padding",    
    "failOnError": true,    
    "encryptedMessageAsHex": false,    
    "iVAsHex": false,    
    "encryptedFields": "data,data1"    
}

Payload

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

Last updated