directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1043588 - /directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java
Date Wed, 08 Dec 2010 18:46:02 GMT
Author: kayyagari
Date: Wed Dec  8 18:46:02 2010
New Revision: 1043588

URL: http://svn.apache.org/viewvc?rev=1043588&view=rev
Log:
o added a method to decode EncAsRepPart

Modified:
    directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java

Modified: directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java?rev=1043588&r1=1043587&r2=1043588&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java
(original)
+++ directory/apacheds/branches/apacheds-kerberos-codec-2.0/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosDecoder.java
Wed Dec  8 18:46:02 2010
@@ -34,6 +34,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.kerberos.codec.authenticator.AuthenticatorContainer;
 import org.apache.directory.shared.kerberos.codec.authorizationData.AuthorizationDataContainer;
 import org.apache.directory.shared.kerberos.codec.encApRepPart.EncApRepPartContainer;
+import org.apache.directory.shared.kerberos.codec.encAsRepPart.EncAsRepPartContainer;
 import org.apache.directory.shared.kerberos.codec.encKrbPrivPart.EncKrbPrivPartContainer;
 import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
 import org.apache.directory.shared.kerberos.codec.encryptedData.EncryptedDataContainer;
@@ -56,6 +57,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.kerberos.messages.ApReq;
 import org.apache.directory.shared.kerberos.messages.Authenticator;
 import org.apache.directory.shared.kerberos.messages.EncApRepPart;
+import org.apache.directory.shared.kerberos.messages.EncAsRepPart;
 import org.apache.directory.shared.kerberos.messages.KrbPriv;
 import org.apache.directory.shared.kerberos.messages.Ticket;
 import org.apache.directory.shared.ldap.codec.LdapDecoder;
@@ -260,6 +262,7 @@ public class KerberosDecoder extends Pro
         }
         catch ( DecoderException de )
         {
+            de.printStackTrace();
             throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
         }
 
@@ -618,4 +621,40 @@ public class KerberosDecoder extends Pro
 
         return krbPriv;
     }
+    
+    
+    /**
+     * Decode an EncAsRepPart structure
+     * 
+     * @param data The byte array containing the data structure to decode
+     * @return An instance of EncAsRepPart
+     * @throws KerberosException If the decoding fails
+     */
+    public static EncAsRepPart decodeEncAsRepPart( byte[] data ) throws KerberosException
+    {
+        ByteBuffer stream = ByteBuffer.allocate( data.length );
+        stream.put( data );
+        stream.flip();
+        
+        // Allocate a EncAsRepPart Container
+        Asn1Container encAsRepPartContainer = new EncAsRepPartContainer( stream );
+
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        // Decode the EncAsRepPart PDU
+        try
+        {
+            kerberosDecoder.decode( stream, encAsRepPartContainer );
+        }
+        catch ( DecoderException de )
+        {
+            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
+        }
+
+        // get the decoded EncAsRepPart
+        EncAsRepPart encAsRepPart = ( ( EncAsRepPartContainer ) encAsRepPartContainer ).getEncAsRepPart();
+
+        return encAsRepPart;
+    }
+
 }



Mime
View raw message