Author: erodriguez
Date: Thu Feb  3 09:54:51 2005
New Revision: 151194

URL: http://svn.apache.org/viewcvs?view=rev&rev=151194
Log:
Added static decode method to pre-authentication data decoder.

Modified:
    
incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java

Modified: 
incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java
URL: 
http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java?view=diff&r1=151193&r2=151194
==============================================================================
--- 
incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java
 (original)
+++ 
incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java
 Thu Feb  3 09:54:51 2005
@@ -17,8 +17,10 @@
 
 package org.apache.kerberos.io.decoder;
 
+import java.io.IOException;
 import java.util.Enumeration;
 
+import org.apache.asn1.der.ASN1InputStream;
 import org.apache.asn1.der.DEREncodable;
 import org.apache.asn1.der.DERInteger;
 import org.apache.asn1.der.DEROctetString;
@@ -31,6 +33,15 @@
 
 public class PreAuthenticationDataDecoder
 {
+       public PreAuthenticationData decode( byte[] encodedPreAuthData ) throws 
IOException
+       {
+               ASN1InputStream ais = new ASN1InputStream( encodedPreAuthData );
+
+               DERSequence sequence = (DERSequence) ais.readObject();
+               
+               return decode( sequence );
+       }
+       
     /**
      * KDC-REQ ::=        SEQUENCE {
         *            pvno[1]               INTEGER,
@@ -39,11 +50,11 @@
         *            req-body[4]           KDC-REQ-BODY
         * }
         */
-       public static PreAuthenticationData[] decodeSequence( DERSequence 
sequence )
+       protected static PreAuthenticationData[] decodeSequence( DERSequence 
sequence )
        {
                PreAuthenticationData[] paDataSequence = new 
PreAuthenticationData[ sequence.size() ];
+               
                int ii = 0;
-
                for ( Enumeration e = sequence.getObjects(); 
e.hasMoreElements(); )
                {
                        DERSequence object = (DERSequence) e.nextElement();
@@ -62,7 +73,7 @@
         *                          -- might be encoded AP-REQ
         * }
         */
-       public static PreAuthenticationData decode( DERSequence sequence )
+       protected static PreAuthenticationData decode( DERSequence sequence )
        {
                PreAuthenticationDataModifier modifier = new 
PreAuthenticationDataModifier();
                


Reply via email to