mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Chris Ridd
16.12.2013 7fc458b7be71111b4c4a6e91f7b3ed6642b104a1
opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2010 ForgeRock AS.
 *      Portions Copyright 2010-2013 ForgeRock AS.
 */
package org.opends.server.extensions;
@@ -192,6 +192,10 @@
        throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                     message, e);
      }
      finally
      {
        Arrays.fill(plainPlusSalt, (byte) 0);
      }
    }
    // Append the salt to the hashed value and base64-the whole thing.
@@ -250,6 +254,10 @@
        throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                     message, e);
      }
      finally
      {
        Arrays.fill(plainPlusSalt, (byte) 0);
      }
    }
    // Append the salt to the hashed value and base64-the whole thing.
@@ -334,6 +342,10 @@
        return false;
      }
      finally
      {
        Arrays.fill(plainPlusSalt, (byte) 0);
      }
    }
    return Arrays.equals(digestBytes, userDigestBytes);
@@ -403,6 +415,10 @@
        throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                     message, e);
      }
      finally
      {
        Arrays.fill(plainPlusSalt, (byte) 0);
      }
    }
@@ -452,8 +468,15 @@
    synchronized (digestLock)
    {
      return Arrays.equals(digestBytes,
                                messageDigest.digest(plainPlusSaltBytes));
      try
      {
        return Arrays.equals(digestBytes,
                                  messageDigest.digest(plainPlusSaltBytes));
      }
      finally
      {
        Arrays.fill(plainPlusSaltBytes, (byte) 0);
      }
    }
  }