You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/02/11 06:06:03 UTC

[GitHub] [camel] oscerd commented on a change in pull request #5068: CAMEL-16177: multicast parallel processing and encrypted stream cache

oscerd commented on a change in pull request #5068:
URL: https://github.com/apache/camel/pull/5068#discussion_r574267380



##########
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 instanciate decryptor, e");

Review comment:
       It should be 
   
   throw new IllegalStateException("Could not instanciate decryptor", e);
   




----------------------------------------------------------------
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:
users@infra.apache.org