directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1034549 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos: KerberosConstants.java codec/types/PaDataType.java components/PaData.java
Date Fri, 12 Nov 2010 20:00:43 GMT
Author: kayyagari
Date: Fri Nov 12 20:00:42 2010
New Revision: 1034549

URL: http://svn.apache.org/viewvc?rev=1034549&view=rev
Log:
o renamed 'ordinal' to 'value'
o added PaData tags

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosConstants.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/types/PaDataType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PaData.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosConstants.java?rev=1034549&r1=1034548&r2=1034549&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosConstants.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosConstants.java
Fri Nov 12 20:00:42 2010
@@ -57,6 +57,10 @@ public class KerberosConstants
     public static final int CHECKSUM_TYPE_TAG = 0xA0;
     public static final int CHECKSUM_CHECKSUM_TAG = 0xA1;
 
+    /** PaData tags */
+    public static final int PADATA_TYPE_TAG = 0xA1;
+    public static final int PADATA_VALUE_TAG = 0xA2;
+
     /** KRB-REQ-BODY's tags */
     public static final int KDC_REQ_BODY_KDC_OPTIONS_TAG = 0xA0;
     public static final int KDC_REQ_BODY_CNAME_TAG = 0xA1;

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/types/PaDataType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/types/PaDataType.java?rev=1034549&r1=1034548&r2=1034549&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/types/PaDataType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/types/PaDataType.java
Fri Nov 12 20:00:42 2010
@@ -119,35 +119,35 @@ public enum PaDataType
     /**
      * The value/code for the pre-authentication type.
      */
-    private final int ordinal;
+    private final int value;
 
 
     /**
      * Private constructor prevents construction outside of this class.
      */
-    private PaDataType( int ordinal )
+    private PaDataType( int value )
     {
-        this.ordinal = ordinal;
+        this.value = value;
     }
 
 
     /**
      * Returns the number associated with this pre-authentication type.
      *
-     * @return The pre-authentication type ordinal.
+     * @return The pre-authentication type value.
      */
-    public int getOrdinal()
+    public int getValue()
     {
-        return ordinal;
+        return value;
     }
     
     /**
      * Returns the pre authentication data type when specified by its ordinal.
      *
-     * @param type The ordinal
+     * @param type The value
      * @return The pre authentication type.
      */
-    public static PaDataType getTypeByOrdinal( int type )
+    public static PaDataType getTypeByValue( int type )
     {
         switch ( type )
         {
@@ -180,58 +180,58 @@ public enum PaDataType
         switch ( this )
         {
             case PA_TGS_REQ                     : 
-                return "TGS request." + "(" + ordinal + ")";
+                return "TGS request." + "(" + value + ")";
             
             case PA_ENC_TIMESTAMP : 
-                return "Encrypted timestamp." + "(" + ordinal + ")";
+                return "Encrypted timestamp." + "(" + value + ")";
             
             case PA_PW_SALT : 
-                return "password salt" + "(" + ordinal + ")";
+                return "password salt" + "(" + value + ")";
             
             case PA_ENC_UNIX_TIME : 
-                return "enc unix time" + "(" + ordinal + ")";
+                return "enc unix time" + "(" + value + ")";
             
             case PA_SANDIA_SECUREID : 
-                return "sandia secureid" + "(" + ordinal + ")";
+                return "sandia secureid" + "(" + value + ")";
             
             case PA_SESAME : 
-                return "sesame" + "(" + ordinal + ")";
+                return "sesame" + "(" + value + ")";
             
             case PA_OSF_DCE : 
-                return "OSF DCE" + "(" + ordinal + ")";
+                return "OSF DCE" + "(" + value + ")";
             
             case PA_CYBERSAFE_SECUREID : 
-                return "cybersafe secureid" + "(" + ordinal + ")";
+                return "cybersafe secureid" + "(" + value + ")";
             
             case PA_ASF3_SALT : 
-                return "ASF3 salt" + "(" + ordinal + ")";
+                return "ASF3 salt" + "(" + value + ")";
             
             case PA_ENCTYPE_INFO : 
-                return "Encryption info." + "(" + ordinal + ")";
+                return "Encryption info." + "(" + value + ")";
             
             case SAM_CHALLENGE : 
-                return "SAM challenge." + "(" + ordinal + ")";
+                return "SAM challenge." + "(" + value + ")";
             
             case SAM_RESPONSE : 
-                return "SAM response." + "(" + ordinal + ")";
+                return "SAM response." + "(" + value + ")";
             
             case PA_PK_AS_REQ : 
-                return "PK as request" + "(" + ordinal + ")";
+                return "PK as request" + "(" + value + ")";
             
             case PA_PK_AS_REP : 
-                return "PK as response" + "(" + ordinal + ")";
+                return "PK as response" + "(" + value + ")";
                 
             case PA_USE_SPECIFIED_KVNO :
-                return "use specified key version" + "(" + ordinal + ")";
+                return "use specified key version" + "(" + value + ")";
             
             case SAM_REDIRECT :
-                return "SAM redirect." + "(" + ordinal + ")";
+                return "SAM redirect." + "(" + value + ")";
             
             case PA_GET_FROM_TYPED_DATA :
-                return "Get from typed data" + "(" + ordinal + ")";
+                return "Get from typed data" + "(" + value + ")";
             
             default : 
-                return "null" + "(" + ordinal + ")";
+                return "null" + "(" + value + ")";
         }
     }
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PaData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PaData.java?rev=1034549&r1=1034548&r2=1034549&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PaData.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PaData.java
Fri Nov 12 20:00:42 2010
@@ -29,6 +29,7 @@ import org.apache.directory.shared.asn1.
 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.kerberos.KerberosConstants;
 import org.apache.directory.shared.kerberos.codec.types.PaDataType;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -105,7 +106,7 @@ public class PaData extends AbstractAsn1
      */
     public void setPaDataType( int paDataType )
     {
-        this.paDataType = PaDataType.getTypeByOrdinal( paDataType );
+        this.paDataType = PaDataType.getTypeByValue( paDataType );
     }
 
     
@@ -166,7 +167,7 @@ public class PaData extends AbstractAsn1
     public int computeLength()
     {
         // Compute the paDataType. The Length will always be contained in 1 byte
-        int paDataTypeLength = Value.getNbBytes( paDataType.getOrdinal() );
+        int paDataTypeLength = Value.getNbBytes( paDataType.getValue() );
         paDataTypeTagLength = 1 + TLV.getNbBytes( paDataTypeLength ) + paDataTypeLength;
         preAuthenticationDataSeqLength = 1 + TLV.getNbBytes( paDataTypeTagLength ) + paDataTypeTagLength;
 
@@ -194,9 +195,9 @@ public class PaData extends AbstractAsn1
      * PreAuthenticationData :
      * 
      * 0x30 LL
-     *   0xA0 LL 
-     *     0x02 0x01 padata-type
      *   0xA1 LL 
+     *     0x02 0x01 padata-type
+     *   0xA2 LL 
      *     0x04 LL padata-value
      * 
      * @param buffer The buffer where to put the PDU. It should have been allocated
@@ -217,12 +218,12 @@ public class PaData extends AbstractAsn1
             buffer.put( TLV.getBytes( preAuthenticationDataSeqLength ) );
 
             // The cksumtype, first the tag, then the value
-            buffer.put( ( byte ) 0xA1 );
+            buffer.put( ( byte ) KerberosConstants.PADATA_TYPE_TAG );
             buffer.put( TLV.getBytes( paDataTypeTagLength ) );
-            Value.encode( buffer, paDataType.getOrdinal() );
+            Value.encode( buffer, paDataType.getValue() );
 
             // The checksum, first the tag, then the value
-            buffer.put( ( byte ) 0xA2 );
+            buffer.put( ( byte ) KerberosConstants.PADATA_VALUE_TAG );
             buffer.put( TLV.getBytes( paDataValueTagLength ) );
             Value.encode( buffer, paDataValue );
         }



Mime
View raw message