Decrypt Field

In this article

Overview

You can use this Snap to decrypt fields in input documents using the Passphrase Account with the selected algorithm.

Snap Type

The Decrypt Field is a Transform-Type Snap that decrypts the fields in the input documents.

Prerequisites

None.

Support for Ultra Pipelines

Works in Ultra Pipelines

Limitations and Known Issues

None.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

 

  • Min: 1

  • Max: 1

  • Encrypt

  • Mapper

This Snap has exactly one document input view, which can be a stream of documents with encrypted field values.

Output

Document

  • Min: 1

  • Max: 1

Document

This Snap has exactly one document output view that is same as input document with specified field values decrypted

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk (*): Indicates a mandatory field.

  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon (): Indicates that you can add fields in the fieldset.

  • Remove icon (): Indicates that you can remove fields from the fieldset.

Field Name

Field Type

Description

Field Name

Field Type

Description

Label*

Default ValueDecrypt Field
ExampleDecrypt_Field

String

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

 

Fields to decrypt

Default Value: None
Example: $msg, $num

String

Specify the table for JSON-path expressions to decrypt. Use the suggest button to select the field to decrypt.

 

Advanced Options

Use this fieldset to specify the key when no account is selected.

Key

Default Value: None
Example: $key

String

Specify the JSON-path expression to be evaluated with input documents or pipeline parameters to the base64 or PEM-encoded key. Do not copy-and-paste directly to the property.

For a sample pipeline using X.509 certificate, refer to this Pipeline. You can also download this Pipeline from the Downloads section below.

 

Transform type

Default Value: auto
Example:

  • AES/GCM/NoPadding

  • DES/CBC/PKCS5Padding

String/Expression/Suggestion

Specify the cryptographic transformation the Snap needs to perform. The transform type is expressed as algorithm/mode/padding.
When set to auto the transformation will be automatically selected based on the type of encryption key using the following table:

Use the suggestion button to select a desired transformation type. When set to auto, the transformation is automatically selected based on the type of encryption key using the following table:

Initialization vector

Default: N/A
Example: $iv

String/Expression

Specify the base64-encoded initialization vector.

Output type

Default: N/A
Example: String

String/Expression/Suggestion

Specify either of the following output types you want the Snap to produce:

  • String

  • Document

Key salt

Default: N/A
Example: $key_params.passphrase.keys_salt

String/Expression

Specify the salt used in generating the key.

  • The salt is the data you incorporate in the passphrase to generate the encryption key in order to improve the security of the passphrase or key.

  • If no salt is provided to the Decrypt Field Snap, none will be used.

Key generation algorithm

Default: N/A
Example: $key_params.passphrase.key_gen_algorithm

String/Expression

Specify the algorithm to use to generate the encryption key.

Key generation iterations

Default: N/A
Example: $key_params.passphrase.key_gen_iterations

String/Expression

Specify the number of iterations to run when generating the encryption key.

Snap Execution

Default ValueValidate & Execute
Example: Execute only

Dropdown list

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Examples

Encrypt and Decrypt the Input Documents

In this pipeline, the JSON Generator Snap, passes the values to the Encrypt Field Snap that provides the fields to be encrypted. The Upstream Mapper Snap maps the values to be decrypted to the Decrypt Field Snap.

The JSON Generator Snap passes the values to the Encrypt Field Snap. Note that the key value is also provided.

The Encrypt Field Snap provides the values to be encrypted. The key value $key is passed via the input document.

The output preview from the Encrypt Field Snap:

The Mapper Snap maps the values including the key value to the Decrypt Field Snap.

The Decrypt Field Snap decrypts the provided fields.

The output preview from the Decrypt Field Snap:

Encrypting and Decrypting Documents Using Passphrase Account with Selected Algorithm Transform Type

In this pipeline, the CSV Generator Snap supplies the values to the Field Encrypt Snap which provides the fields to be encrypted. The Decrypt Snap decrypts the fields and passes the required field values using the downstream Mapper Snap. The Snaps use the PassPhrase-based Account. 

The Passphrase Account set with a nine digit phrase and a key size of 128.

The CSV Generator Snap passes the values to the Encrypt Snap.

The Field Encrypt Snap encrypts the provided fields, $Phone_m, $Phone_h, $Phone_w.  The Transform type is selected from the suggested list.

The output preview from the Field Encrypt Snap: (Note the encrypted values followed by ENC:...)

The Decrypt Field Snap decrypts the field, $Phone_h.

 

The output preview has the Phone_h field decrypted.

The Mapper Snap passes the field $Phone_h values to the output preview:

Output View:

Encrypt and Decrypt Using KeyStore Account with Transform type as 'auto'

In this pipeline, the JSON Generator Snap passes the values to the Mapper Snap that maps them to the Encrypt Field Snap for the values to be encrypted and then decrypt the values as provided in the Decrypt Field Snap.

The Keystore Account set with the Keystore location as secret_key.jks.

The JSON Generator Snap provides the values to the Mapper Snap.

The Mapper Snap maps the values to be passed to the Encrypt Field Snap.

 

The Encrypt Field Snap provides the fields to be encrypted. The Transform type is selected 'auto' which means that the Snap selects the algorithm as registered in the KeyStore file in the Account. 

The output preview from the Encrypt Field Snap:

The Decrypt Field Snap decrypts the fields as provided.

The successful execution of the pipeline displays the below output preview:

Downloads

Snap Pack History