directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r521943 - in /directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc: authentication/ConfigureAuthenticationChain.java authentication/GetSessionKey.java ticketgrant/GetSessionKey.java
Date Fri, 23 Mar 2007 23:34:05 GMT
Author: erodriguez
Date: Fri Mar 23 16:34:05 2007
New Revision: 521943

URL: http://svn.apache.org/viewvc?view=rev&rev=521943
Log:
Minor follow-on refactoring in protocol-kerberos module, resulting from replacing bouncycastle
with JDK JCE in kerberos-shared module.

Modified:
    directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/ConfigureAuthenticationChain.java
    directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/GetSessionKey.java
    directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetSessionKey.java

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/ConfigureAuthenticationChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/ConfigureAuthenticationChain.java?view=diff&rev=521943&r1=521942&r2=521943
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/ConfigureAuthenticationChain.java
(original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/ConfigureAuthenticationChain.java
Fri Mar 23 16:34:05 2007
@@ -23,8 +23,6 @@
 import java.util.Map;
 
 import org.apache.directory.server.kerberos.shared.crypto.checksum.ChecksumType;
-import org.apache.directory.server.kerberos.shared.crypto.checksum.Crc32Checksum;
-import org.apache.directory.server.kerberos.shared.crypto.checksum.RsaMd4Checksum;
 import org.apache.directory.server.kerberos.shared.crypto.checksum.RsaMd5Checksum;
 import org.apache.directory.server.kerberos.shared.crypto.checksum.Sha1Checksum;
 import org.apache.directory.server.kerberos.shared.replay.InMemoryReplayCache;
@@ -53,8 +51,6 @@
         authContext.setLockBox( lockBox );
 
         Map checksumEngines = authContext.getChecksumEngines();
-        checksumEngines.put( ChecksumType.CRC32, new Crc32Checksum() );
-        checksumEngines.put( ChecksumType.RSA_MD4, new RsaMd4Checksum() );
         checksumEngines.put( ChecksumType.RSA_MD5, new RsaMd5Checksum() );
         checksumEngines.put( ChecksumType.SHA1, new Sha1Checksum() );
 

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/GetSessionKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/GetSessionKey.java?view=diff&rev=521943&r1=521942&r2=521943
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/GetSessionKey.java
(original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/GetSessionKey.java
Fri Mar 23 16:34:05 2007
@@ -20,41 +20,33 @@
 package org.apache.directory.server.kerberos.kdc.authentication;
 
 
-import java.security.SecureRandom;
-
-import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
-import org.apache.directory.server.kerberos.shared.service.DesStringToKey;
+import org.apache.directory.server.kerberos.shared.service.SessionKeyFactory;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 
 
 /**
+ * Get a session key for this session.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class GetSessionKey extends DesStringToKey
+public class GetSessionKey implements IoHandlerCommand
 {
-    private static final SecureRandom random = new SecureRandom();
+    private String contextKey = "context";
 
 
     public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
         AuthenticationContext authContext = ( AuthenticationContext ) session.getAttribute(
getContextKey() );
-        authContext.setSessionKey( getNewSessionKey() );
+        authContext.setSessionKey( SessionKeyFactory.getSessionKey() );
 
         next.execute( session, message );
     }
 
 
-    private EncryptionKey getNewSessionKey()
+    protected String getContextKey()
     {
-        byte[] confounder = new byte[8];
-
-        // SecureRandom.nextBytes is already synchronized
-        random.nextBytes( confounder );
-
-        byte[] subSessionKey = getKey( new String( confounder ) );
-
-        return new EncryptionKey( EncryptionType.DES_CBC_MD5, subSessionKey );
+        return ( this.contextKey );
     }
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetSessionKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetSessionKey.java?view=diff&rev=521943&r1=521942&r2=521943
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetSessionKey.java
(original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetSessionKey.java
Fri Mar 23 16:34:05 2007
@@ -20,41 +20,34 @@
 package org.apache.directory.server.kerberos.kdc.ticketgrant;
 
 
-import java.security.SecureRandom;
-
-import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
-import org.apache.directory.server.kerberos.shared.service.DesStringToKey;
+import org.apache.directory.server.kerberos.kdc.authentication.AuthenticationContext;
+import org.apache.directory.server.kerberos.shared.service.SessionKeyFactory;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 
 
 /**
+ * Get a session key for this session.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class GetSessionKey extends DesStringToKey
+public class GetSessionKey implements IoHandlerCommand
 {
-    private static final SecureRandom random = new SecureRandom();
+    private String contextKey = "context";
 
 
     public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        TicketGrantingContext tgsContext = ( TicketGrantingContext ) session.getAttribute(
getContextKey() );
-        tgsContext.setSessionKey( getNewSessionKey() );
+        AuthenticationContext authContext = ( AuthenticationContext ) session.getAttribute(
getContextKey() );
+        authContext.setSessionKey( SessionKeyFactory.getSessionKey() );
 
         next.execute( session, message );
     }
 
 
-    private EncryptionKey getNewSessionKey()
+    protected String getContextKey()
     {
-        byte[] confounder = new byte[8];
-
-        // SecureRandom.nextBytes is already synchronized
-        random.nextBytes( confounder );
-
-        byte[] subSessionKey = getKey( new String( confounder ) );
-
-        return new EncryptionKey( EncryptionType.DES_CBC_MD5, subSessionKey );
+        return ( this.contextKey );
     }
 }



Mime
View raw message