harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r380832 - in /incubator/harmony/enhanced/classlib/trunk/modules/security: src/common/javasrc/javax/crypto/spec/SecretKeySpec.java test/common/unit/javax/crypto/spec/SecretKeySpecTest.java
Date Fri, 24 Feb 2006 22:12:20 GMT
Author: tellison
Date: Fri Feb 24 14:12:17 2006
New Revision: 380832

URL: http://svn.apache.org/viewcvs?rev=380832&view=rev
Log:
Fix for HARMONY-78 (SecurityKeySpec.getEncoded returns incorrect value)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/crypto/spec/SecretKeySpecTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java?rev=380832&r1=380831&r2=380832&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
Fri Feb 24 14:12:17 2006
@@ -60,7 +60,7 @@
             throw BADPARAMS_EXC;
         }
         this.algorithm = algorithm;
-        this.key = new byte[key.length];
+        this.key = new byte[len];
         System.arraycopy(key, offset, this.key, 0, len);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/crypto/spec/SecretKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/crypto/spec/SecretKeySpecTest.java?rev=380832&r1=380831&r2=380832&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/crypto/spec/SecretKeySpecTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/javax/crypto/spec/SecretKeySpecTest.java
Fri Feb 24 14:12:17 2006
@@ -178,6 +178,12 @@
         assertFalse("The change of returned by getEncoded() method key "
                     + "should not cause the change of internal array.",
                     result[0] == ks.getEncoded()[0]);
+
+		// Regression for HARMONY-78
+		int offset = 1;
+		int len = 4;
+		SecretKeySpec sks = new SecretKeySpec(key, offset, len, algorithm);
+		assertEquals("Key length is incorrect", len, sks.getEncoded().length);
     }
 
     /**



Mime
View raw message