Revision: 900
          http://stripes.svn.sourceforge.net/stripes/?rev=900&view=rev
Author:   bengunter
Date:     2008-05-09 21:43:48 -0700 (Fri, 09 May 2008)

Log Message:
-----------
Fixed STS-550: IBM Java6 - Could not encrypt value. Do not pass inbytes to 
Cipher.doFinal(..) if the length of the array is is zero. I believe this is a 
bug in IBM's JDK, but it's easy enough to work around.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/util/CryptoUtil.java

Modified: trunk/stripes/src/net/sourceforge/stripes/util/CryptoUtil.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/CryptoUtil.java      
2008-05-10 04:30:37 UTC (rev 899)
+++ trunk/stripes/src/net/sourceforge/stripes/util/CryptoUtil.java      
2008-05-10 04:43:48 UTC (rev 900)
@@ -137,7 +137,12 @@
             byte[] hash = generateHashCode(nonce, inbytes);
             int index = cipher.update(hash, 0, HASH_CODE_SIZE, output, 0);
             index = cipher.update(nonce, 0, NONCE_SIZE, output, index);
-            cipher.doFinal(inbytes, 0, inbytes.length, output, index);
+            if (inbytes.length == 0) {
+                cipher.doFinal(output, index);
+            }
+            else {
+                cipher.doFinal(inbytes, 0, inbytes.length, output, index);
+            }
 
             // Then base64 encode the bytes
             return Base64.encodeBytes(output, BASE64_OPTIONS);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to