Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Snap type:Transform
Description:

This Snap encrypts individual field values in the input documents.

  • Expected upstream Snaps:    Any Snap with a document output view
  • Expected downstream Snaps: Any Snap with a document input view
  • Expected input: Stream of documents with a nested or flat map data
  • Expected output: Same as input documents with specified field values encrypted
Prerequisites:None
Support and limitations:
Account:

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Transform Accounts for information on setting up this type of account.

KeyStore account or Passphrase-based Key account can used.

Use KeyStore account for X.509 key or secret (symmetric) key.

If no account is selected, the Key property should have an expression to be evaluated with the input document or the pipeline parameter.


Views:


InputThis Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.


Settings

Label


Insert excerpt
SPD:Snap Label
SPD:Snap Label
nopaneltrue

Fields to encrypt


Required. A table for JSON-path expressions to fields to encrypt. Use the suggest button to select the field to encrypt.

Transform type


The cryptographic transformation to perform, expressed as 'algorithm/mode/padding'. Use the suggest button to select a desired transformation type. When set to "auto", the transformation will be automatically selected based on the type of encryption key using the following table:


Key AlgorithmTransformation
AESAES/GCM/NoPadding
DESDES/CBC/PKCS5Padding
DESedeDESede/CBC/PKCS5Padding
RSARSA/None/OAEPWithSHA-256AndMGF1Padding


Example: auto, AES/GCM/NoPadding, DES/CBC/PKCS5Padding

Default value: auto

Advanced Options
Key

This property is required if no account is selected.

It should be a JSON-path expression to be evaluated with input documents or pipeline parameters. The result should be 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 the attached pipeline file below:

"Encrypt Decrypt X.509 certificate from input document.slp"

Example: $key

Default value: None

Initialization vector

JSON-path expression to be evaluated with input documents or pipeline parameters to be the base64-encoded initialization vector. Leave empty to generate one automatically. Note that the content of the initialization vector should be different for every encryption operation. Reusing IVs will make the encryption operation less secure.

Example: $iv

Default value: None

Encapsulate output

If selected, encrypted fields are JSON-encoded and encapsulated between "ENC:" and ":ENC" strings. When unselected, the field to be encrypted will be replaced with an object with the output of the encryption operation as needed to perform the decryption.

Default value: Selected

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Examples


Expand
titleEncrypt and Decrypt with input document

Encrypt and Decrypt

with input document

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:




Expand
titleEncrypt and Decrypt using Passphrase Account with selected algorithm Transform type

Encrypt and Decrypt

using

Using Passphrase Account with

selected algorithm

Selected Algorithm Transform

type

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. Note that the output preview has the Phone_h field decrypted.

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



Expand
titleEncrypt and Decrypt using KeyStore Account with Transform type as 'auto'

Encrypt and Decrypt

using

Using KeyStore Account with Auto Transform

type as 'auto'

Type

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

Attachments
uploadfalse
oldfalse
patterns*.slp, *.zip

Insert excerpt
Transform Snap Pack
Transform Snap Pack
nopaneltrue