[jboss-cvs] JBossAS SVN: r91092 - branches/JBPAPP_5_0/security/src/main/org/jboss/security/plugins.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 10 11:12:54 EDT 2009
Author: mmoyses
Date: 2009-07-10 11:12:54 -0400 (Fri, 10 Jul 2009)
New Revision: 91092
Modified:
branches/JBPAPP_5_0/security/src/main/org/jboss/security/plugins/JaasSecurityDomain.java
Log:
JBPAPP-2249: fix leading zeros
Modified: branches/JBPAPP_5_0/security/src/main/org/jboss/security/plugins/JaasSecurityDomain.java
===================================================================
--- branches/JBPAPP_5_0/security/src/main/org/jboss/security/plugins/JaasSecurityDomain.java 2009-07-10 15:12:36 UTC (rev 91091)
+++ branches/JBPAPP_5_0/security/src/main/org/jboss/security/plugins/JaasSecurityDomain.java 2009-07-10 15:12:54 UTC (rev 91092)
@@ -560,6 +560,21 @@
public byte[] decode64(String secret) throws Exception
{
byte[] encoding = CryptoUtil.fromb64(secret);
+
+ //JBAS-7094: 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];
+ }
+ }
+
byte[] decode = decode(encoding);
return decode;
}
More information about the jboss-cvs-commits
mailing list