directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r587682 - in /directory/apacheds/branches/bigbang: kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ kerberos-s...
Date Tue, 23 Oct 2007 22:47:47 GMT
Author: elecharny
Date: Tue Oct 23 15:47:43 2007
New Revision: 587682

URL: http://svn.apache.org/viewvc?rev=587682&view=rev
Log:
Modified the EncryptedData class, removed the EncryptedDataModifier, added some tests

Added:
    directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataTest.java
Removed:
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataModifier.java
Modified:
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ArcFourHmacMd5Encryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionType.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NullEncryption.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/MonitorContext.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/VerifyTgtAuthHeader.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java Tue Oct 23 15:47:43 2007
@@ -86,7 +86,7 @@
     {
         byte[] Ke = deriveKey( key.getKeyValue(), getUsageKe( usage ), 128, getKeyLength() );
 
-        byte[] encryptedData = data.getCipherText();
+        byte[] encryptedData = data.getCipher();
 
         // extract the old checksum
         byte[] oldChecksum = new byte[getChecksumLength()];

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ArcFourHmacMd5Encryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ArcFourHmacMd5Encryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ArcFourHmacMd5Encryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ArcFourHmacMd5Encryption.java Tue Oct 23 15:47:43 2007
@@ -59,7 +59,7 @@
 
     public byte[] getDecryptedData( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException
     {
-        return data.getCipherText();
+        return data.getCipher();
     }
 
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java Tue Oct 23 15:47:43 2007
@@ -93,7 +93,7 @@
     {
         byte[] Ke = deriveKey( key.getKeyValue(), getUsageKe( usage ), 64, 168 );
 
-        byte[] encryptedData = data.getCipherText();
+        byte[] encryptedData = data.getCipher();
 
         // extract the old checksum
         byte[] oldChecksum = new byte[getChecksumLength()];

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java Tue Oct 23 15:47:43 2007
@@ -92,7 +92,7 @@
     public byte[] getDecryptedData( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException
     {
         // decrypt the data
-        byte[] decryptedData = decrypt( data.getCipherText(), key.getKeyValue() );
+        byte[] decryptedData = decrypt( data.getCipher(), key.getKeyValue() );
 
         // extract the old checksum
         byte[] oldChecksum = new byte[getChecksumLength()];

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java Tue Oct 23 15:47:43 2007
@@ -84,7 +84,7 @@
     public byte[] getDecryptedData( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException
     {
         // decrypt the data
-        byte[] decryptedData = decrypt( data.getCipherText(), key.getKeyValue() );
+        byte[] decryptedData = decrypt( data.getCipher(), key.getKeyValue() );
 
         // extract the old checksum
         byte[] oldChecksum = new byte[getChecksumLength()];

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionType.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionType.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionType.java Tue Oct 23 15:47:43 2007
@@ -19,10 +19,9 @@
  */
 package org.apache.directory.server.kerberos.shared.crypto.encryption;
 
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -31,170 +30,189 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public final class EncryptionType implements Comparable<EncryptionType>
+public enum EncryptionType
 {
     /**
      * The "unknown" encryption type.
      */
-    public static final EncryptionType UNKNOWN = new EncryptionType( -1, "UNKNOWN" );
+    UNKNOWN( -1 ),
 
     /**
      * The "null" encryption type.
      */
-    public static final EncryptionType NULL = new EncryptionType( 0, "NULL" );
+    NULL( 0 ),
 
     /**
      * The des-cbc-crc encryption type.
      */
-    public static final EncryptionType DES_CBC_CRC = new EncryptionType( 1, "des-cbc-crc" );
+    DES_CBC_CRC( 1 ),
 
     /**
      * The des-cbc-md4 encryption type.
      */
-    public static final EncryptionType DES_CBC_MD4 = new EncryptionType( 2, "des-cbc-md4" );
+    DES_CBC_MD4( 2 ),
 
     /**
      * The des-cbc-md5 encryption type.
      */
-    public static final EncryptionType DES_CBC_MD5 = new EncryptionType( 3, "des-cbc-md5" );
+    DES_CBC_MD5( 3 ),
 
     /**
      * The reserved (4) encryption type.
      */
-    public static final EncryptionType RESERVED4 = new EncryptionType( 4, "[reserved]" );
+    RESERVED4( 4 ),
 
     /**
      * The des3-cbc-md5 encryption type.
      */
-    public static final EncryptionType DES3_CBC_MD5 = new EncryptionType( 5, "des3-cbc-md5" );
+    DES3_CBC_MD5( 5 ),
 
     /**
      * The reserved (6) encryption type.
      */
-    public static final EncryptionType RESERVED6 = new EncryptionType( 6, "[reserved]" );
+    RESERVED6( 6 ),
 
     /**
      * The des3-cbc-sha1 encryption type.
      */
-    public static final EncryptionType DES3_CBC_SHA1 = new EncryptionType( 7, "des3-cbc-sha1" );
+    DES3_CBC_SHA1( 7 ),
 
     /**
-     * The id-dsa-with-sha1-CmsOID encryption type.
+     * The dsaWithSHA1-CmsOID encryption type.
      */
-    public static final EncryptionType ID_DSA_WITH_SHA1_CMSOID = new EncryptionType( 9, "id-dsa-with-sha1-CmsOID" );
+    DSAWITHSHA1_CMSOID( 9 ),
 
     /**
      * The md5WithRSAEncryption-CmsOID encryption type.
      */
-    public static final EncryptionType MD5WITHRSAENCRYPTION_CMSOID = new EncryptionType( 10,
-        "md5WithRSAEncryption-CmsOID" );
+    MD5WITHRSAENCRYPTION_CMSOID( 10 ),
 
     /**
-     * The sha-1WithRSAEncryption-CmsOID encryption type.
+     * The sha1WithRSAEncryption-CmsOID encryption type.
      */
-    public static final EncryptionType SHA_1WITHRSAENCRYPTION_CMSOID = new EncryptionType( 11,
-        "sha-1WithRSAEncryption-CmsOID" );
+    SHA1WITHRSAENCRYPTION_CMSOID( 11 ),
 
     /**
-     * The rc2-cbc-EnvOID encryption type.
+     * The rc2CBC-EnvOID encryption type.
      */
-    public static final EncryptionType RC2_CBC_ENVOID = new EncryptionType( 12, "rc2-cbc-EnvOID" );
+    RC2CBC_ENVOID( 12 ),
 
     /**
      * The rsaEncryption-EnvOID encryption type.
      */
-    public static final EncryptionType RSAENCRYPTION_ENVOID = new EncryptionType( 13, "rsaEncryption-EnvOID" );
+    RSAENCRYPTION_ENVOID( 13 ),
 
     /**
-     * The id-RSAES-OAEP-EnvOID encryption type.
+     * The rsaES-OAEP-ENV-OID encryption type.
      */
-    public static final EncryptionType ID_RSAES_OAEP_ENVOID = new EncryptionType( 14, "id-RSAES-OAEP-EnvOID" );
+    RSAES_OAEP_ENV_OID( 14 ),
 
     /**
-     * The des-ede3-cbc-EnvOID encryption type.
+     * The des-ede3-cbc-Env-OID encryption type.
      */
-    public static final EncryptionType DES_EDE3_CBC_ENVOID = new EncryptionType( 15, "des-ede3-cbc-EnvOID" );
+    DES_EDE3_CBC_ENV_OID( 15 ),
 
     /**
      * The des3-cbc-sha1-kd encryption type.
      */
-    public static final EncryptionType DES3_CBC_SHA1_KD = new EncryptionType( 16, "des3-cbc-sha1-kd" );
+    DES3_CBC_SHA1_KD( 16 ),
 
     /**
      * The aes128-cts-hmac-sha1-96 encryption type.
      */
-    public static final EncryptionType AES128_CTS_HMAC_SHA1_96 = new EncryptionType( 17, "aes128-cts-hmac-sha1-96" );
+    AES128_CTS_HMAC_SHA1_96( 17 ),
 
     /**
      * The aes256-cts-hmac-sha1-96 encryption type.
      */
-    public static final EncryptionType AES256_CTS_HMAC_SHA1_96 = new EncryptionType( 18, "aes256-cts-hmac-sha1-96" );
+    AES256_CTS_HMAC_SHA1_96( 18 ),
 
     /**
      * The rc4-hmac encryption type.
      */
-    public static final EncryptionType RC4_HMAC = new EncryptionType( 23, "rc4-hmac" );
+    RC4_HMAC( 23 ),
 
     /**
      * The rc4-hmac-exp encryption type.
      */
-    public static final EncryptionType RC4_HMAC_EXP = new EncryptionType( 24, "rc4-hmac-exp" );
+    RC4_HMAC_EXP( 24 ),
 
     /**
      * The subkey-keymaterial encryption type.
      */
-    public static final EncryptionType SUBKEY_KEYMATERIAL = new EncryptionType( 65, "subkey-keymaterial" );
+    SUBKEY_KEYMATERIAL( 65 ),
 
     /**
      * The rc4-md4 encryption type.
      */
-    public static final EncryptionType RC4_MD4 = new EncryptionType( -128, "rc4-md4" );
+    RC4_MD4( -128 ),
 
     /**
      * The c4-hmac-old encryption type.
      */
-    public static final EncryptionType RC4_HMAC_OLD = new EncryptionType( -133, "rc4-hmac-old" );
+    RC4_HMAC_OLD( -133 ),
 
     /**
      * The rc4-hmac-old-exp encryption type.
      */
-    public static final EncryptionType RC4_HMAC_OLD_EXP = new EncryptionType( -135, "rc4-hmac-old-exp" );
-
-    /**
-     * Array for building a List of VALUES.
-     */
-    private static final EncryptionType[] values =
-        { UNKNOWN, NULL, DES_CBC_CRC, DES_CBC_MD4, DES_CBC_MD5, RESERVED4, DES3_CBC_MD5, RESERVED6, DES3_CBC_SHA1,
-            ID_DSA_WITH_SHA1_CMSOID, MD5WITHRSAENCRYPTION_CMSOID, SHA_1WITHRSAENCRYPTION_CMSOID, RC2_CBC_ENVOID,
-            RSAENCRYPTION_ENVOID, ID_RSAES_OAEP_ENVOID, DES_EDE3_CBC_ENVOID, DES3_CBC_SHA1_KD, AES128_CTS_HMAC_SHA1_96,
-            AES256_CTS_HMAC_SHA1_96, RC4_HMAC, RC4_HMAC_EXP, SUBKEY_KEYMATERIAL, RC4_MD4, RC4_HMAC_OLD,
-            RC4_HMAC_OLD_EXP };
-
-    /**
-     * A List of all the encryption type constants.
-     */
-    public static final List<EncryptionType> VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
-
-    /**
-     * The name of the encryption type.
-     */
-    private final String name;
+    RC4_HMAC_OLD_EXP( -135 );
 
     /**
      * The value/code for the encryption type.
      */
     private final int ordinal;
 
+    /** A map containing all the values */
+    private static Map<String, EncryptionType> encryptionTypes = new HashMap<String, EncryptionType>();
+    
+    /** Initialization of the previous map */
+    static
+    {
+        encryptionTypes.put( "null", NULL );
+        encryptionTypes.put( "des-cbc-crc", DES_CBC_CRC ); 
+        encryptionTypes.put( "des-cbc-md4", DES_CBC_MD4 );          
+        encryptionTypes.put( "des-cbc-md5", DES_CBC_MD5 );          
+        encryptionTypes.put( "[reserved]", RESERVED4 );         
+        encryptionTypes.put( "des3-cbc-md5", DES3_CBC_MD5 );            
+        encryptionTypes.put( "[reserved]", RESERVED6 );         
+        encryptionTypes.put( "des3-cbc-sha1", DES3_CBC_SHA1 );          
+        encryptionTypes.put( "dsaWithSHA1-CmsOID", DSAWITHSHA1_CMSOID );            
+        encryptionTypes.put( "md5WithRSAEncryption-CmsOID", MD5WITHRSAENCRYPTION_CMSOID );          
+        encryptionTypes.put( "sha1WithRSAEncryption-CmsOID", SHA1WITHRSAENCRYPTION_CMSOID );            
+        encryptionTypes.put( "rc2CBC-EnvOID", RC2CBC_ENVOID );          
+        encryptionTypes.put( "rsaEncryption-EnvOID", RSAENCRYPTION_ENVOID );            
+        encryptionTypes.put( "rsaES-OAEP-ENV-OID", RSAES_OAEP_ENV_OID );        
+        encryptionTypes.put( "des-ede3-cbc-Env-OID", DES_EDE3_CBC_ENV_OID );            
+        encryptionTypes.put( "des3-cbc-sha1-kd", DES3_CBC_SHA1_KD );        
+        encryptionTypes.put( "aes128-cts-hmac-sha1-96", AES128_CTS_HMAC_SHA1_96 );          
+        encryptionTypes.put( "aes256-cts-hmac-sha1-96", AES256_CTS_HMAC_SHA1_96 );          
+        encryptionTypes.put( "rc4-hmac", RC4_HMAC );            
+        encryptionTypes.put( "rc4-hmac-exp", RC4_HMAC_EXP );            
+        encryptionTypes.put( "subkey-keymaterial", SUBKEY_KEYMATERIAL );            
+        encryptionTypes.put( "rc4-md4", RC4_MD4 );      
+        encryptionTypes.put( "rc4-hmac-old", RC4_HMAC_OLD );            
+        encryptionTypes.put( "rc4-hmac-old-exp", RC4_HMAC_OLD_EXP );            
+        encryptionTypes.put( "UNKNOWN", UNKNOWN );
+    }
 
     /**
      * Private constructor prevents construction outside of this class.
      */
-    private EncryptionType( int ordinal, String name )
+    private EncryptionType( int ordinal )
     {
         this.ordinal = ordinal;
-        this.name = name;
     }
 
+    
+    /**
+     * Get all the encryption types
+     *
+     * @return A set of encryption types.
+     */
+    public static Collection<EncryptionType> getEncryptionTypes()
+    {
+        return encryptionTypes.values();
+    }
 
     /**
      * Returns the encryption type when specified by its ordinal.
@@ -204,15 +222,34 @@
      */
     public static EncryptionType getTypeByOrdinal( int type )
     {
-        for ( int ii = 0; ii < values.length; ii++ )
+        switch ( type )
         {
-            if ( values[ii].ordinal == type )
-            {
-                return values[ii];
-            }
+            case 0 : return NULL; 
+            case 1 : return DES_CBC_CRC; 
+            case 2 : return DES_CBC_MD4; 
+            case 3 : return DES_CBC_MD5; 
+            case 4 : return RESERVED4; 
+            case 5 : return DES3_CBC_MD5; 
+            case 6 : return RESERVED6; 
+            case 7 : return DES3_CBC_SHA1; 
+            case 9 : return DSAWITHSHA1_CMSOID; 
+            case 10 : return MD5WITHRSAENCRYPTION_CMSOID; 
+            case 11 : return SHA1WITHRSAENCRYPTION_CMSOID; 
+            case 12 : return RC2CBC_ENVOID; 
+            case 13 : return RSAENCRYPTION_ENVOID; 
+            case 14 : return RSAES_OAEP_ENV_OID; 
+            case 15 : return DES_EDE3_CBC_ENV_OID; 
+            case 16 : return DES3_CBC_SHA1_KD; 
+            case 17 : return AES128_CTS_HMAC_SHA1_96; 
+            case 18 : return AES256_CTS_HMAC_SHA1_96; 
+            case 23 : return RC4_HMAC; 
+            case 24 : return RC4_HMAC_EXP; 
+            case 65 : return SUBKEY_KEYMATERIAL; 
+            case -128 : return RC4_MD4; 
+            case -133 : return RC4_HMAC_OLD; 
+            case -135 : return RC4_HMAC_OLD_EXP; 
+            default : return UNKNOWN; 
         }
-
-        return UNKNOWN;
     }
 
 
@@ -234,18 +271,67 @@
      */
     public String getName()
     {
-        return name;
+        switch (this )
+        {
+            case NULL                           : return "NULL"; 
+            case DES_CBC_CRC                    : return "des-cbc-crc"; 
+            case DES_CBC_MD4                    : return "des-cbc-md4";          
+            case DES_CBC_MD5                    : return "des-cbc-md5";          
+            case RESERVED4                      : return "[reserved]";           
+            case DES3_CBC_MD5                   : return "des3-cbc-md5";         
+            case RESERVED6                      : return "[reserved]";           
+            case DES3_CBC_SHA1                  : return "des3-cbc-sha1";            
+            case DSAWITHSHA1_CMSOID             : return "dsaWithSHA1-CmsOID";           
+            case MD5WITHRSAENCRYPTION_CMSOID    : return "md5WithRSAEncryption-CmsOID";          
+            case SHA1WITHRSAENCRYPTION_CMSOID   : return "sha1WithRSAEncryption-CmsOID";         
+            case RC2CBC_ENVOID                  : return "rc2CBC-EnvOID";            
+            case RSAENCRYPTION_ENVOID           : return "rsaEncryption-EnvOID";         
+            case RSAES_OAEP_ENV_OID             : return "rsaES-OAEP-ENV-OID";       
+            case DES_EDE3_CBC_ENV_OID           : return "des-ede3-cbc-Env-OID";         
+            case DES3_CBC_SHA1_KD               : return "des3-cbc-sha1-kd";     
+            case AES128_CTS_HMAC_SHA1_96        : return "aes128-cts-hmac-sha1-96";          
+            case AES256_CTS_HMAC_SHA1_96        : return "aes256-cts-hmac-sha1-96";          
+            case RC4_HMAC                       : return "rc4-hmac";         
+            case RC4_HMAC_EXP                   : return "rc4-hmac-exp";         
+            case SUBKEY_KEYMATERIAL             : return "subkey-keymaterial";           
+            case RC4_MD4                        : return "rc4-md4";      
+            case RC4_HMAC_OLD                   : return "rc4-hmac-old";         
+            case RC4_HMAC_OLD_EXP               : return "rc4-hmac-old-exp";         
+            case UNKNOWN                        : return "UNKNOWN";
+            default                             : return "UNKNOWN";
+        }
     }
 
-
-    public int compareTo( EncryptionType that )
+    /**
+     * Get the EncryptionType given a String.
+     * @param type The encryption string we want to find
+     * @return The found EncryptionType, or UNKNOWN
+     */
+    public static EncryptionType getByName( String type )
     {
-        return ordinal - that.ordinal;
+        if ( type == null )
+        {
+            return UNKNOWN;
+        }
+        
+        String lcType = type.toLowerCase();
+        
+        if ( encryptionTypes.containsKey( lcType ) )
+        {
+            return encryptionTypes.get( lcType );
+        }
+        else
+        {
+            return UNKNOWN;
+        }
     }
-
-
+    
+    
+    /**
+     * @see Object#toString()
+     */
     public String toString()
     {
-        return name + " (" + ordinal + ")";
+        return getName() + " (" + ordinal + ")";
     }
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NullEncryption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NullEncryption.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NullEncryption.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NullEncryption.java Tue Oct 23 15:47:43 2007
@@ -51,7 +51,7 @@
 
     public byte[] getDecryptedData( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException
     {
-        return data.getCipherText();
+        return data.getCipher();
     }
 
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java Tue Oct 23 15:47:43 2007
@@ -25,7 +25,6 @@
 
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptedDataModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -71,9 +70,9 @@
      */
     public static EncryptedData decode( DERSequence sequence )
     {
-        EncryptedDataModifier modifier = new EncryptedDataModifier();
+        EncryptedData encryptedData = new EncryptedData();
 
-        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        for ( Enumeration<DEREncodable> e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERTaggedObject object = ( DERTaggedObject ) e.nextElement();
             int tag = object.getTagNo();
@@ -83,19 +82,21 @@
             {
                 case 0:
                     DERInteger etype = ( DERInteger ) derObject;
-                    modifier.setEncryptionType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
+                    encryptedData.setEType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
                     break;
+                    
                 case 1:
                     DERInteger kvno = ( DERInteger ) derObject;
-                    modifier.setKeyVersion( kvno.intValue() );
+                    encryptedData.setKvno( kvno.intValue() );
                     break;
+                    
                 case 2:
                     DEROctetString cipher = ( DEROctetString ) derObject;
-                    modifier.setCipherText( cipher.getOctets() );
+                    encryptedData.setCipher( cipher.getOctets() );
                     break;
             }
         }
 
-        return modifier.getEncryptedData();
+        return encryptedData;
     }
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java Tue Oct 23 15:47:43 2007
@@ -72,14 +72,14 @@
     {
         DERSequence sequence = new DERSequence();
 
-        sequence.add( new DERTaggedObject( 0, DERInteger.valueOf( encryptedData.getEncryptionType().getOrdinal() ) ) );
+        sequence.add( new DERTaggedObject( 0, DERInteger.valueOf( encryptedData.getEType().getOrdinal() ) ) );
 
-        if ( encryptedData.getKeyVersion() > 0 )
+        if ( encryptedData.hasKvno() )
         {
-            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( encryptedData.getKeyVersion() ) ) );
+            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( encryptedData.getKvno() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 2, new DEROctetString( encryptedData.getCipherText() ) ) );
+        sequence.add( new DERTaggedObject( 2, new DEROctetString( encryptedData.getCipher() ) ) );
 
         return sequence;
     }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java Tue Oct 23 15:47:43 2007
@@ -20,32 +20,98 @@
 package org.apache.directory.server.kerberos.shared.messages.value;
 
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
+ * A structure storing an encrypted data element. The ASN.1 grammar is :
+ * 
+ * EncryptedData   ::= SEQUENCE {
+ *        etype   [0] Int32 -- EncryptionType --,
+ *        kvno    [1] UInt32 OPTIONAL,
+ *        cipher  [2] OCTET STRING -- ciphertext
+ * }
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class EncryptedData
+public class EncryptedData extends AbstractAsn1Object
 {
-    private EncryptionType encryptionType;
-    private int keyVersion; //optional
-    private byte[] cipherText;
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( EncryptedData.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    /** The used encryption algorithm */
+    private EncryptionType eType;
+
+    /** Version number of the key under which data is encrypted */
+    private int kvno;
+
+    /** A flag used to tell if a kvno has been added, as the kvno is optional. */
+    private boolean hasKvno;
+
+    /** The field containing the enciphered text */
+    private byte[] cipher;
+
+    /** A constant used when the key is not present */
+    public static final boolean HAS_KVNO = true;
+
+    // Storage for computed lengths
+    private transient int eTypeTagLength;
+    private transient int kvnoTagLength;
+    private transient int cipherTagLength;
+    private transient int encryptedDataSeqLength;
+
+
+    /**
+     * Creates a new instance of EncryptedData.
+     */
+    public EncryptedData()
+    {
+        hasKvno = !HAS_KVNO;
+    }
+    
+    /**
+     * Creates a new instance of EncryptedData.
+     *
+     * @param etype The encription algorithm
+     * @param kvno The key version
+     * @param cipher the encrypted text
+     */
+    public EncryptedData( EncryptionType eType, int kvno, byte[] cipher )
+    {
+        this.eType = eType;
+        this.hasKvno = kvno > 0;
+        this.kvno = kvno;
+        this.cipher = cipher;
+    }
 
 
     /**
      * Creates a new instance of EncryptedData.
      *
-     * @param type
-     * @param version
-     * @param cipherText
-     */
-    public EncryptedData( EncryptionType type, int version, byte[] cipherText )
-    {
-        encryptionType = type;
-        keyVersion = version;
-        this.cipherText = cipherText;
+     * @param etype The encription algorithm
+     * @param cipher the encrypted text
+     */
+    public EncryptedData( EncryptionType eType, byte[] cipher )
+    {
+        this.eType = eType;
+        this.hasKvno = !HAS_KVNO;
+        kvno = -1;
+        this.cipher = cipher;
     }
 
 
@@ -54,20 +120,48 @@
      *
      * @return The {@link EncryptionType}.
      */
-    public EncryptionType getEncryptionType()
+    public EncryptionType getEType()
     {
-        return encryptionType;
+        return eType;
     }
 
 
     /**
+     * Set the EncryptionType
+     * @param eType the EncryptionType
+     */
+    public void setEType( EncryptionType eType )
+    {
+        this.eType = eType;
+    }
+
+    /**
      * Returns the key version.
      *
      * @return The key version.
      */
-    public int getKeyVersion()
+    public int getKvno()
+    {
+        return hasKvno ? kvno : -1;
+    }
+
+    /**
+     * Set the key version
+     * @param kvno The key version
+     */
+    public void setKvno( int kvno )
+    {
+        this.kvno = kvno;
+    }
+
+    /**
+     * Tells if there is a key version.
+     *
+     * @return <code>true</code> if there is a key version.
+     */
+    public boolean hasKvno()
     {
-        return keyVersion;
+        return hasKvno;
     }
 
 
@@ -76,8 +170,164 @@
      *
      * @return The raw cipher text.
      */
-    public byte[] getCipherText()
+    public byte[] getCipher()
     {
-        return cipherText;
+        return cipher;
+    }
+
+    /**
+     * Set the cipher text
+     * @param cipher The cipher text
+     */
+    public void setCipher( byte[] cipher )
+    {
+        this.cipher = cipher;
+    }
+    
+
+    /**
+     * Compute the EncryptedData length
+     * 
+     * EncryptedData :
+     * 
+     * 0x30 L1 EncryptedData sequence
+     *  |
+     *  +--> 0xA1 L2 etype tag
+     *  |     |
+     *  |     +--> 0x02 L2-1 etype (int)
+     *  |
+     *  +--> [0xA2 L3 kvno tag
+     *  |     |
+     *  |     +--> 0x30 L3-1 kvno (int)] (optional)
+     *  |
+     *  +--> 0xA2 L4 cipher tag
+     *        |
+     *        +--> 0x04 L4-1 cipher (OCTET STRING)
+     */
+    public int computeLength()
+    {
+        encryptedDataSeqLength = 0;
+
+        // Compute the encryption Type length
+        int eTypeLength = Value.getNbBytes( eType.getOrdinal() );
+        eTypeTagLength = 1 + TLV.getNbBytes( eTypeLength ) + eTypeLength;
+        encryptedDataSeqLength = 1 + TLV.getNbBytes( eTypeTagLength ) + eTypeTagLength; 
+
+
+        // Compute the kvno length if any
+        if ( hasKvno )
+        {
+            int kvnoLength = Value.getNbBytes( kvno );
+            kvnoTagLength = 1 + TLV.getNbBytes( kvnoLength ) + kvnoLength;
+            encryptedDataSeqLength += 1 + TLV.getNbBytes( kvnoTagLength ) + kvnoTagLength;
+        }
+        else
+        {
+            kvnoTagLength = 0;
+        }
+
+        // Compute the cipher
+        if ( ( cipher == null ) || ( cipher.length == 0 ) )
+        {
+            cipherTagLength = 1 + 1;
+        }
+        else
+        {
+            cipherTagLength = 1 + TLV.getNbBytes( cipher.length ) + cipher.length;
+        }
+
+        encryptedDataSeqLength += 1 + TLV.getNbBytes( cipherTagLength ) + cipherTagLength;
+
+        // Compute the whole sequence length
+        return 1 + TLV.getNbBytes( encryptedDataSeqLength ) + encryptedDataSeqLength;
+    }
+
+
+    /**
+     * Encode the EncryptedData message to a PDU. 
+     * 
+     * EncryptedData :
+     * 
+     * 0x30 LL
+     *   0xA0 LL 
+     *     0x02 0x01 etype (integer)
+     *   [0xA1 LL 
+     *     0x02 0x01 kvno (integer)] (optional)
+     *   0xA2 LL 
+     *     0x04 LL cipher (OCTET STRING)
+     * 
+     * @param buffer The buffer where to put the PDU. It should have been allocated
+     * before, with the right size.
+     * @return The constructed PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        if ( buffer == null )
+        {
+            throw new EncoderException( "Cannot put a PDU in a null buffer !" );
+        }
+
+        try
+        {
+            // The EncryptedData SEQ Tag
+            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( TLV.getBytes( encryptedDataSeqLength ) );
+
+            // The etype, first the tag, then the value
+            buffer.put( ( byte ) 0xA0 );
+            buffer.put( TLV.getBytes( eTypeTagLength ) );
+
+            Value.encode( buffer, eType.getOrdinal() );
+
+            // The kvno, if any, first the tag, then the value
+            if ( hasKvno )
+            {
+                buffer.put( ( byte ) 0xA1 );
+                buffer.put( TLV.getBytes( kvnoTagLength ) );
+
+                Value.encode( buffer, kvno );
+            }
+
+            // The cipher tag
+            buffer.put( ( byte ) 0xA2 );
+            buffer.put( TLV.getBytes( cipherTagLength ) );
+            Value.encode( buffer, cipher );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            log.error(
+                "Cannot encode the EncryptedData object, the PDU size is {} when only {} bytes has been allocated", 1
+                    + TLV.getNbBytes( encryptedDataSeqLength ) + encryptedDataSeqLength, buffer.capacity() );
+            throw new EncoderException( "The PDU buffer size is too small !" );
+        }
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "EncryptedData encoding : {}", StringTools.dumpBytes( buffer.array() ) );
+            log.debug( "EncryptedData initial value : {}", toString() );
+        }
+
+        return buffer;
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "EncryptedData : {\n" );
+        sb.append( "    etype: " ).append( eType ).append( '\n' );
+
+        if ( hasKvno )
+        {
+            sb.append( "    kvno: " ).append( kvno ).append( '\n' );
+        }
+
+        sb.append( "    cipher: " ).append( StringTools.dumpBytes( cipher ) ).append( "\n}\n" );
+
+        return sb.toString();
     }
 }

Added: directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataTest.java?rev=587682&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataTest.java (added)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedDataTest.java Tue Oct 23 15:47:43 2007
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value;
+
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test the EncryptedData encoding and decoding
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 542147 $, $Date: 2007-05-28 10:14:21 +0200 (Mon, 28 May 2007) $
+ */
+public class EncryptedDataTest extends TestCase
+{
+    public void testEncodingEncryptedData() throws Exception
+    {
+        EncryptedData ed = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, 1, new byte[]
+            { 0x01, 0x02, 0x03, 0x04 } );
+
+        ByteBuffer encoded = ByteBuffer.allocate( ed.computeLength() );
+
+        ed.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+                0x30, 0x12, 
+                  ( byte ) 0xA0, 0x03, 
+                    0x02, 0x01, 0x11, 
+                  ( byte ) 0xA1, 0x03, 
+                    0x02, 0x01, 0x01, 
+                  ( byte ) 0xA2, 0x06, 
+                    0x04, 0x04, 0x01, 0x02, 0x03, 0x04 
+            };
+
+        assertEquals( StringTools.dumpBytes( expectedResult ), StringTools.dumpBytes( encoded.array() ) );
+    }
+
+
+    public void testEncodingEncryptedDataNullCipher() throws Exception
+    {
+        EncryptedData ed = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, 1, null );
+
+        ByteBuffer encoded = ByteBuffer.allocate( ed.computeLength() );
+
+        ed.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+              0x30, 0x0E, 
+                ( byte ) 0xA0, 0x03, 
+                  0x02, 0x01, 0x11, 
+                ( byte ) 0xA1, 0x03, 
+                  0x02, 0x01, 0x01, 
+                ( byte ) 0xA2, 0x02, 
+                  0x04, 0x00 
+            };
+
+        assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
+    }
+
+
+    public void testEncodingEncryptedDataNoKvno() throws Exception
+    {
+        EncryptedData ed = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, new byte[]
+            { 0x01, 0x02, 0x03, 0x04 } );
+
+        ByteBuffer encoded = ByteBuffer.allocate( ed.computeLength() );
+
+        ed.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+              0x30, 0x0D, 
+                ( byte ) 0xA0, 0x03, 
+                  0x02, 0x01, 0x11, 
+                ( byte ) 0xA2, 0x06, 
+                  0x04, 0x04, 0x01, 0x02, 0x03, 0x04 
+            };
+
+        assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
+    }
+
+
+    public void testEncodingEncryptedDataNoKvnoNullCipher() throws Exception
+    {
+        EncryptedData ed = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, null );
+
+        ByteBuffer encoded = ByteBuffer.allocate( ed.computeLength() );
+
+        ed.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+              0x30, 0x09, 
+                ( byte ) 0xA0, 0x03, 
+                  0x02, 0x01, 0x11, 
+                ( byte ) 0xA2, 0x02, 
+                  0x04, 0x00 
+            };
+
+        assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
+    }
+}

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java Tue Oct 23 15:47:43 2007
@@ -46,7 +46,6 @@
  */
 public class ChangePasswordServer extends DirectoryBackedService
 {
-    @SuppressWarnings ( { "UnusedDeclaration" } )
     private static final long serialVersionUID = 3509208713288140629L;
 
     /** The default change password principal name. */
@@ -308,7 +307,7 @@
 
         for ( String enc : encryptionTypeStrings )
         {
-            for ( EncryptionType type : EncryptionType.VALUES )
+            for ( EncryptionType type : EncryptionType.getEncryptionTypes() )
             {
                 if ( type.toString().equalsIgnoreCase( enc ) )
                 {

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java Tue Oct 23 15:47:43 2007
@@ -102,7 +102,7 @@
                 sb.append( "\n\t" + "Service principal      " + ticketPrincipal.getPrincipal() );
                 sb.append( "\n\t" + "SAM type               " + ticketPrincipal.getSamType() );
 
-                EncryptionType encryptionType = ticket.getEncPart().getEncryptionType();
+                EncryptionType encryptionType = ticket.getEncPart().getEType();
                 int keyVersion = ticketPrincipal.getKeyMap().get( encryptionType ).getKeyVersion();
                 sb.append( "\n\t" + "Ticket key type        " + encryptionType );
                 sb.append( "\n\t" + "Service key version    " + keyVersion );

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java Tue Oct 23 15:47:43 2007
@@ -54,7 +54,7 @@
         ApplicationRequest authHeader = changepwContext.getAuthHeader();
         Ticket ticket = changepwContext.getTicket();
 
-        EncryptionType encryptionType = ticket.getEncPart().getEncryptionType();
+        EncryptionType encryptionType = ticket.getEncPart().getEType();
         EncryptionKey serverKey = changepwContext.getServerEntry().getKeyMap().get( encryptionType );
 
         long clockSkew = changepwContext.getConfig().getAllowableClockSkew();

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java Tue Oct 23 15:47:43 2007
@@ -46,7 +46,6 @@
  */
 public class KdcServer extends DirectoryBackedService
 {
-    @SuppressWarnings ( { "UnusedDeclaration" } )
     private static final long serialVersionUID = 522567370475574165L;
 
     /** The default kdc port */
@@ -448,7 +447,7 @@
 
         for ( String enc : encryptionTypeStrings )
         {
-            for ( EncryptionType type : EncryptionType.VALUES )
+            for ( EncryptionType type : EncryptionType.getEncryptionTypes() )
             {
                 if ( type.getName().equalsIgnoreCase( enc ) )
                 {

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/MonitorContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/MonitorContext.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/MonitorContext.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/MonitorContext.java Tue Oct 23 15:47:43 2007
@@ -109,7 +109,7 @@
                 sb.append( "\n\t" + "principal              " + ticketPrincipal.getPrincipal() );
                 sb.append( "\n\t" + "SAM type               " + ticketPrincipal.getSamType() );
 
-                EncryptionType encryptionType = tgsContext.getTgt().getEncPart().getEncryptionType();
+                EncryptionType encryptionType = tgsContext.getTgt().getEncPart().getEType();
                 int keyVersion = ticketPrincipal.getKeyMap().get( encryptionType ).getKeyVersion();
                 sb.append( "\n\t" + "Ticket key type        " + encryptionType );
                 sb.append( "\n\t" + "Service key version    " + keyVersion );

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/VerifyTgtAuthHeader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/VerifyTgtAuthHeader.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/VerifyTgtAuthHeader.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/VerifyTgtAuthHeader.java Tue Oct 23 15:47:43 2007
@@ -50,7 +50,7 @@
         
         boolean isValidate = tgsContext.getRequest().getKdcOptions().get( KdcOptions.VALIDATE );
 
-        EncryptionType encryptionType = tgt.getEncPart().getEncryptionType();
+        EncryptionType encryptionType = tgt.getEncPart().getEType();
         EncryptionKey serverKey = tgsContext.getTicketPrincipalEntry().getKeyMap().get( encryptionType );
 
         long clockSkew = tgsContext.getConfig().getAllowableClockSkew();

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java Tue Oct 23 15:47:43 2007
@@ -108,7 +108,7 @@
 
         AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
     }
 
 
@@ -159,7 +159,7 @@
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
         assertTrue( "PRE_AUTHENT flag", reply.getTicket().getFlags().get( TicketFlags.PRE_AUTHENT ) );
-        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
     }
 
 
@@ -211,7 +211,7 @@
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
         assertTrue( "PRE_AUTHENT flag", reply.getTicket().getFlags().get( TicketFlags.PRE_AUTHENT ) );
-        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
 
         assertEquals( "Nonce", nonce, reply.getNonce() );
     }

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java?rev=587682&r1=587681&r2=587682&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java Tue Oct 23 15:47:43 2007
@@ -119,7 +119,7 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
     }
 
 
@@ -170,9 +170,9 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
-                .getEncryptionType() );
+                .getEType() );
     }
 
 
@@ -234,9 +234,9 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
-                .getEncryptionType() );
+                .getEType() );
     }
 
 
@@ -298,9 +298,9 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
-                .getEncryptionType() );
+                .getEType() );
 
         assertEquals( "Nonce", nonce, reply.getNonce() );
     }
@@ -363,9 +363,9 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
-                .getEncryptionType() );
+                .getEType() );
     }
 
 
@@ -429,8 +429,8 @@
 
         TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
 
-        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
+        assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
-                .getEncryptionType() );
+                .getEType() );
     }
 }



Mime
View raw message