With this chain, you can enable the use of Pretty Good Privacy (PGP)-encrypted data in a chain. This chain automatically extracts and decrypts the data into a file, which can then be uploaded to a table or spreadsheet.
Note: While this chain ends in a List File Content command, you can append additional commands to upload the decrypted file to a destination.
Ingredients
To create this chain, you'll need:
- An HTTP Webhook trigger event
- The bearer token for the webhook to monitor for
POST
requests - An HTTP Request connector
- A JSON connector
- An Encryption connector
- A File Utilities connector
Step 1. Provide the encrypted data as JSON
The chain requires a Javascript object notation (JSON) object that contains ASCII-armored PGP-encrypted data, such as:
{ "ciphertext": "-----BEGIN PGP MESSAGE-----\n\[encrypted message]" }
Note: Armored ciphertext starts with -----BEGIN
.
To create this JSON object, set up an application—such as an extract, transform, load (ETL) process; iPaaS solution; or script—that:
- Replaces newlines in the encrypted data with
\n
. - Wraps the resulting string in a JSON object.
- Includes the JSON object in a
POST
request to the webhook monitored by the HTTP Webhook trigger event.
Step 2. Create the chain
- In Chain Builder, from the Chains tab, click Create Chain.
- Under Setup, enter a unique name—such as Extract PGP Data from HTTP Webhook—and a description to help identify the chain and its intent.
- Click Save.
Step 3. Start with an HTTP Webhook trigger event
- Click Trigger Events , and move HTTP Webhook to Start.
- Select the event's node, and click Edit
- Under Basic Info, enter a unique name and description to help identify the event.
- Under Trigger Event Details, select the HTTP Request connector.
- Enter the webhook's bearer token, and click Save.
Step 4. Add a Validate Schema command
To ensure properly-formed JSON, validate the schema of the ciphertext:
- Under Available BizApps, select JSON, and move Validate Schema to the canvas.
- Drag a link from Start to Validate Schema, and click Edit
- Under Basic Info, enter a unique name and description to help identify the command.
- In JSON Data, select the Data output of the trigger event.
- In Schema, enter the schema of the JSON object the application posts to the webhook. For example:
{"required":["ciphertext"],"properties":{"type":"string","description":"Armored PGP message."}}}
- In Output Schema, enter a sample of the JSON object included in the
POST
request. For example:{ "ciphertext":"ciphertext" }
- Click Save.
Step 5. Add a Decrypt with PGP Key command
To decrypt the PGP-encrypted ciphertext:
- Under Available BizApps, select Encryption, and move Decrypt with PGP Key to the canvas.
- Drag a link from Validate Schema to Decrypt with PGP Key, and click Edit
- Under Basic Info, enter a unique name and description to help identify the command.
- In Text to Decrypt, select the Ciphertext property of the Parsed File output of the Validate Schema command.
- Select Armored Message, and click Save.
Step 6. Add a List File Content command
To preview the decrypted file:
- Under Available BizApps, select File Utilities, and move List File Content to the canvas.
- Drag a link from Decrypt with PGP Key to List File Content, and click Edit
- Under Basic Info, enter a unique name and description to help identify the command.
- In File name, select the PGP Decrypted File output of the Decrypt with PGP Key command.
- In Preview lines, enter how many lines of the decrypted file to include in the preview, such as 10.
- Click Save and Publish.