You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tk...@apache.org on 2015/11/19 07:20:47 UTC

[04/24] nifi git commit: NIFI-1054: Fixing Line endings of source code

http://git-wip-us.apache.org/repos/asf/nifi/blob/e2d3d1b7/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPKeyBasedEncryptor.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPKeyBasedEncryptor.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPKeyBasedEncryptor.java
index b91a529..1931c72 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPKeyBasedEncryptor.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPKeyBasedEncryptor.java
@@ -1,283 +1,283 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.standard.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.NoSuchProviderException;
-import java.security.SecureRandom;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.zip.Deflater;
-
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.io.StreamCallback;
-import org.apache.nifi.processors.standard.EncryptContent;
-import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
-import org.bouncycastle.bcpg.ArmoredOutputStream;
-import org.bouncycastle.openpgp.PGPCompressedData;
-import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
-import org.bouncycastle.openpgp.PGPEncryptedData;
-import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
-import org.bouncycastle.openpgp.PGPEncryptedDataList;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPLiteralData;
-import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
-import org.bouncycastle.openpgp.PGPObjectFactory;
-import org.bouncycastle.openpgp.PGPPrivateKey;
-import org.bouncycastle.openpgp.PGPPublicKey;
-import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData;
-import org.bouncycastle.openpgp.PGPPublicKeyRing;
-import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
-import org.bouncycastle.openpgp.PGPSecretKey;
-import org.bouncycastle.openpgp.PGPSecretKeyRing;
-import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
-import org.bouncycastle.openpgp.PGPUtil;
-
-public class OpenPGPKeyBasedEncryptor implements Encryptor {
-
-    private String algorithm;
-    private String provider;
-    private String keyring;
-    private String userId;
-    private char[] passphrase;
-    private String filename;
-
-    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
-
-    public OpenPGPKeyBasedEncryptor(final String algorithm, final String provider, final String keyring, final String userId, final char[] passphrase, final String filename) {
-        this.algorithm = algorithm;
-        this.provider = provider;
-        this.keyring = keyring;
-        this.userId = userId;
-        this.passphrase = passphrase;
-        this.filename = filename;
-    }
-
-    @Override
-    public StreamCallback getEncryptionCallback() throws Exception {
-        return new OpenPGPEncryptCallback(algorithm, provider, keyring, userId, filename);
-    }
-
-    @Override
-    public StreamCallback getDecryptionCallback() throws Exception {
-        return new OpenPGPDecryptCallback(provider, keyring, passphrase);
-    }
-
-    /*
-     * Validate secret keyring passphrase
-     */
-    public static boolean validateKeyring(String provider, String secretKeyringFile, char[] passphrase) throws IOException, PGPException, NoSuchProviderException {
-        try (InputStream fin = Files.newInputStream(Paths.get(secretKeyringFile)); InputStream pin = PGPUtil.getDecoderStream(fin)) {
-            PGPSecretKeyRingCollection pgpsec = new PGPSecretKeyRingCollection(pin);
-            Iterator ringit = pgpsec.getKeyRings();
-            while (ringit.hasNext()) {
-                PGPSecretKeyRing secretkeyring = (PGPSecretKeyRing) ringit.next();
-                PGPSecretKey secretkey = secretkeyring.getSecretKey();
-                secretkey.extractPrivateKey(passphrase, provider);
-                return true;
-            }
-            return false;
-        }
-
-    }
-
-    /*
-     * Get the public key for a specific user id from a keyring.
-     */
-    @SuppressWarnings("rawtypes")
-    public static PGPPublicKey getPublicKey(String userId, String publicKeyring) throws IOException, PGPException {
-        PGPPublicKey pubkey = null;
-        try (InputStream fin = Files.newInputStream(Paths.get(publicKeyring)); InputStream pin = PGPUtil.getDecoderStream(fin)) {
-            PGPPublicKeyRingCollection pgppub = new PGPPublicKeyRingCollection(pin);
-
-            Iterator ringit = pgppub.getKeyRings();
-            while (ringit.hasNext()) {
-                PGPPublicKeyRing kring = (PGPPublicKeyRing) ringit.next();
-
-                Iterator keyit = kring.getPublicKeys();
-                while (keyit.hasNext()) {
-                    pubkey = (PGPPublicKey) keyit.next();
-                    boolean userIdMatch = false;
-
-                    Iterator userit = pubkey.getUserIDs();
-                    while (userit.hasNext()) {
-                        String id = userit.next().toString();
-                        if (id.contains(userId)) {
-                            userIdMatch = true;
-                            break;
-                        }
-                    }
-                    if (pubkey.isEncryptionKey() && userIdMatch) {
-                        return pubkey;
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    private static class OpenPGPDecryptCallback implements StreamCallback {
-
-        private String provider;
-        private String secretKeyring;
-        private char[] passphrase;
-
-        OpenPGPDecryptCallback(final String provider, final String keyring, final char[] passphrase) {
-            this.provider = provider;
-            this.secretKeyring = keyring;
-            this.passphrase = passphrase;
-        }
-
-        @Override
-        public void process(InputStream in, OutputStream out) throws IOException {
-            try (InputStream pgpin = PGPUtil.getDecoderStream(in)) {
-                PGPObjectFactory pgpFactory = new PGPObjectFactory(pgpin);
-
-                Object obj = pgpFactory.nextObject();
-                if (!(obj instanceof PGPEncryptedDataList)) {
-                    obj = pgpFactory.nextObject();
-                    if (!(obj instanceof PGPEncryptedDataList)) {
-                        throw new ProcessException("Invalid OpenPGP data");
-                    }
-                }
-                PGPEncryptedDataList encList = (PGPEncryptedDataList) obj;
-
-                PGPSecretKeyRingCollection pgpSecretKeyring;
-                try (InputStream secretKeyringIS = Files.newInputStream(Paths.get(secretKeyring)); InputStream pgpIS = PGPUtil.getDecoderStream(secretKeyringIS)) {
-                    // open secret keyring file
-                    pgpSecretKeyring = new PGPSecretKeyRingCollection(pgpIS);
-                } catch (Exception e) {
-                    throw new ProcessException("Invalid secret keyring - " + e.getMessage());
-                }
-
-                try {
-                    PGPPrivateKey privateKey = null;
-                    PGPPublicKeyEncryptedData encData = null;
-
-                    // find the secret key in the encrypted data
-                    Iterator it = encList.getEncryptedDataObjects();
-                    while (privateKey == null && it.hasNext()) {
-                        obj = it.next();
-                        if (!(obj instanceof PGPPublicKeyEncryptedData)) {
-                            throw new ProcessException("Invalid OpenPGP data");
-                        }
-                        encData = (PGPPublicKeyEncryptedData) obj;
-                        PGPSecretKey secretkey = pgpSecretKeyring.getSecretKey(encData.getKeyID());
-                        if (secretkey != null) {
-                            privateKey = secretkey.extractPrivateKey(passphrase, provider);
-                        }
-                    }
-                    if (privateKey == null) {
-                        throw new ProcessException("Secret keyring does not contain the key required to decrypt");
-                    }
-
-                    try (InputStream clearData = encData.getDataStream(privateKey, provider)) {
-                        PGPObjectFactory clearFactory = new PGPObjectFactory(clearData);
-
-                        obj = clearFactory.nextObject();
-                        if (obj instanceof PGPCompressedData) {
-                            PGPCompressedData compData = (PGPCompressedData) obj;
-                            clearFactory = new PGPObjectFactory(compData.getDataStream());
-                            obj = clearFactory.nextObject();
-                        }
-                        PGPLiteralData literal = (PGPLiteralData) obj;
-
-                        try (InputStream lis = literal.getInputStream()) {
-                            final byte[] buffer = new byte[4096];
-                            int len;
-                            while ((len = lis.read(buffer)) >= 0) {
-                                out.write(buffer, 0, len);
-                            }
-                        }
-                    }
-                } catch (Exception e) {
-                    throw new ProcessException(e.getMessage());
-                }
-            }
-        }
-
-    }
-
-    private static class OpenPGPEncryptCallback implements StreamCallback {
-
-        private String algorithm;
-        private String provider;
-        private String publicKeyring;
-        private String userId;
-        private String filename;
-
-        OpenPGPEncryptCallback(final String algorithm, final String provider, final String keyring, final String userId, final String filename) {
-            this.algorithm = algorithm;
-            this.provider = provider;
-            this.publicKeyring = keyring;
-            this.userId = userId;
-            this.filename = filename;
-        }
-
-        @Override
-        public void process(InputStream in, OutputStream out) throws IOException {
-            PGPPublicKey publicKey;
-            try {
-                publicKey = getPublicKey(userId, publicKeyring);
-            } catch (Exception e) {
-                throw new ProcessException("Invalid public keyring - " + e.getMessage());
-            }
-
-            try {
-                SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
-
-                OutputStream output = out;
-                if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
-                    output = new ArmoredOutputStream(out);
-                }
-
-                try {
-                    PGPEncryptedDataGenerator encGenerator = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, false, secureRandom, provider);
-                    encGenerator.addMethod(publicKey);
-                    try (OutputStream encOut = encGenerator.open(output, new byte[65536])) {
-
-                        PGPCompressedDataGenerator compData = new PGPCompressedDataGenerator(PGPCompressedData.ZIP, Deflater.BEST_SPEED);
-                        try (OutputStream compOut = compData.open(encOut, new byte[65536])) {
-
-                            PGPLiteralDataGenerator literal = new PGPLiteralDataGenerator();
-                            try (OutputStream literalOut = literal.open(compOut, PGPLiteralData.BINARY, filename, new Date(), new byte[65536])) {
-
-                                final byte[] buffer = new byte[4096];
-                                int len;
-                                while ((len = in.read(buffer)) >= 0) {
-                                    literalOut.write(buffer, 0, len);
-                                }
-
-                            }
-                        }
-                    }
-                } finally {
-                    if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
-                        output.close();
-                    }
-                }
-            } catch (Exception e) {
-                throw new ProcessException(e.getMessage());
-            }
-        }
-
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.standard.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.NoSuchProviderException;
+import java.security.SecureRandom;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.zip.Deflater;
+
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processors.standard.EncryptContent;
+import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
+import org.bouncycastle.bcpg.ArmoredOutputStream;
+import org.bouncycastle.openpgp.PGPCompressedData;
+import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
+import org.bouncycastle.openpgp.PGPEncryptedData;
+import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
+import org.bouncycastle.openpgp.PGPEncryptedDataList;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPLiteralData;
+import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
+import org.bouncycastle.openpgp.PGPObjectFactory;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+import org.bouncycastle.openpgp.PGPPublicKey;
+import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData;
+import org.bouncycastle.openpgp.PGPPublicKeyRing;
+import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
+import org.bouncycastle.openpgp.PGPSecretKey;
+import org.bouncycastle.openpgp.PGPSecretKeyRing;
+import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
+import org.bouncycastle.openpgp.PGPUtil;
+
+public class OpenPGPKeyBasedEncryptor implements Encryptor {
+
+    private String algorithm;
+    private String provider;
+    private String keyring;
+    private String userId;
+    private char[] passphrase;
+    private String filename;
+
+    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
+
+    public OpenPGPKeyBasedEncryptor(final String algorithm, final String provider, final String keyring, final String userId, final char[] passphrase, final String filename) {
+        this.algorithm = algorithm;
+        this.provider = provider;
+        this.keyring = keyring;
+        this.userId = userId;
+        this.passphrase = passphrase;
+        this.filename = filename;
+    }
+
+    @Override
+    public StreamCallback getEncryptionCallback() throws Exception {
+        return new OpenPGPEncryptCallback(algorithm, provider, keyring, userId, filename);
+    }
+
+    @Override
+    public StreamCallback getDecryptionCallback() throws Exception {
+        return new OpenPGPDecryptCallback(provider, keyring, passphrase);
+    }
+
+    /*
+     * Validate secret keyring passphrase
+     */
+    public static boolean validateKeyring(String provider, String secretKeyringFile, char[] passphrase) throws IOException, PGPException, NoSuchProviderException {
+        try (InputStream fin = Files.newInputStream(Paths.get(secretKeyringFile)); InputStream pin = PGPUtil.getDecoderStream(fin)) {
+            PGPSecretKeyRingCollection pgpsec = new PGPSecretKeyRingCollection(pin);
+            Iterator ringit = pgpsec.getKeyRings();
+            while (ringit.hasNext()) {
+                PGPSecretKeyRing secretkeyring = (PGPSecretKeyRing) ringit.next();
+                PGPSecretKey secretkey = secretkeyring.getSecretKey();
+                secretkey.extractPrivateKey(passphrase, provider);
+                return true;
+            }
+            return false;
+        }
+
+    }
+
+    /*
+     * Get the public key for a specific user id from a keyring.
+     */
+    @SuppressWarnings("rawtypes")
+    public static PGPPublicKey getPublicKey(String userId, String publicKeyring) throws IOException, PGPException {
+        PGPPublicKey pubkey = null;
+        try (InputStream fin = Files.newInputStream(Paths.get(publicKeyring)); InputStream pin = PGPUtil.getDecoderStream(fin)) {
+            PGPPublicKeyRingCollection pgppub = new PGPPublicKeyRingCollection(pin);
+
+            Iterator ringit = pgppub.getKeyRings();
+            while (ringit.hasNext()) {
+                PGPPublicKeyRing kring = (PGPPublicKeyRing) ringit.next();
+
+                Iterator keyit = kring.getPublicKeys();
+                while (keyit.hasNext()) {
+                    pubkey = (PGPPublicKey) keyit.next();
+                    boolean userIdMatch = false;
+
+                    Iterator userit = pubkey.getUserIDs();
+                    while (userit.hasNext()) {
+                        String id = userit.next().toString();
+                        if (id.contains(userId)) {
+                            userIdMatch = true;
+                            break;
+                        }
+                    }
+                    if (pubkey.isEncryptionKey() && userIdMatch) {
+                        return pubkey;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    private static class OpenPGPDecryptCallback implements StreamCallback {
+
+        private String provider;
+        private String secretKeyring;
+        private char[] passphrase;
+
+        OpenPGPDecryptCallback(final String provider, final String keyring, final char[] passphrase) {
+            this.provider = provider;
+            this.secretKeyring = keyring;
+            this.passphrase = passphrase;
+        }
+
+        @Override
+        public void process(InputStream in, OutputStream out) throws IOException {
+            try (InputStream pgpin = PGPUtil.getDecoderStream(in)) {
+                PGPObjectFactory pgpFactory = new PGPObjectFactory(pgpin);
+
+                Object obj = pgpFactory.nextObject();
+                if (!(obj instanceof PGPEncryptedDataList)) {
+                    obj = pgpFactory.nextObject();
+                    if (!(obj instanceof PGPEncryptedDataList)) {
+                        throw new ProcessException("Invalid OpenPGP data");
+                    }
+                }
+                PGPEncryptedDataList encList = (PGPEncryptedDataList) obj;
+
+                PGPSecretKeyRingCollection pgpSecretKeyring;
+                try (InputStream secretKeyringIS = Files.newInputStream(Paths.get(secretKeyring)); InputStream pgpIS = PGPUtil.getDecoderStream(secretKeyringIS)) {
+                    // open secret keyring file
+                    pgpSecretKeyring = new PGPSecretKeyRingCollection(pgpIS);
+                } catch (Exception e) {
+                    throw new ProcessException("Invalid secret keyring - " + e.getMessage());
+                }
+
+                try {
+                    PGPPrivateKey privateKey = null;
+                    PGPPublicKeyEncryptedData encData = null;
+
+                    // find the secret key in the encrypted data
+                    Iterator it = encList.getEncryptedDataObjects();
+                    while (privateKey == null && it.hasNext()) {
+                        obj = it.next();
+                        if (!(obj instanceof PGPPublicKeyEncryptedData)) {
+                            throw new ProcessException("Invalid OpenPGP data");
+                        }
+                        encData = (PGPPublicKeyEncryptedData) obj;
+                        PGPSecretKey secretkey = pgpSecretKeyring.getSecretKey(encData.getKeyID());
+                        if (secretkey != null) {
+                            privateKey = secretkey.extractPrivateKey(passphrase, provider);
+                        }
+                    }
+                    if (privateKey == null) {
+                        throw new ProcessException("Secret keyring does not contain the key required to decrypt");
+                    }
+
+                    try (InputStream clearData = encData.getDataStream(privateKey, provider)) {
+                        PGPObjectFactory clearFactory = new PGPObjectFactory(clearData);
+
+                        obj = clearFactory.nextObject();
+                        if (obj instanceof PGPCompressedData) {
+                            PGPCompressedData compData = (PGPCompressedData) obj;
+                            clearFactory = new PGPObjectFactory(compData.getDataStream());
+                            obj = clearFactory.nextObject();
+                        }
+                        PGPLiteralData literal = (PGPLiteralData) obj;
+
+                        try (InputStream lis = literal.getInputStream()) {
+                            final byte[] buffer = new byte[4096];
+                            int len;
+                            while ((len = lis.read(buffer)) >= 0) {
+                                out.write(buffer, 0, len);
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    throw new ProcessException(e.getMessage());
+                }
+            }
+        }
+
+    }
+
+    private static class OpenPGPEncryptCallback implements StreamCallback {
+
+        private String algorithm;
+        private String provider;
+        private String publicKeyring;
+        private String userId;
+        private String filename;
+
+        OpenPGPEncryptCallback(final String algorithm, final String provider, final String keyring, final String userId, final String filename) {
+            this.algorithm = algorithm;
+            this.provider = provider;
+            this.publicKeyring = keyring;
+            this.userId = userId;
+            this.filename = filename;
+        }
+
+        @Override
+        public void process(InputStream in, OutputStream out) throws IOException {
+            PGPPublicKey publicKey;
+            try {
+                publicKey = getPublicKey(userId, publicKeyring);
+            } catch (Exception e) {
+                throw new ProcessException("Invalid public keyring - " + e.getMessage());
+            }
+
+            try {
+                SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
+
+                OutputStream output = out;
+                if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
+                    output = new ArmoredOutputStream(out);
+                }
+
+                try {
+                    PGPEncryptedDataGenerator encGenerator = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, false, secureRandom, provider);
+                    encGenerator.addMethod(publicKey);
+                    try (OutputStream encOut = encGenerator.open(output, new byte[65536])) {
+
+                        PGPCompressedDataGenerator compData = new PGPCompressedDataGenerator(PGPCompressedData.ZIP, Deflater.BEST_SPEED);
+                        try (OutputStream compOut = compData.open(encOut, new byte[65536])) {
+
+                            PGPLiteralDataGenerator literal = new PGPLiteralDataGenerator();
+                            try (OutputStream literalOut = literal.open(compOut, PGPLiteralData.BINARY, filename, new Date(), new byte[65536])) {
+
+                                final byte[] buffer = new byte[4096];
+                                int len;
+                                while ((len = in.read(buffer)) >= 0) {
+                                    literalOut.write(buffer, 0, len);
+                                }
+
+                            }
+                        }
+                    }
+                } finally {
+                    if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
+                        output.close();
+                    }
+                }
+            } catch (Exception e) {
+                throw new ProcessException(e.getMessage());
+            }
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/e2d3d1b7/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPPasswordBasedEncryptor.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPPasswordBasedEncryptor.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPPasswordBasedEncryptor.java
index b09d444..e0c398c 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPPasswordBasedEncryptor.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/OpenPGPPasswordBasedEncryptor.java
@@ -1,175 +1,175 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.standard.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.SecureRandom;
-import java.util.Date;
-import java.util.zip.Deflater;
-
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.io.StreamCallback;
-import org.apache.nifi.processors.standard.EncryptContent;
-import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
-import org.bouncycastle.bcpg.ArmoredOutputStream;
-import org.bouncycastle.openpgp.PGPCompressedData;
-import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
-import org.bouncycastle.openpgp.PGPEncryptedData;
-import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
-import org.bouncycastle.openpgp.PGPEncryptedDataList;
-import org.bouncycastle.openpgp.PGPLiteralData;
-import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
-import org.bouncycastle.openpgp.PGPObjectFactory;
-import org.bouncycastle.openpgp.PGPPBEEncryptedData;
-import org.bouncycastle.openpgp.PGPUtil;
-
-public class OpenPGPPasswordBasedEncryptor implements Encryptor {
-
-    private String algorithm;
-    private String provider;
-    private char[] password;
-    private String filename;
-
-    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
-
-    public OpenPGPPasswordBasedEncryptor(final String algorithm, final String provider, final char[] passphrase, final String filename) {
-        this.algorithm = algorithm;
-        this.provider = provider;
-        this.password = passphrase;
-        this.filename = filename;
-    }
-
-    @Override
-    public StreamCallback getEncryptionCallback() throws Exception {
-        return new OpenPGPEncryptCallback(algorithm, provider, password, filename);
-    }
-
-    @Override
-    public StreamCallback getDecryptionCallback() throws Exception {
-        return new OpenPGPDecryptCallback(provider, password);
-    }
-
-    private static class OpenPGPDecryptCallback implements StreamCallback {
-
-        private String provider;
-        private char[] password;
-
-        OpenPGPDecryptCallback(final String provider, final char[] password) {
-            this.provider = provider;
-            this.password = password;
-        }
-
-        @Override
-        public void process(InputStream in, OutputStream out) throws IOException {
-            InputStream pgpin = PGPUtil.getDecoderStream(in);
-            PGPObjectFactory pgpFactory = new PGPObjectFactory(pgpin);
-
-            Object obj = pgpFactory.nextObject();
-            if (!(obj instanceof PGPEncryptedDataList)) {
-                obj = pgpFactory.nextObject();
-                if (!(obj instanceof PGPEncryptedDataList)) {
-                    throw new ProcessException("Invalid OpenPGP data");
-                }
-            }
-            PGPEncryptedDataList encList = (PGPEncryptedDataList) obj;
-
-            obj = encList.get(0);
-            if (!(obj instanceof PGPPBEEncryptedData)) {
-                throw new ProcessException("Invalid OpenPGP data");
-            }
-            PGPPBEEncryptedData encData = (PGPPBEEncryptedData) obj;
-
-            try {
-                InputStream clearData = encData.getDataStream(password, provider);
-                PGPObjectFactory clearFactory = new PGPObjectFactory(clearData);
-
-                obj = clearFactory.nextObject();
-                if (obj instanceof PGPCompressedData) {
-                    PGPCompressedData compData = (PGPCompressedData) obj;
-                    clearFactory = new PGPObjectFactory(compData.getDataStream());
-                    obj = clearFactory.nextObject();
-                }
-                PGPLiteralData literal = (PGPLiteralData) obj;
-
-                InputStream lis = literal.getInputStream();
-                final byte[] buffer = new byte[4096];
-                int len;
-                while ((len = lis.read(buffer)) >= 0) {
-                    out.write(buffer, 0, len);
-                }
-            } catch (Exception e) {
-                throw new ProcessException(e.getMessage());
-            }
-        }
-
-    }
-
-    private static class OpenPGPEncryptCallback implements StreamCallback {
-
-        private String algorithm;
-        private String provider;
-        private char[] password;
-        private String filename;
-
-        OpenPGPEncryptCallback(final String algorithm, final String provider, final char[] password, final String filename) {
-            this.algorithm = algorithm;
-            this.provider = provider;
-            this.password = password;
-            this.filename = filename;
-        }
-
-        @Override
-        public void process(InputStream in, OutputStream out) throws IOException {
-            try {
-                SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
-
-                OutputStream output = out;
-                if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
-                    output = new ArmoredOutputStream(out);
-                }
-
-                PGPEncryptedDataGenerator encGenerator = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, false,
-                        secureRandom, provider);
-                encGenerator.addMethod(password);
-                OutputStream encOut = encGenerator.open(output, new byte[65536]);
-
-                PGPCompressedDataGenerator compData = new PGPCompressedDataGenerator(PGPCompressedData.ZIP, Deflater.BEST_SPEED);
-                OutputStream compOut = compData.open(encOut, new byte[65536]);
-
-                PGPLiteralDataGenerator literal = new PGPLiteralDataGenerator();
-                OutputStream literalOut = literal.open(compOut, PGPLiteralData.BINARY, filename, new Date(), new byte[65536]);
-
-                final byte[] buffer = new byte[4096];
-                int len;
-                while ((len = in.read(buffer)) >= 0) {
-                    literalOut.write(buffer, 0, len);
-                }
-
-                literalOut.close();
-                compOut.close();
-                encOut.close();
-                output.close();
-            } catch (Exception e) {
-                throw new ProcessException(e.getMessage());
-            }
-
-        }
-
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.standard.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.SecureRandom;
+import java.util.Date;
+import java.util.zip.Deflater;
+
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processors.standard.EncryptContent;
+import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
+import org.bouncycastle.bcpg.ArmoredOutputStream;
+import org.bouncycastle.openpgp.PGPCompressedData;
+import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
+import org.bouncycastle.openpgp.PGPEncryptedData;
+import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
+import org.bouncycastle.openpgp.PGPEncryptedDataList;
+import org.bouncycastle.openpgp.PGPLiteralData;
+import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
+import org.bouncycastle.openpgp.PGPObjectFactory;
+import org.bouncycastle.openpgp.PGPPBEEncryptedData;
+import org.bouncycastle.openpgp.PGPUtil;
+
+public class OpenPGPPasswordBasedEncryptor implements Encryptor {
+
+    private String algorithm;
+    private String provider;
+    private char[] password;
+    private String filename;
+
+    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
+
+    public OpenPGPPasswordBasedEncryptor(final String algorithm, final String provider, final char[] passphrase, final String filename) {
+        this.algorithm = algorithm;
+        this.provider = provider;
+        this.password = passphrase;
+        this.filename = filename;
+    }
+
+    @Override
+    public StreamCallback getEncryptionCallback() throws Exception {
+        return new OpenPGPEncryptCallback(algorithm, provider, password, filename);
+    }
+
+    @Override
+    public StreamCallback getDecryptionCallback() throws Exception {
+        return new OpenPGPDecryptCallback(provider, password);
+    }
+
+    private static class OpenPGPDecryptCallback implements StreamCallback {
+
+        private String provider;
+        private char[] password;
+
+        OpenPGPDecryptCallback(final String provider, final char[] password) {
+            this.provider = provider;
+            this.password = password;
+        }
+
+        @Override
+        public void process(InputStream in, OutputStream out) throws IOException {
+            InputStream pgpin = PGPUtil.getDecoderStream(in);
+            PGPObjectFactory pgpFactory = new PGPObjectFactory(pgpin);
+
+            Object obj = pgpFactory.nextObject();
+            if (!(obj instanceof PGPEncryptedDataList)) {
+                obj = pgpFactory.nextObject();
+                if (!(obj instanceof PGPEncryptedDataList)) {
+                    throw new ProcessException("Invalid OpenPGP data");
+                }
+            }
+            PGPEncryptedDataList encList = (PGPEncryptedDataList) obj;
+
+            obj = encList.get(0);
+            if (!(obj instanceof PGPPBEEncryptedData)) {
+                throw new ProcessException("Invalid OpenPGP data");
+            }
+            PGPPBEEncryptedData encData = (PGPPBEEncryptedData) obj;
+
+            try {
+                InputStream clearData = encData.getDataStream(password, provider);
+                PGPObjectFactory clearFactory = new PGPObjectFactory(clearData);
+
+                obj = clearFactory.nextObject();
+                if (obj instanceof PGPCompressedData) {
+                    PGPCompressedData compData = (PGPCompressedData) obj;
+                    clearFactory = new PGPObjectFactory(compData.getDataStream());
+                    obj = clearFactory.nextObject();
+                }
+                PGPLiteralData literal = (PGPLiteralData) obj;
+
+                InputStream lis = literal.getInputStream();
+                final byte[] buffer = new byte[4096];
+                int len;
+                while ((len = lis.read(buffer)) >= 0) {
+                    out.write(buffer, 0, len);
+                }
+            } catch (Exception e) {
+                throw new ProcessException(e.getMessage());
+            }
+        }
+
+    }
+
+    private static class OpenPGPEncryptCallback implements StreamCallback {
+
+        private String algorithm;
+        private String provider;
+        private char[] password;
+        private String filename;
+
+        OpenPGPEncryptCallback(final String algorithm, final String provider, final char[] password, final String filename) {
+            this.algorithm = algorithm;
+            this.provider = provider;
+            this.password = password;
+            this.filename = filename;
+        }
+
+        @Override
+        public void process(InputStream in, OutputStream out) throws IOException {
+            try {
+                SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
+
+                OutputStream output = out;
+                if (EncryptContent.isPGPArmoredAlgorithm(algorithm)) {
+                    output = new ArmoredOutputStream(out);
+                }
+
+                PGPEncryptedDataGenerator encGenerator = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, false,
+                        secureRandom, provider);
+                encGenerator.addMethod(password);
+                OutputStream encOut = encGenerator.open(output, new byte[65536]);
+
+                PGPCompressedDataGenerator compData = new PGPCompressedDataGenerator(PGPCompressedData.ZIP, Deflater.BEST_SPEED);
+                OutputStream compOut = compData.open(encOut, new byte[65536]);
+
+                PGPLiteralDataGenerator literal = new PGPLiteralDataGenerator();
+                OutputStream literalOut = literal.open(compOut, PGPLiteralData.BINARY, filename, new Date(), new byte[65536]);
+
+                final byte[] buffer = new byte[4096];
+                int len;
+                while ((len = in.read(buffer)) >= 0) {
+                    literalOut.write(buffer, 0, len);
+                }
+
+                literalOut.close();
+                compOut.close();
+                encOut.close();
+                output.close();
+            } catch (Exception e) {
+                throw new ProcessException(e.getMessage());
+            }
+
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/e2d3d1b7/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java
index 4f6bdc8..419e66d 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java
@@ -1,155 +1,155 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.standard.util;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.SecureRandom;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.PBEParameterSpec;
-
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.io.StreamCallback;
-import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
-import org.apache.nifi.stream.io.StreamUtils;
-
-public class PasswordBasedEncryptor implements Encryptor {
-
-    private Cipher cipher;
-    private int saltSize;
-    private SecretKey secretKey;
-
-    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
-    public static final int DEFAULT_SALT_SIZE = 8;
-
-    public PasswordBasedEncryptor(final String algorithm, final String providerName, final char[] password) {
-        super();
-        try {
-            // initialize cipher
-            this.cipher = Cipher.getInstance(algorithm, providerName);
-            int algorithmBlockSize = cipher.getBlockSize();
-            this.saltSize = (algorithmBlockSize > 0) ? algorithmBlockSize : DEFAULT_SALT_SIZE;
-
-            // initialize SecretKey from password
-            PBEKeySpec pbeKeySpec = new PBEKeySpec(password);
-            SecretKeyFactory factory = SecretKeyFactory.getInstance(algorithm, providerName);
-            this.secretKey = factory.generateSecret(pbeKeySpec);
-        } catch (Exception e) {
-            throw new ProcessException(e);
-        }
-    }
-
-    @Override
-    public StreamCallback getEncryptionCallback() throws ProcessException {
-        try {
-            byte[] salt = new byte[saltSize];
-            SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
-            secureRandom.setSeed(System.currentTimeMillis());
-            secureRandom.nextBytes(salt);
-            return new EncryptCallback(salt);
-        } catch (Exception e) {
-            throw new ProcessException(e);
-        }
-    }
-
-    @Override
-    public StreamCallback getDecryptionCallback() throws ProcessException {
-        return new DecryptCallback();
-    }
-
-    private class DecryptCallback implements StreamCallback {
-
-        public DecryptCallback() {
-        }
-
-        @Override
-        public void process(final InputStream in, final OutputStream out) throws IOException {
-            final byte[] salt = new byte[saltSize];
-            try {
-                StreamUtils.fillBuffer(in, salt);
-            } catch (final EOFException e) {
-                throw new ProcessException("Cannot decrypt because file size is smaller than salt size", e);
-            }
-
-            final PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, 1000);
-            try {
-                cipher.init(Cipher.DECRYPT_MODE, secretKey, parameterSpec);
-            } catch (final Exception e) {
-                throw new ProcessException(e);
-            }
-
-            final byte[] buffer = new byte[65536];
-            int len;
-            while ((len = in.read(buffer)) > 0) {
-                final byte[] decryptedBytes = cipher.update(buffer, 0, len);
-                if (decryptedBytes != null) {
-                    out.write(decryptedBytes);
-                }
-            }
-
-            try {
-                out.write(cipher.doFinal());
-            } catch (final Exception e) {
-                throw new ProcessException(e);
-            }
-        }
-    }
-
-    private class EncryptCallback implements StreamCallback {
-
-        private final byte[] salt;
-
-        public EncryptCallback(final byte[] salt) {
-            this.salt = salt;
-        }
-
-        @Override
-        public void process(final InputStream in, final OutputStream out) throws IOException {
-            final PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, 1000);
-            try {
-                cipher.init(Cipher.ENCRYPT_MODE, secretKey, parameterSpec);
-            } catch (final Exception e) {
-                throw new ProcessException(e);
-            }
-
-            out.write(salt);
-
-            final byte[] buffer = new byte[65536];
-            int len;
-            while ((len = in.read(buffer)) > 0) {
-                final byte[] encryptedBytes = cipher.update(buffer, 0, len);
-                if (encryptedBytes != null) {
-                    out.write(encryptedBytes);
-                }
-            }
-
-            try {
-                out.write(cipher.doFinal());
-            } catch (final IllegalBlockSizeException | BadPaddingException e) {
-                throw new ProcessException(e);
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.standard.util;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.SecureRandom;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processors.standard.EncryptContent.Encryptor;
+import org.apache.nifi.stream.io.StreamUtils;
+
+public class PasswordBasedEncryptor implements Encryptor {
+
+    private Cipher cipher;
+    private int saltSize;
+    private SecretKey secretKey;
+
+    public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
+    public static final int DEFAULT_SALT_SIZE = 8;
+
+    public PasswordBasedEncryptor(final String algorithm, final String providerName, final char[] password) {
+        super();
+        try {
+            // initialize cipher
+            this.cipher = Cipher.getInstance(algorithm, providerName);
+            int algorithmBlockSize = cipher.getBlockSize();
+            this.saltSize = (algorithmBlockSize > 0) ? algorithmBlockSize : DEFAULT_SALT_SIZE;
+
+            // initialize SecretKey from password
+            PBEKeySpec pbeKeySpec = new PBEKeySpec(password);
+            SecretKeyFactory factory = SecretKeyFactory.getInstance(algorithm, providerName);
+            this.secretKey = factory.generateSecret(pbeKeySpec);
+        } catch (Exception e) {
+            throw new ProcessException(e);
+        }
+    }
+
+    @Override
+    public StreamCallback getEncryptionCallback() throws ProcessException {
+        try {
+            byte[] salt = new byte[saltSize];
+            SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
+            secureRandom.setSeed(System.currentTimeMillis());
+            secureRandom.nextBytes(salt);
+            return new EncryptCallback(salt);
+        } catch (Exception e) {
+            throw new ProcessException(e);
+        }
+    }
+
+    @Override
+    public StreamCallback getDecryptionCallback() throws ProcessException {
+        return new DecryptCallback();
+    }
+
+    private class DecryptCallback implements StreamCallback {
+
+        public DecryptCallback() {
+        }
+
+        @Override
+        public void process(final InputStream in, final OutputStream out) throws IOException {
+            final byte[] salt = new byte[saltSize];
+            try {
+                StreamUtils.fillBuffer(in, salt);
+            } catch (final EOFException e) {
+                throw new ProcessException("Cannot decrypt because file size is smaller than salt size", e);
+            }
+
+            final PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, 1000);
+            try {
+                cipher.init(Cipher.DECRYPT_MODE, secretKey, parameterSpec);
+            } catch (final Exception e) {
+                throw new ProcessException(e);
+            }
+
+            final byte[] buffer = new byte[65536];
+            int len;
+            while ((len = in.read(buffer)) > 0) {
+                final byte[] decryptedBytes = cipher.update(buffer, 0, len);
+                if (decryptedBytes != null) {
+                    out.write(decryptedBytes);
+                }
+            }
+
+            try {
+                out.write(cipher.doFinal());
+            } catch (final Exception e) {
+                throw new ProcessException(e);
+            }
+        }
+    }
+
+    private class EncryptCallback implements StreamCallback {
+
+        private final byte[] salt;
+
+        public EncryptCallback(final byte[] salt) {
+            this.salt = salt;
+        }
+
+        @Override
+        public void process(final InputStream in, final OutputStream out) throws IOException {
+            final PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, 1000);
+            try {
+                cipher.init(Cipher.ENCRYPT_MODE, secretKey, parameterSpec);
+            } catch (final Exception e) {
+                throw new ProcessException(e);
+            }
+
+            out.write(salt);
+
+            final byte[] buffer = new byte[65536];
+            int len;
+            while ((len = in.read(buffer)) > 0) {
+                final byte[] encryptedBytes = cipher.update(buffer, 0, len);
+                if (encryptedBytes != null) {
+                    out.write(encryptedBytes);
+                }
+            }
+
+            try {
+                out.write(cipher.doFinal());
+            } catch (final IllegalBlockSizeException | BadPaddingException e) {
+                throw new ProcessException(e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/e2d3d1b7/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html
index e6417b3..829ca01 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html
@@ -1,30 +1,30 @@
-<!DOCTYPE html>
-<html lang="en">
-    <!--
-      Licensed to the Apache Software Foundation (ASF) under one or more
-      contributor license agreements.  See the NOTICE file distributed with
-      this work for additional information regarding copyright ownership.
-      The ASF licenses this file to You under the Apache License, Version 2.0
-      (the "License"); you may not use this file except in compliance with
-      the License.  You may obtain a copy of the License at
-          http://www.apache.org/licenses/LICENSE-2.0
-      Unless required by applicable law or agreed to in writing, software
-      distributed under the License is distributed on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-      See the License for the specific language governing permissions and
-      limitations under the License.
-    -->
-    <head>
-        <meta charset="utf-8"/>
+<!DOCTYPE html>
+<html lang="en">
+    <!--
+      Licensed to the Apache Software Foundation (ASF) under one or more
+      contributor license agreements.  See the NOTICE file distributed with
+      this work for additional information regarding copyright ownership.
+      The ASF licenses this file to You under the Apache License, Version 2.0
+      (the "License"); you may not use this file except in compliance with
+      the License.  You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+      Unless required by applicable law or agreed to in writing, software
+      distributed under the License is distributed on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      See the License for the specific language governing permissions and
+      limitations under the License.
+    -->
+    <head>
+        <meta charset="utf-8"/>
         <title>EncryptContent</title>
-        <link rel="stylesheet" href="../../css/component-usage.css" type="text/css"/>
-    </head>
-
-    <body>
-        <!-- Processor Documentation ================================================== -->
-        <p>
-            <strong>Note:</strong> This processor supports OpenPGP algorithms that are compatible with third party programs.
-            However, it currently cannot add a digital signature to an encrypted FlowFile.
-        </p>
-    </body>
-</html>
+        <link rel="stylesheet" href="../../css/component-usage.css" type="text/css"/>
+    </head>
+
+    <body>
+        <!-- Processor Documentation ================================================== -->
+        <p>
+            <strong>Note:</strong> This processor supports OpenPGP algorithms that are compatible with third party programs.
+            However, it currently cannot add a digital signature to an encrypted FlowFile.
+        </p>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/nifi/blob/e2d3d1b7/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/CaptureServlet.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/CaptureServlet.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/CaptureServlet.java
index a1398f4..794d6c0 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/CaptureServlet.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/CaptureServlet.java
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.standard;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Response.Status;
-
-import org.apache.nifi.stream.io.ByteArrayOutputStream;
-import org.apache.nifi.stream.io.StreamUtils;
-import org.apache.nifi.util.file.FileUtils;
-
-public class CaptureServlet extends HttpServlet {
-
-    private static final long serialVersionUID = 8402271018449653919L;
-
-    private volatile byte[] lastPost;
-
-    public byte[] getLastPost() {
-        return lastPost;
-    }
-
-    @Override
-    protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try{
-            StreamUtils.copy(request.getInputStream(), baos);
-            this.lastPost = baos.toByteArray();
-        } finally{
-            FileUtils.closeQuietly(baos);
-        }
-        response.setStatus(Status.OK.getStatusCode());
-    }
-
-    @Override
-    protected void doHead(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-        response.setHeader("Accept", "application/flowfile-v3,application/flowfile-v2");
-        response.setHeader("x-nifi-transfer-protocol-version", "1");
-        response.setHeader("Accept-Encoding", "gzip");
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.standard;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.Response.Status;
+
+import org.apache.nifi.stream.io.ByteArrayOutputStream;
+import org.apache.nifi.stream.io.StreamUtils;
+import org.apache.nifi.util.file.FileUtils;
+
+public class CaptureServlet extends HttpServlet {
+
+    private static final long serialVersionUID = 8402271018449653919L;
+
+    private volatile byte[] lastPost;
+
+    public byte[] getLastPost() {
+        return lastPost;
+    }
+
+    @Override
+    protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try{
+            StreamUtils.copy(request.getInputStream(), baos);
+            this.lastPost = baos.toByteArray();
+        } finally{
+            FileUtils.closeQuietly(baos);
+        }
+        response.setStatus(Status.OK.getStatusCode());
+    }
+
+    @Override
+    protected void doHead(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+        response.setHeader("Accept", "application/flowfile-v3,application/flowfile-v2");
+        response.setHeader("x-nifi-transfer-protocol-version", "1");
+        response.setHeader("Accept-Encoding", "gzip");
+    }
+}