You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2026/10/01 09:15:50 UTC

(ofbiz-framework) 02/03: Refactor decryption error handling in EntityCrypto to remove legacy support for 3-DES

This is an automated email from the ASF dual-hosted git repository.

jacopoc pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 60c52bfa25a242f66d4b83d31b5fa05a136cac16
Author: Jacopo Cappellato <ja...@gmail.com>
AuthorDate: Wed Sep 30 16:41:39 2026 +0200

    Refactor decryption error handling in EntityCrypto to remove legacy support for 3-DES
---
 .../java/org/apache/ofbiz/entity/util/EntityCrypto.java | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
index 5618e41c16..ecedf691f4 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
@@ -116,22 +116,7 @@ public final class EntityCrypto {
         try {
             return doDecrypt(keyName, encryptMethod, encryptedString, handlers[0]);
         } catch (Exception e) {
-            /*
-            When the field is encrypted with the old algorithm (3-DES), the new Shiro code will fail to decrypt it (using AES) and then it will
-            throw an org.apache.shiro.crypto.cipher.CryptoException that is a RuntimeException.
-            For backward compatibility we want instead to catch the exception and decrypt the code using the old algorithm.
-             */
-            Debug.logInfo("Decrypt with DES key from standard key name hash failed, trying old/funny variety of key name hash", MODULE);
-            for (int i = 1; i < handlers.length; i++) {
-                try {
-                    // try using the old/bad hex encoding approach; this is another path the code may take, ie if there
-                    // is an exception thrown in decrypt
-                    return doDecrypt(keyName, encryptMethod, encryptedString, handlers[i]);
-                } catch (GeneralException e1) {
-                    // NOTE: this throws the original exception back, not the new one if it fails using the other approach
-                    //throw new EntityCryptoException(e);
-                }
-            }
+            // Shiro signals decryption failures with org.apache.shiro.crypto.CryptoException, which is a RuntimeException
             throw new EntityCryptoException(e);
         }
     }