forsthofer commented on a change in pull request #5065: URL: https://github.com/apache/camel/pull/5065#discussion_r573833374
########## File path: core/camel-support/src/main/java/org/apache/camel/converter/stream/CipherPair.java ########## @@ -61,7 +60,18 @@ public Cipher getEncryptor() { return enccipher; } - public Cipher getDecryptor() { - return deccipher; + /** + * Create the decryptor every time because the decryptor is not thead safe. For example, if you reuse the decryptor + * instance in the Multi-cast case then you will get errors. + */ + public Cipher createDecryptor() { + try { + Cipher deccipher = Cipher.getInstance(transformation); + deccipher.init(Cipher.DECRYPT_MODE, key, ivp == null ? null : new IvParameterSpec(ivp)); + return deccipher; + } catch (GeneralSecurityException e) { + // should not happen + throw new IllegalStateException("Could not instantiate decryptor, e"); Review comment: We could wrap the GenealSecurityException into an IOException and throw the IOException because this exception is also used in FileInputStreamCache, the only class which uses the createDecryptor method ---------------------------------------------------------------- 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