[jboss-cvs] JBossAS SVN: r83426 - branches/Branch_4_2/connector/src/main/org/jboss/resource/security.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 26 14:15:32 EST 2009
Author: mmoyses
Date: 2009-01-26 14:15:32 -0500 (Mon, 26 Jan 2009)
New Revision: 83426
Modified:
branches/Branch_4_2/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java
Log:
JBAS-3457: fix for passwords that have leading zeros
Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java 2009-01-26 18:44:22 UTC (rev 83425)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java 2009-01-26 19:15:32 UTC (rev 83426)
@@ -168,6 +168,20 @@
BigInteger n = new BigInteger(secret, 16);
byte[] encoding = n.toByteArray();
+ //JBAS-3457: fix leading zeros
+ if (encoding.length % 8 != 0)
+ {
+ int length = encoding.length;
+ int newLength = ((length / 8) + 1) * 8;
+ int pad = newLength - length; //number of leading zeros
+ byte[] old = encoding;
+ encoding = new byte[newLength];
+ for (int i = old.length - 1; i >= 0; i--)
+ {
+ encoding[i + pad] = old[i];
+ }
+ }
+
Cipher cipher = Cipher.getInstance("Blowfish");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] decode = cipher.doFinal(encoding);
More information about the jboss-cvs-commits
mailing list