mgaido91 commented on a change in pull request #3664: NIFI-6536 EncryptContent accepts configurable PGP symmetric cipher URL: https://github.com/apache/nifi/pull/3664#discussion_r316535677
########## File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncryptContent.java ########## @@ -92,6 +96,48 @@ public void testRoundTrip() throws IOException { } } + @Test + public void testPgpCiphersRoundTrip() throws IOException { + final TestRunner testRunner = TestRunners.newTestRunner(new EncryptContent()); + List<String> pgpAlgorithms = new ArrayList<>(); + pgpAlgorithms.add("PGP"); + pgpAlgorithms.add("PGP_ASCII_ARMOR"); + + for (String algorithm : pgpAlgorithms) { + + testRunner.setProperty(EncryptContent.ENCRYPTION_ALGORITHM, algorithm); + testRunner.setProperty(EncryptContent.PASSWORD, "short"); + testRunner.setProperty(EncryptContent.KEY_DERIVATION_FUNCTION, KeyDerivationFunction.NIFI_LEGACY.name()); + // Must be allowed or short password will cause validation errors + testRunner.setProperty(EncryptContent.ALLOW_WEAK_CRYPTO, "allowed"); + + for (int i = 1; i < 14; i++) { + if (i != SymmetricKeyAlgorithmTags.SAFER) { + testRunner.setProperty(EncryptContent.PGP_SYMMETRIC_ENCRYPTION_CIPHER, String.valueOf(i)); + testRunner.setProperty(EncryptContent.MODE, EncryptContent.ENCRYPT_MODE); + + testRunner.enqueue(Paths.get("src/test/resources/hello.txt")); + testRunner.clearTransferState(); + testRunner.run(); + + testRunner.assertAllFlowFilesTransferred(EncryptContent.REL_SUCCESS, 1); + + MockFlowFile flowFile = testRunner.getFlowFilesForRelationship(EncryptContent.REL_SUCCESS).get(0); + testRunner.assertQueueEmpty(); + System.out.println(Arrays.toString(flowFile.toByteArray())); Review comment: ? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services