Skip to content

Instantly share code, notes, and snippets.

@alopresto
Created March 8, 2018 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alopresto/9c8746375673c88f058a09afe16790d2 to your computer and use it in GitHub Desktop.
Save alopresto/9c8746375673c88f058a09afe16790d2 to your computer and use it in GitHub Desktop.
This flow generates a plaintext flowfile, encrypts it using a PGP public key (key not provided), logs the cipher text, decrypts it using the corresponding PGP private key, and logs the recovered plaintext.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
<description>This flow generates a plaintext flowfile, encrypts it using a PGP public key (key not provided), logs the cipher text, decrypts it using the corresponding PGP private key, and logs the recovered plaintext. </description>
<groupId>f8e24946-0161-1000-38fc-63a7eb3ca9d1</groupId>
<name>BC Upgrade Test</name>
<snippet>
<processors>
<id>a7e90833-9bc7-3dc0-0000-000000000000</id>
<parentGroupId>479f822d-6b06-3370-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>398.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Log Level</key>
<value>
<name>Log Level</name>
</value>
</entry>
<entry>
<key>Log Payload</key>
<value>
<name>Log Payload</name>
</value>
</entry>
<entry>
<key>Attributes to Log</key>
<value>
<name>Attributes to Log</name>
</value>
</entry>
<entry>
<key>attributes-to-log-regex</key>
<value>
<name>attributes-to-log-regex</name>
</value>
</entry>
<entry>
<key>Attributes to Ignore</key>
<value>
<name>Attributes to Ignore</name>
</value>
</entry>
<entry>
<key>attributes-to-ignore-regex</key>
<value>
<name>attributes-to-ignore-regex</name>
</value>
</entry>
<entry>
<key>Log prefix</key>
<value>
<name>Log prefix</name>
</value>
</entry>
<entry>
<key>character-set</key>
<value>
<name>character-set</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Log Level</key>
<value>info</value>
</entry>
<entry>
<key>Log Payload</key>
<value>true</value>
</entry>
<entry>
<key>Attributes to Log</key>
</entry>
<entry>
<key>attributes-to-log-regex</key>
<value>.*</value>
</entry>
<entry>
<key>Attributes to Ignore</key>
</entry>
<entry>
<key>attributes-to-ignore-regex</key>
</entry>
<entry>
<key>Log prefix</key>
</entry>
<entry>
<key>character-set</key>
<value>UTF-8</value>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<name>LogAttribute</name>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.LogAttribute</type>
</processors>
<processors>
<id>c208fada-0101-39ea-0000-000000000000</id>
<parentGroupId>479f822d-6b06-3370-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>214.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Mode</key>
<value>
<name>Mode</name>
</value>
</entry>
<entry>
<key>key-derivation-function</key>
<value>
<name>key-derivation-function</name>
</value>
</entry>
<entry>
<key>Encryption Algorithm</key>
<value>
<name>Encryption Algorithm</name>
</value>
</entry>
<entry>
<key>allow-weak-crypto</key>
<value>
<name>allow-weak-crypto</name>
</value>
</entry>
<entry>
<key>Password</key>
<value>
<name>Password</name>
</value>
</entry>
<entry>
<key>raw-key-hex</key>
<value>
<name>raw-key-hex</name>
</value>
</entry>
<entry>
<key>public-keyring-file</key>
<value>
<name>public-keyring-file</name>
</value>
</entry>
<entry>
<key>public-key-user-id</key>
<value>
<name>public-key-user-id</name>
</value>
</entry>
<entry>
<key>private-keyring-file</key>
<value>
<name>private-keyring-file</name>
</value>
</entry>
<entry>
<key>private-keyring-passphrase</key>
<value>
<name>private-keyring-passphrase</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Mode</key>
<value>Encrypt</value>
</entry>
<entry>
<key>key-derivation-function</key>
<value>NONE</value>
</entry>
<entry>
<key>Encryption Algorithm</key>
<value>PGP_ASCII_ARMOR</value>
</entry>
<entry>
<key>allow-weak-crypto</key>
<value>not-allowed</value>
</entry>
<entry>
<key>Password</key>
</entry>
<entry>
<key>raw-key-hex</key>
</entry>
<entry>
<key>public-keyring-file</key>
<value>/Users/alopresto/.gnupg/pubring.gpg</value>
</entry>
<entry>
<key>public-key-user-id</key>
<value>NiFi PGP Test Key (Short test key for NiFi PGP unit tests) &lt;alopresto.apache+test@gmail.com&gt;</value>
</entry>
<entry>
<key>private-keyring-file</key>
</entry>
<entry>
<key>private-keyring-passphrase</key>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<name>EncryptContent</name>
<relationships>
<autoTerminate>true</autoTerminate>
<name>failure</name>
</relationships>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.EncryptContent</type>
</processors>
<processors>
<id>c6420351-5a37-39bf-0000-000000000000</id>
<parentGroupId>479f822d-6b06-3370-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>0.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>File Size</key>
<value>
<name>File Size</name>
</value>
</entry>
<entry>
<key>Batch Size</key>
<value>
<name>Batch Size</name>
</value>
</entry>
<entry>
<key>Data Format</key>
<value>
<name>Data Format</name>
</value>
</entry>
<entry>
<key>Unique FlowFiles</key>
<value>
<name>Unique FlowFiles</name>
</value>
</entry>
<entry>
<key>generate-ff-custom-text</key>
<value>
<name>generate-ff-custom-text</name>
</value>
</entry>
<entry>
<key>character-set</key>
<value>
<name>character-set</name>
</value>
</entry>
<entry>
<key>firstName</key>
<value>
<name>firstName</name>
</value>
</entry>
<entry>
<key>fullName</key>
<value>
<name>fullName</name>
</value>
</entry>
<entry>
<key>lastName</key>
<value>
<name>lastName</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>File Size</key>
<value>0B</value>
</entry>
<entry>
<key>Batch Size</key>
<value>1</value>
</entry>
<entry>
<key>Data Format</key>
<value>Text</value>
</entry>
<entry>
<key>Unique FlowFiles</key>
<value>false</value>
</entry>
<entry>
<key>generate-ff-custom-text</key>
<value>This is a message generated at ${now():format('yyyy/MM/dd HH:mm:ss.SSS Z')}. </value>
</entry>
<entry>
<key>character-set</key>
<value>UTF-8</value>
</entry>
<entry>
<key>firstName</key>
<value>Andy</value>
</entry>
<entry>
<key>fullName</key>
<value>${firstName} ${lastName}</value>
</entry>
<entry>
<key>lastName</key>
<value>LoPresto</value>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>1 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<name>GenerateFlowFile</name>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.GenerateFlowFile</type>
</processors>
<processors>
<id>d6e189cd-8170-3f37-0000-000000000000</id>
<parentGroupId>479f822d-6b06-3370-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>813.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Log Level</key>
<value>
<name>Log Level</name>
</value>
</entry>
<entry>
<key>Log Payload</key>
<value>
<name>Log Payload</name>
</value>
</entry>
<entry>
<key>Attributes to Log</key>
<value>
<name>Attributes to Log</name>
</value>
</entry>
<entry>
<key>attributes-to-log-regex</key>
<value>
<name>attributes-to-log-regex</name>
</value>
</entry>
<entry>
<key>Attributes to Ignore</key>
<value>
<name>Attributes to Ignore</name>
</value>
</entry>
<entry>
<key>attributes-to-ignore-regex</key>
<value>
<name>attributes-to-ignore-regex</name>
</value>
</entry>
<entry>
<key>Log prefix</key>
<value>
<name>Log prefix</name>
</value>
</entry>
<entry>
<key>character-set</key>
<value>
<name>character-set</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Log Level</key>
<value>info</value>
</entry>
<entry>
<key>Log Payload</key>
<value>true</value>
</entry>
<entry>
<key>Attributes to Log</key>
</entry>
<entry>
<key>attributes-to-log-regex</key>
<value>.*</value>
</entry>
<entry>
<key>Attributes to Ignore</key>
</entry>
<entry>
<key>attributes-to-ignore-regex</key>
</entry>
<entry>
<key>Log prefix</key>
</entry>
<entry>
<key>character-set</key>
<value>UTF-8</value>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<name>LogAttribute</name>
<relationships>
<autoTerminate>true</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.LogAttribute</type>
</processors>
<processors>
<id>eb7e2cf9-f408-3a3d-0000-000000000000</id>
<parentGroupId>479f822d-6b06-3370-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>593.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Mode</key>
<value>
<name>Mode</name>
</value>
</entry>
<entry>
<key>key-derivation-function</key>
<value>
<name>key-derivation-function</name>
</value>
</entry>
<entry>
<key>Encryption Algorithm</key>
<value>
<name>Encryption Algorithm</name>
</value>
</entry>
<entry>
<key>allow-weak-crypto</key>
<value>
<name>allow-weak-crypto</name>
</value>
</entry>
<entry>
<key>Password</key>
<value>
<name>Password</name>
</value>
</entry>
<entry>
<key>raw-key-hex</key>
<value>
<name>raw-key-hex</name>
</value>
</entry>
<entry>
<key>public-keyring-file</key>
<value>
<name>public-keyring-file</name>
</value>
</entry>
<entry>
<key>public-key-user-id</key>
<value>
<name>public-key-user-id</name>
</value>
</entry>
<entry>
<key>private-keyring-file</key>
<value>
<name>private-keyring-file</name>
</value>
</entry>
<entry>
<key>private-keyring-passphrase</key>
<value>
<name>private-keyring-passphrase</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Mode</key>
<value>Decrypt</value>
</entry>
<entry>
<key>key-derivation-function</key>
<value>NONE</value>
</entry>
<entry>
<key>Encryption Algorithm</key>
<value>PGP_ASCII_ARMOR</value>
</entry>
<entry>
<key>allow-weak-crypto</key>
<value>not-allowed</value>
</entry>
<entry>
<key>Password</key>
</entry>
<entry>
<key>raw-key-hex</key>
</entry>
<entry>
<key>public-keyring-file</key>
</entry>
<entry>
<key>public-key-user-id</key>
</entry>
<entry>
<key>private-keyring-file</key>
<value>/Users/alopresto/.gnupg/test-keyring.gpg</value>
</entry>
<entry>
<key>private-keyring-passphrase</key>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<name>DecryptContent</name>
<relationships>
<autoTerminate>true</autoTerminate>
<name>failure</name>
</relationships>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.EncryptContent</type>
</processors>
</snippet>
<timestamp>03/07/2018 16:39:43 PST</timestamp>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment