directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r916400 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
Date Thu, 25 Feb 2010 19:07:46 GMT
Author: kayyagari
Date: Thu Feb 25 19:07:46 2010
New Revision: 916400

URL: http://svn.apache.org/viewvc?rev=916400&view=rev
Log:
added support for hashing userPasswords with sha-256 algorithm (DIRSERVER-1466)

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=916400&r1=916399&r2=916400&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Thu Feb 25 19:07:46 2010
@@ -241,6 +241,7 @@
      * We have at least 6 algorithms to encrypt the password :
      * <ul>
      * <li>- SHA</li>
+     * <li>- SHA-256</li>
      * <li>- SSHA (salted SHA)</li>
      * <li>- MD5</li>
      * <li>- SMD5 (slated MD5)</li>
@@ -258,7 +259,7 @@
      *  <li>- length(password) - 2, starting at 3rd position for crypt</li>
      *  </ul>
      *  <p>
-     *  For (S)SHA and (S)MD5, we have to transform the password from Base64 encoded text
+     *  For (S)SHA, SHA-256 and (S)MD5, we have to transform the password from Base64 encoded
text
      *  to a byte[] before comparing the password with the stored one.
      *  </p>
      *  <p>
@@ -371,6 +372,7 @@
         {
             case HASH_METHOD_MD5:
             case HASH_METHOD_SHA:
+            case HASH_METHOD_SHA256:
                 try
                 {
                     // We just have the password just after the algorithm, base64 encoded.
@@ -550,6 +552,9 @@
             case HASH_METHOD_SSHA:
                 return digest( LdapSecurityConstants.HASH_METHOD_SHA, credentials, salt );
 
+            case HASH_METHOD_SHA256:
+                return digest( LdapSecurityConstants.HASH_METHOD_SHA256, credentials, salt
);
+                
             case HASH_METHOD_MD5:
             case HASH_METHOD_SMD5:
                 return digest( LdapSecurityConstants.HASH_METHOD_MD5, credentials, salt );

Modified: directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java?rev=916400&r1=916399&r2=916400&view=diff
==============================================================================
--- directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
(original)
+++ directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
Thu Feb 25 19:07:46 2010
@@ -35,7 +35,9 @@
 
     HASH_METHOD_SMD5( "smd5" ),
 
-    HASH_METHOD_CRYPT( "crypt" );
+    HASH_METHOD_CRYPT( "crypt" ),
+
+    HASH_METHOD_SHA256( "sha-256" );
     
     private String name;
     
@@ -91,6 +93,11 @@
             return HASH_METHOD_CRYPT;
         }
         
+        if ( HASH_METHOD_SHA256.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SHA256;
+        }
+        
         return null;
     }
 }



Mime
View raw message