Hi,
I have attached a very small patch that fixes PR28204 : PBEKeySpec
incorrectly deletes the originally passed password array
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28204)
Instead of taking a reference to the passed password, it now creates a
copy of it.
Thanks,
Matt Wringe
Changelog:
2006-06-29 Matt Wringe <[EMAIL PROTECTED]>
* javax/crypto/spec/PBEKeySpec.java (PBEKeySpec): Password now a copy
instead of a reference
Index: PBEKeySpec.java
===================================================================
RCS file: /sources/classpath/classpath/javax/crypto/spec/PBEKeySpec.java,v
retrieving revision 1.2
diff -u -r1.2 PBEKeySpec.java
--- PBEKeySpec.java 2 Jul 2005 20:32:45 -0000 1.2
+++ PBEKeySpec.java 29 Jun 2006 21:11:03 -0000
@@ -113,7 +113,8 @@
public PBEKeySpec(char[] password, byte[] salt, int iterationCount,
int keyLength)
{
- this.password = password;
+ this.password = new char[password.length];
+ System.arraycopy(password, 0, this.password, 0, password.length );
this.salt = salt;
this.iterationCount = iterationCount;
this.keyLength = keyLength;