svn commit: r670225 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r670225 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java

jonesde
Author: jonesde
Date: Sat Jun 21 09:48:35 2008
New Revision: 670225

URL: http://svn.apache.org/viewvc?rev=670225&view=rev
Log:
Added decryption try using old hex decoding in the exception catch block, which should catch where this usually needs to happen

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java?rev=670225&r1=670224&r2=670225&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java Sat Jun 21 09:48:35 2008
@@ -92,7 +92,15 @@
             
             return UtilObject.getObject(decryptedBytes);
         } catch (GeneralException e) {
-            throw new EntityCryptoException(e);
+            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
+                byte[] encryptedBytes = StringUtil.fromHexStringOldFunnyVariety(str);
+                byte[] decryptedBytes = DesCrypt.decrypt(this.getKey(keyName), encryptedBytes);
+                return UtilObject.getObject(decryptedBytes);
+            } 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);
+            }
         }
     }