directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: rev 57026 - incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/store
Date Tue, 09 Nov 2004 12:37:28 GMT
Author: erodriguez
Date: Tue Nov  9 04:37:27 2004
New Revision: 57026

Modified:
   incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/store/BootstrapStore.java
Log:
Moved random key generation to CryptoService where it belongs.

Modified: incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/store/BootstrapStore.java
==============================================================================
--- incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/store/BootstrapStore.java
(original)
+++ incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/store/BootstrapStore.java
Tue Nov  9 04:37:27 2004
@@ -16,9 +16,8 @@
  */
 package org.apache.kerberos.kdc.store;
 
+import org.apache.kerberos.crypto.CryptoService;
 import org.apache.kerberos.kdc.KdcConfiguration;
-import org.apache.kerberos.crypto.Confounder;
-import org.apache.kerberos.crypto.DesStringToKey;
 
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
@@ -87,17 +86,19 @@
 
         if ( config.getKdcPrincipal() != null )
         {
-            addToMap( newKeys, makeRandomKeyFor( config.getKdcPrincipal() ) );
+            addToMap( newKeys, CryptoService.getRandomKeyFor( config.getKdcPrincipal() )
);
         }
 
         if ( config.getChangepwPrincipal() != null )
         {
-		    addToMap( newKeys, makeRandomKeyFor( config.getChangepwPrincipal() ) );
+		    addToMap( newKeys, CryptoService.getRandomKeyFor( config.getChangepwPrincipal() ) );
         }
 
         if ( config.getLdapPrincipal() != null )
         {
-		    addToMap( newKeys, makePredefinedKey( config.getLdapPrincipal(), "1cb96792580404f8",
5) );
+		    addToMap( newKeys, makePredefinedKey( config.getLdapPrincipal(), "3e804307fbad9bbf",
1) );
+            addToMap( newKeys, CryptoService.getRandomKeyFor( new KerberosPrincipal( "krbtgt/25OZ.COM@25OZ.COM"
) ) );
+            addToMap( newKeys, CryptoService.getRandomKeyFor( new KerberosPrincipal( "krbtgt/EXAMPLE.COM@25OZ.COM"
) ) );
         }
 
 		FileOutputStream out = new FileOutputStream( keyStore );
@@ -117,17 +118,6 @@
 		modifier.setEncryptionType( key.getKeyType() );
 
 		return modifier.getEntry();
-	}
-
-    private KerberosKey makeRandomKeyFor( KerberosPrincipal principal )
-    {
-        final int DES_KEY_TYPE = 3;
-		int keyVersion = 1;
-
-		byte[] randomBytes = Confounder.bytes( 8 );
-		DesStringToKey randomKey = new DesStringToKey( new String( randomBytes ) );
-
-		return new KerberosKey( principal, randomKey.getKey(), DES_KEY_TYPE, keyVersion );
 	}
 
     private void addToMap( Map map, KerberosKey key )

Mime
View raw message