directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r233999 - /directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/
Date Sat, 20 Aug 2005 05:00:56 GMT
Author: erodriguez
Date: Fri Aug 19 22:00:47 2005
New Revision: 233999

URL: http://svn.apache.org/viewcvs?rev=233999&view=rev
Log:
Reformatting:  imports, whitespace, line breaks, or code convention.

Modified:
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ChecksumDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedDataDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedTimestampDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionKeyDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionTypeDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/HostAddressDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KerberosTimeDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/LastRequestDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrincipalNameDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/TicketDecoder.java

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -31,19 +30,18 @@
 import org.apache.kerberos.messages.MessageType;
 import org.apache.kerberos.messages.value.ApOptions;
 
-
 public class ApplicationRequestDecoder
 {
-	public ApplicationRequest decode( byte[] encodedAuthHeader ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedAuthHeader );
-
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence apreq = (DERSequence) app.getObject();
-		
-		return decodeApplicationRequestSequence( apreq );
-	}
+    public ApplicationRequest decode( byte[] encodedAuthHeader ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedAuthHeader );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence apreq = (DERSequence) app.getObject();
+
+        return decodeApplicationRequestSequence( apreq );
+    }
 	
 	/*
         AP-REQ ::=      [APPLICATION 14] SEQUENCE {
@@ -55,41 +53,42 @@
         authenticator[4]              EncryptedData
         }
     */
-	private ApplicationRequest decodeApplicationRequestSequence( DERSequence sequence ) throws IOException
-	{
-		ApplicationRequest authHeader = new ApplicationRequest();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag ) {
-				case 0:
-					DERInteger tag0 = (DERInteger) derObject;
-					authHeader.setProtocolVersionNumber( tag0.intValue() );
-					break;
-				case 1:
-					DERInteger tag1 = (DERInteger) derObject;
-					authHeader.setMessageType( MessageType.getTypeByOrdinal( tag1.intValue() ) );
-					break;
-				case 2:
-					DERBitString apOptions = (DERBitString)derObject;
-					authHeader.setApOptions( new ApOptions( apOptions.getOctets() ) );
-					break;
-				case 3:
-					DERApplicationSpecific tag3 = (DERApplicationSpecific)derObject;
-					authHeader.setTicket( TicketDecoder.decode( tag3 ) );
-					break;
-				case 4:
-					DERSequence tag4 = (DERSequence)derObject;
-					authHeader.setEncPart( EncryptedDataDecoder.decode( tag4 ) );
-					break;
-			}
-		}
-		
-		return authHeader;
-	}
-}
+	private ApplicationRequest decodeApplicationRequestSequence( DERSequence sequence )
+            throws IOException
+    {
+        ApplicationRequest authHeader = new ApplicationRequest();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = ( (DERTaggedObject) e.nextElement() );
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    authHeader.setProtocolVersionNumber( tag0.intValue() );
+                    break;
+                case 1:
+                    DERInteger tag1 = (DERInteger) derObject;
+                    authHeader.setMessageType( MessageType.getTypeByOrdinal( tag1.intValue() ) );
+                    break;
+                case 2:
+                    DERBitString apOptions = (DERBitString) derObject;
+                    authHeader.setApOptions( new ApOptions( apOptions.getOctets() ) );
+                    break;
+                case 3:
+                    DERApplicationSpecific tag3 = (DERApplicationSpecific) derObject;
+                    authHeader.setTicket( TicketDecoder.decode( tag3 ) );
+                    break;
+                case 4:
+                    DERSequence tag4 = (DERSequence) derObject;
+                    authHeader.setEncPart( EncryptedDataDecoder.decode( tag4 ) );
+                    break;
+            }
+        }
 
+        return authHeader;
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -31,19 +30,18 @@
 import org.apache.kerberos.messages.components.Authenticator;
 import org.apache.kerberos.messages.components.AuthenticatorModifier;
 
-
 public class AuthenticatorDecoder
 {
-	public Authenticator decode( byte[] encodedAuthenticator ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedAuthenticator );
-		
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence sequence = (DERSequence) app.getObject();
-		
-		return decode( sequence );
-	}
+    public Authenticator decode( byte[] encodedAuthenticator ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedAuthenticator );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence sequence = (DERSequence) app.getObject();
+
+        return decode( sequence );
+    }
 	
 	/**
 	 * -- Unencrypted authenticator
@@ -62,57 +60,56 @@
 	 * }
 	 */
 	protected static Authenticator decode( DERSequence sequence )
-	{
-		AuthenticatorModifier modifier = new AuthenticatorModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger)derObject;
-					modifier.setVersionNumber( tag0.intValue() );
-					break;
-				case 1:
-					DERGeneralString tag1 = (DERGeneralString)derObject;
-					modifier.setClientRealm( tag1.getString() );
-					break;
-				case 2:
-					DERSequence tag2 = (DERSequence)derObject;
-					modifier.setClientName( PrincipalNameDecoder.decode( tag2 ) );
-					break;
-				case 3:
-					DERSequence tag3 = (DERSequence)derObject;
-					modifier.setChecksum( ChecksumDecoder.decode( tag3 ) );
-					break;
-				case 4:
-					DERInteger tag4 = (DERInteger)derObject;
-					modifier.setClientMicroSecond( tag4.intValue() );
-					break;
-				case 5:
-					DERGeneralizedTime tag5 = (DERGeneralizedTime)derObject;
-					modifier.setClientTime( KerberosTimeDecoder.decode( tag5 ) );
-					break;
-				case 6:
-					DERSequence tag6 = (DERSequence) derObject;
-					modifier.setSubSessionKey( EncryptionKeyDecoder.decode( tag6 ) );
-					break;
-				case 7:
-					DERInteger tag7 = (DERInteger)derObject;
-					modifier.setSequenceNumber( tag7.intValue() );
-					break;
-				case 8:
-					DERSequence tag8 = (DERSequence)derObject;
-					modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag8 ) );
-					break;
-			}
-		}
-		
-		return modifier.getAuthenticator();
-	}
-}
+    {
+        AuthenticatorModifier modifier = new AuthenticatorModifier();
 
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    modifier.setVersionNumber( tag0.intValue() );
+                    break;
+                case 1:
+                    DERGeneralString tag1 = (DERGeneralString) derObject;
+                    modifier.setClientRealm( tag1.getString() );
+                    break;
+                case 2:
+                    DERSequence tag2 = (DERSequence) derObject;
+                    modifier.setClientName( PrincipalNameDecoder.decode( tag2 ) );
+                    break;
+                case 3:
+                    DERSequence tag3 = (DERSequence) derObject;
+                    modifier.setChecksum( ChecksumDecoder.decode( tag3 ) );
+                    break;
+                case 4:
+                    DERInteger tag4 = (DERInteger) derObject;
+                    modifier.setClientMicroSecond( tag4.intValue() );
+                    break;
+                case 5:
+                    DERGeneralizedTime tag5 = (DERGeneralizedTime) derObject;
+                    modifier.setClientTime( KerberosTimeDecoder.decode( tag5 ) );
+                    break;
+                case 6:
+                    DERSequence tag6 = (DERSequence) derObject;
+                    modifier.setSubSessionKey( EncryptionKeyDecoder.decode( tag6 ) );
+                    break;
+                case 7:
+                    DERInteger tag7 = (DERInteger) derObject;
+                    modifier.setSequenceNumber( tag7.intValue() );
+                    break;
+                case 8:
+                    DERSequence tag8 = (DERSequence) derObject;
+                    modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag8 ) );
+                    break;
+            }
+        }
+
+        return modifier.getAuthenticator();
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -30,17 +29,16 @@
 import org.apache.kerberos.messages.value.AuthorizationDataEntry;
 import org.apache.kerberos.messages.value.AuthorizationType;
 
-
 public class AuthorizationDataDecoder
 {
-	public AuthorizationData decode( byte[] encodedAuthData ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedAuthData );
-
-		DERSequence sequence = (DERSequence) ais.readObject();
-		
-		return decodeSequence( sequence );
-	}
+    public AuthorizationData decode( byte[] encodedAuthData ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedAuthData );
+
+        DERSequence sequence = (DERSequence) ais.readObject();
+
+        return decodeSequence( sequence );
+    }
 	
 	/**
 	 * AuthorizationData ::=   SEQUENCE OF SEQUENCE {
@@ -49,44 +47,43 @@
      * }
      */
 	protected static AuthorizationData decodeSequence( DERSequence sequence )
-	{
-		AuthorizationData authData = new AuthorizationData();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERSequence object = (DERSequence) e.nextElement();
-			AuthorizationDataEntry entry = decodeAuthorizationEntry( object );
-			authData.add( entry );
-		}
-		
-		return authData;
-	}
-	
-	protected static AuthorizationDataEntry decodeAuthorizationEntry( DERSequence sequence )
-	{
-		AuthorizationType type = AuthorizationType.NULL;
-		byte[] data = null;
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger)derObject;
-					type = AuthorizationType.getTypeByOrdinal( tag0.intValue() );
-					break;
-				case 1:
-					DEROctetString tag1 = (DEROctetString)derObject;
-					data = tag1.getOctets();
-					break;
-			}
-		}
-		
-		return new AuthorizationDataEntry( type, data );
-	}
-}
+    {
+        AuthorizationData authData = new AuthorizationData();
 
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERSequence object = (DERSequence) e.nextElement();
+            AuthorizationDataEntry entry = decodeAuthorizationEntry( object );
+            authData.add( entry );
+        }
+
+        return authData;
+    }
+
+    protected static AuthorizationDataEntry decodeAuthorizationEntry( DERSequence sequence )
+    {
+        AuthorizationType type = AuthorizationType.NULL;
+        byte[] data = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    type = AuthorizationType.getTypeByOrdinal( tag0.intValue() );
+                    break;
+                case 1:
+                    DEROctetString tag1 = (DEROctetString) derObject;
+                    data = tag1.getOctets();
+                    break;
+            }
+        }
+
+        return new AuthorizationDataEntry( type, data );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ChecksumDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ChecksumDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ChecksumDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/ChecksumDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -27,7 +26,6 @@
 import org.apache.kerberos.crypto.checksum.ChecksumType;
 import org.apache.kerberos.messages.value.Checksum;
 
-
 public class ChecksumDecoder
 {
 	/**
@@ -37,30 +35,29 @@
      * }
 	 */
 	public static Checksum decode( DERSequence sequence )
-	{
-		ChecksumType type = ChecksumType.NULL;
-		byte[] data = null;
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger)derObject;
-					type = ChecksumType.getTypeByOrdinal( tag0.intValue() );
-					break;
-				case 1:
-					DEROctetString tag1 = (DEROctetString)derObject;
-					data = tag1.getOctets();
-					break;
-			}
-		}
-		
-		return new Checksum( type, data );
-	}
-}
+    {
+        ChecksumType type = ChecksumType.NULL;
+        byte[] data = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    type = ChecksumType.getTypeByOrdinal( tag0.intValue() );
+                    break;
+                case 1:
+                    DEROctetString tag1 = (DEROctetString) derObject;
+                    data = tag1.getOctets();
+                    break;
+            }
+        }
 
+        return new Checksum( type, data );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -31,58 +30,57 @@
 import org.apache.kerberos.messages.components.EncKrbPrivPart;
 import org.apache.kerberos.messages.components.EncKrbPrivPartModifier;
 
-
 public class EncKrbPrivPartDecoder
 {
-	public EncKrbPrivPart decode( byte[] encodedPrivatePart ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedPrivatePart );
-
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence privatePart = (DERSequence) app.getObject();
-		
-		return decodePrivatePartSequence( privatePart );
-	}
-	
-	private EncKrbPrivPart decodePrivatePartSequence( DERSequence sequence )
-	{
-		EncKrbPrivPartModifier modifier = new EncKrbPrivPartModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag ) {
-				case 0:
-					DEROctetString tag0 = (DEROctetString) derObject;
-					modifier.setUserData( tag0.getOctets() );
-					break;
-				case 1:
-					DERGeneralizedTime tag1 = (DERGeneralizedTime) derObject;
-					modifier.setTimestamp( KerberosTimeDecoder.decode( tag1 ) );
-					break;
-				case 2:
-					DERInteger tag2 = (DERInteger)derObject;
-					modifier.setMicroSecond( new Integer( tag2.intValue() ) );
-					break;
-				case 3:
-					DERInteger tag3 = (DERInteger)derObject;
-					modifier.setSequenceNumber( new Integer( tag3.intValue() ) );
-					break;
-				case 4:
-					DERSequence tag4 = (DERSequence)derObject;
-					modifier.setSenderAddress( HostAddressDecoder.decode( tag4 ) );
-					break;
-				case 5:
-					DERSequence tag5 = (DERSequence)derObject;
-					modifier.setRecipientAddress( HostAddressDecoder.decode( tag5 ) );
-					break;
-			}
-		}
-		return modifier.getEncKrbPrivPart();
-	}
+    public EncKrbPrivPart decode( byte[] encodedPrivatePart ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedPrivatePart );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence privatePart = (DERSequence) app.getObject();
+
+        return decodePrivatePartSequence( privatePart );
+    }
+
+    private EncKrbPrivPart decodePrivatePartSequence( DERSequence sequence )
+    {
+        EncKrbPrivPartModifier modifier = new EncKrbPrivPartModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DEROctetString tag0 = (DEROctetString) derObject;
+                    modifier.setUserData( tag0.getOctets() );
+                    break;
+                case 1:
+                    DERGeneralizedTime tag1 = (DERGeneralizedTime) derObject;
+                    modifier.setTimestamp( KerberosTimeDecoder.decode( tag1 ) );
+                    break;
+                case 2:
+                    DERInteger tag2 = (DERInteger) derObject;
+                    modifier.setMicroSecond( new Integer( tag2.intValue() ) );
+                    break;
+                case 3:
+                    DERInteger tag3 = (DERInteger) derObject;
+                    modifier.setSequenceNumber( new Integer( tag3.intValue() ) );
+                    break;
+                case 4:
+                    DERSequence tag4 = (DERSequence) derObject;
+                    modifier.setSenderAddress( HostAddressDecoder.decode( tag4 ) );
+                    break;
+                case 5:
+                    DERSequence tag5 = (DERSequence) derObject;
+                    modifier.setRecipientAddress( HostAddressDecoder.decode( tag5 ) );
+                    break;
+            }
+        }
+        return modifier.getEncKrbPrivPart();
+    }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -36,19 +35,18 @@
 import org.apache.kerberos.messages.value.TransitedEncoding;
 import org.apache.kerberos.messages.value.TransitedEncodingType;
 
-
 public class EncTicketPartDecoder
 {
-	public EncTicketPart decode( byte[] encodedTicket ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedTicket );
-		
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence sequence = (DERSequence) app.getObject();
-		
-		return decodeEncTicketPartSequence( sequence );
-	}
+    public EncTicketPart decode( byte[] encodedTicket ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedTicket );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence sequence = (DERSequence) app.getObject();
+
+        return decodeEncTicketPartSequence( sequence );
+    }
 	
 	/*
 	-- Encrypted part of ticket
@@ -66,95 +64,97 @@
 	                      authorization-data[10]   AuthorizationData OPTIONAL
 	}*/
 	private EncTicketPart decodeEncTicketPartSequence( DERSequence sequence )
-	{
-		EncTicketPartModifier modifier = new EncTicketPartModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERBitString tag0 = (DERBitString)derObject;
-					modifier.setFlags( new TicketFlags( tag0.getOctets() ) );
-					break;
-				case 1:
-					DERSequence tag1 = (DERSequence) derObject;
-					modifier.setSessionKey( EncryptionKeyDecoder.decode( tag1 ) );
-					break;
-				case 2:
-					DERGeneralString tag2 = (DERGeneralString)derObject;
-					modifier.setClientRealm( tag2.getString() );
-					break;
-				case 3:
-					DERSequence tag3 = (DERSequence)derObject;
-					modifier.setClientName( PrincipalNameDecoder.decode( tag3 ) );
-					break;
-				case 4:
-					DERSequence tag4 = (DERSequence)derObject;
-					modifier.setTransitedEncoding( decodeTransitedEncoding( tag4 ) );
-					break;
-				case 5:
-					DERGeneralizedTime tag5 = (DERGeneralizedTime)derObject;
-					modifier.setAuthTime( KerberosTimeDecoder.decode( tag5 ) );
-					break;
-				case 6:
-					DERGeneralizedTime tag6 = (DERGeneralizedTime)derObject;
-					modifier.setStartTime( KerberosTimeDecoder.decode( tag6 ) );
-					break;
-				case 7:
-					DERGeneralizedTime tag7 = (DERGeneralizedTime)derObject;
-					modifier.setEndTime( KerberosTimeDecoder.decode( tag7 ) );
-					break;
-				case 8:
-					DERGeneralizedTime tag8 = (DERGeneralizedTime)derObject;
-					modifier.setRenewTill( KerberosTimeDecoder.decode( tag8 ) );
-					break;
-				case 9:
-					DERSequence tag9 = (DERSequence)derObject;
-					modifier.setClientAddresses( HostAddressDecoder.decodeSequence( tag9 ) );
-					break;
-				case 10:
-					DERSequence tag10 = (DERSequence)derObject;
-					modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag10 ) );
-					break;
-			}
-		}
-		return modifier.getEncTicketPart();
-	}
-	
-	/*
-	 * TransitedEncoding ::= SEQUENCE { tr-type[0] INTEGER, -- must be
-	 * registered contents[1] OCTET STRING }
-	 */
-	protected TransitedEncoding decodeTransitedEncoding( DERSequence sequence )
-	{
-		TransitedEncodingType type = TransitedEncodingType.NULL;
-		byte[] contents = null;
-
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger) derObject;
-					type = TransitedEncodingType.getTypeByOrdinal( tag0.intValue() );
-					break;
-				case 1:
-					DEROctetString tag1 = (DEROctetString) derObject;
-					contents = tag1.getOctets();
-					break;
-			}
-		}
-		
-		return new TransitedEncoding( type, contents );
-	}
-}
+    {
+        EncTicketPartModifier modifier = new EncTicketPartModifier();
 
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERBitString tag0 = (DERBitString) derObject;
+                    modifier.setFlags( new TicketFlags( tag0.getOctets() ) );
+                    break;
+                case 1:
+                    DERSequence tag1 = (DERSequence) derObject;
+                    modifier.setSessionKey( EncryptionKeyDecoder.decode( tag1 ) );
+                    break;
+                case 2:
+                    DERGeneralString tag2 = (DERGeneralString) derObject;
+                    modifier.setClientRealm( tag2.getString() );
+                    break;
+                case 3:
+                    DERSequence tag3 = (DERSequence) derObject;
+                    modifier.setClientName( PrincipalNameDecoder.decode( tag3 ) );
+                    break;
+                case 4:
+                    DERSequence tag4 = (DERSequence) derObject;
+                    modifier.setTransitedEncoding( decodeTransitedEncoding( tag4 ) );
+                    break;
+                case 5:
+                    DERGeneralizedTime tag5 = (DERGeneralizedTime) derObject;
+                    modifier.setAuthTime( KerberosTimeDecoder.decode( tag5 ) );
+                    break;
+                case 6:
+                    DERGeneralizedTime tag6 = (DERGeneralizedTime) derObject;
+                    modifier.setStartTime( KerberosTimeDecoder.decode( tag6 ) );
+                    break;
+                case 7:
+                    DERGeneralizedTime tag7 = (DERGeneralizedTime) derObject;
+                    modifier.setEndTime( KerberosTimeDecoder.decode( tag7 ) );
+                    break;
+                case 8:
+                    DERGeneralizedTime tag8 = (DERGeneralizedTime) derObject;
+                    modifier.setRenewTill( KerberosTimeDecoder.decode( tag8 ) );
+                    break;
+                case 9:
+                    DERSequence tag9 = (DERSequence) derObject;
+                    modifier.setClientAddresses( HostAddressDecoder.decodeSequence( tag9 ) );
+                    break;
+                case 10:
+                    DERSequence tag10 = (DERSequence) derObject;
+                    modifier
+                            .setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag10 ) );
+                    break;
+            }
+        }
+        return modifier.getEncTicketPart();
+    }
+
+    /*
+     * TransitedEncoding ::= SEQUENCE {
+     *   tr-type[0] INTEGER, -- must be
+     *   registered contents[1] OCTET STRING
+     * }
+     */
+    protected TransitedEncoding decodeTransitedEncoding( DERSequence sequence )
+    {
+        TransitedEncodingType type = TransitedEncodingType.NULL;
+        byte[] contents = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    type = TransitedEncodingType.getTypeByOrdinal( tag0.intValue() );
+                    break;
+                case 1:
+                    DEROctetString tag1 = (DEROctetString) derObject;
+                    contents = tag1.getOctets();
+                    break;
+            }
+        }
+
+        return new TransitedEncoding( type, contents );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedDataDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedDataDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedDataDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedDataDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -30,17 +29,16 @@
 import org.apache.kerberos.messages.value.EncryptedData;
 import org.apache.kerberos.messages.value.EncryptedDataModifier;
 
-
 public class EncryptedDataDecoder
 {
-	public static EncryptedData decode( byte[] encodedEncryptedData ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedEncryptedData );
-		
-		DERSequence sequence = (DERSequence) ais.readObject();
-		
-		return decode( sequence );
-	}
+    public static EncryptedData decode( byte[] encodedEncryptedData ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedEncryptedData );
+
+        DERSequence sequence = (DERSequence) ais.readObject();
+
+        return decode( sequence );
+    }
 	
 	/**
 	 * EncryptedData ::=   SEQUENCE {
@@ -50,33 +48,32 @@
 	 * }
 	 */
 	public static EncryptedData decode( DERSequence sequence )
-	{
-		EncryptedDataModifier modifier = new EncryptedDataModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger etype = (DERInteger)derObject;
-					modifier.setEncryptionType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
-					break;
-				case 1:
-					DERInteger kvno = (DERInteger)derObject;
-					modifier.setKeyVersion( kvno.intValue() );
-					break;
-				case 2:
-					DEROctetString cipher = (DEROctetString)derObject;
-					modifier.setCipherText( cipher.getOctets() );
-					break;
-			}
-		}
-		
-		return modifier.getEncryptedData();
-	}
-}
+    {
+        EncryptedDataModifier modifier = new EncryptedDataModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger etype = (DERInteger) derObject;
+                    modifier.setEncryptionType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
+                    break;
+                case 1:
+                    DERInteger kvno = (DERInteger) derObject;
+                    modifier.setKeyVersion( kvno.intValue() );
+                    break;
+                case 2:
+                    DEROctetString cipher = (DEROctetString) derObject;
+                    modifier.setCipherText( cipher.getOctets() );
+                    break;
+            }
+        }
 
+        return modifier.getEncryptedData();
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedTimestampDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedTimestampDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedTimestampDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptedTimestampDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -40,39 +39,38 @@
  */
 public class EncryptedTimestampDecoder
 {
-	public EncryptedTimeStamp decode( byte[] encodedEncryptedTimestamp ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedEncryptedTimestamp );
-		
-		DERSequence sequence = (DERSequence) ais.readObject();
-		
-		return decodeEncryptedTimestamp( sequence );
-	}
-	
-	protected EncryptedTimeStamp decodeEncryptedTimestamp( DERSequence sequence )
-	{
-		EncryptedTimeStampModifier modifier = new EncryptedTimeStampModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERGeneralizedTime tag0 = (DERGeneralizedTime)derObject;
-					modifier.setKerberosTime( KerberosTimeDecoder.decode( tag0 ) );
-					break;
-				case 1:
-					DERInteger tag1 = (DERInteger)derObject;
-					modifier.setMicroSecond( tag1.intValue() );
-					break;
-			}
-		}
-		
-		return modifier.getEncryptedTimestamp();
-	}
-}
+    public EncryptedTimeStamp decode( byte[] encodedEncryptedTimestamp ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedEncryptedTimestamp );
+
+        DERSequence sequence = (DERSequence) ais.readObject();
+
+        return decodeEncryptedTimestamp( sequence );
+    }
 
+    protected EncryptedTimeStamp decodeEncryptedTimestamp( DERSequence sequence )
+    {
+        EncryptedTimeStampModifier modifier = new EncryptedTimeStampModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERGeneralizedTime tag0 = (DERGeneralizedTime) derObject;
+                    modifier.setKerberosTime( KerberosTimeDecoder.decode( tag0 ) );
+                    break;
+                case 1:
+                    DERInteger tag1 = (DERInteger) derObject;
+                    modifier.setMicroSecond( tag1.intValue() );
+                    break;
+            }
+        }
+
+        return modifier.getEncryptedTimestamp();
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionKeyDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionKeyDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionKeyDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionKeyDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -27,7 +26,6 @@
 import org.apache.kerberos.crypto.encryption.EncryptionType;
 import org.apache.kerberos.messages.value.EncryptionKey;
 
-
 public class EncryptionKeyDecoder
 {
 	/**
@@ -37,30 +35,29 @@
      * }
      */
 	protected static EncryptionKey decode( DERSequence sequence )
-	{
-		EncryptionType type = EncryptionType.NULL;
-		byte[] data = null;
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger)derObject;
-					type = EncryptionType.getTypeByOrdinal( tag0.intValue() );
-					break;
-				case 1:
-					DEROctetString tag1 = (DEROctetString)derObject;
-					data = tag1.getOctets();
-					break;
-			}
-		}
-		
-		return new EncryptionKey( type, data );
-	}
-}
+    {
+        EncryptionType type = EncryptionType.NULL;
+        byte[] data = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    type = EncryptionType.getTypeByOrdinal( tag0.intValue() );
+                    break;
+                case 1:
+                    DEROctetString tag1 = (DEROctetString) derObject;
+                    data = tag1.getOctets();
+                    break;
+            }
+        }
 
+        return new EncryptionKey( type, data );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionTypeDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionTypeDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionTypeDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/EncryptionTypeDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -23,7 +22,6 @@
 import org.apache.asn1.der.DERSequence;
 import org.apache.kerberos.crypto.encryption.EncryptionType;
 
-
 public class EncryptionTypeDecoder
 {
 	/**
@@ -31,18 +29,17 @@
      *             -- in preference order
      */
 	protected static EncryptionType[] decode( DERSequence sequence )
-	{
-		EncryptionType[] eTypes = new EncryptionType[ sequence.size() ];
-		
-		int ii = 0;
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERInteger object = (DERInteger) e.nextElement();
-			eTypes[ii] = EncryptionType.getTypeByOrdinal( object.intValue() );
-			ii++;
-		}
-		
-		return eTypes;
-	}
-}
+    {
+        EncryptionType[] eTypes = new EncryptionType[ sequence.size() ];
 
+        int ii = 0;
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERInteger object = (DERInteger) e.nextElement();
+            eTypes[ ii ] = EncryptionType.getTypeByOrdinal( object.intValue() );
+            ii++;
+        }
+
+        return eTypes;
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/HostAddressDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/HostAddressDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/HostAddressDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/HostAddressDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -28,7 +27,6 @@
 import org.apache.kerberos.messages.value.HostAddressType;
 import org.apache.kerberos.messages.value.HostAddresses;
 
-
 public class HostAddressDecoder
 {
 	/**
@@ -38,32 +36,32 @@
      * }
      */
 	protected static HostAddress decode( DERSequence sequence )
-	{
-		HostAddressType type = HostAddressType.NULL;
-		byte[] value = null;
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger addressType = (DERInteger)derObject;
-					type = HostAddressType.getTypeByOrdinal( addressType.intValue() );
-					break;
-				case 1:
-					DEROctetString address = (DEROctetString)derObject;
-					value = address.getOctets();
-					break;
-			}
-		}
-		
-		return new HostAddress( type, value );
-	}
-	
+    {
+        HostAddressType type = HostAddressType.NULL;
+        byte[] value = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger addressType = (DERInteger) derObject;
+                    type = HostAddressType.getTypeByOrdinal( addressType.intValue() );
+                    break;
+                case 1:
+                    DEROctetString address = (DEROctetString) derObject;
+                    value = address.getOctets();
+                    break;
+            }
+        }
+
+        return new HostAddress( type, value );
+    }
+
 	/**
 	 * HostAddresses ::=   SEQUENCE OF SEQUENCE {
 	 *                     addr-type[0]             INTEGER,
@@ -71,19 +69,18 @@
 	 * }
 	 */
 	protected static HostAddresses decodeSequence( DERSequence sequence )
-	{
-		HostAddress[] addresses = new HostAddress[ sequence.size() ];
-		
-		int ii = 0;
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERSequence object = (DERSequence) e.nextElement();
-			HostAddress address = decode( object );
-			addresses[ii] = address;
-			ii++;
-		}
-		
-		return new HostAddresses( addresses );
-	}
-}
+    {
+        HostAddress[] addresses = new HostAddress[ sequence.size() ];
+
+        int ii = 0;
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERSequence object = (DERSequence) e.nextElement();
+            HostAddress address = decode( object );
+            addresses[ ii ] = address;
+            ii++;
+        }
 
+        return new HostAddresses( addresses );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -37,19 +36,18 @@
 import org.apache.kerberos.messages.value.RequestBody;
 import org.apache.kerberos.messages.value.RequestBodyModifier;
 
-
 public class KdcRequestDecoder
 {
-	public KdcRequest decode( ByteBuffer in ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( in );
-		
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence kdcreq = (DERSequence) app.getObject();
-		
-		return decodeKdcRequestSequence( kdcreq );
-	}
+    public KdcRequest decode( ByteBuffer in ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( in );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence kdcreq = (DERSequence) app.getObject();
+
+        return decodeKdcRequestSequence( kdcreq );
+    }
 	
 	/*
 	AS-REQ ::=         [APPLICATION 10] KDC-REQ
@@ -62,42 +60,42 @@
 	           req-body[4]           KDC-REQ-BODY
 	}*/
 	private KdcRequest decodeKdcRequestSequence( DERSequence sequence ) throws IOException
-	{
-		int pvno = 5;
-		MessageType msgType = MessageType.NULL;
-		
-		PreAuthenticationData[] paData = null;
-		RequestBody requestBody = null;
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 1:
-					DERInteger tag1 = (DERInteger)derObject;
-					pvno = tag1.intValue();
-					break;
-				case 2:
-					DERInteger tag2 = (DERInteger)derObject;
-					msgType = MessageType.getTypeByOrdinal( tag2.intValue() );
-					break;
-				case 3:
-					DERSequence tag3 = (DERSequence)derObject;
-					paData = PreAuthenticationDataDecoder.decodeSequence( tag3 );
-					break;
-				case 4:
-					DERSequence tag4 = (DERSequence)derObject;
-					requestBody = decodeRequestBody( tag4 );
-					break;
-			}
-		}
-		
-		return new KdcRequest( pvno, msgType, paData, requestBody );
-	}
+    {
+        int pvno = 5;
+        MessageType msgType = MessageType.NULL;
+
+        PreAuthenticationData[] paData = null;
+        RequestBody requestBody = null;
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 1:
+                    DERInteger tag1 = (DERInteger) derObject;
+                    pvno = tag1.intValue();
+                    break;
+                case 2:
+                    DERInteger tag2 = (DERInteger) derObject;
+                    msgType = MessageType.getTypeByOrdinal( tag2.intValue() );
+                    break;
+                case 3:
+                    DERSequence tag3 = (DERSequence) derObject;
+                    paData = PreAuthenticationDataDecoder.decodeSequence( tag3 );
+                    break;
+                case 4:
+                    DERSequence tag4 = (DERSequence) derObject;
+                    requestBody = decodeRequestBody( tag4 );
+                    break;
+            }
+        }
+
+        return new KdcRequest( pvno, msgType, paData, requestBody );
+    }
 	
 	/*
 	KDC-REQ-BODY ::=   SEQUENCE {
@@ -119,69 +117,68 @@
 	            additional-tickets[11]       SEQUENCE OF Ticket OPTIONAL
 	}*/
 	private RequestBody decodeRequestBody( DERSequence sequence ) throws IOException
-	{
-		RequestBodyModifier modifier = new RequestBodyModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERBitString kdcOptions = (DERBitString)derObject;
-					modifier.setKdcOptions( new KdcOptions( kdcOptions.getOctets() ) );
-					break;
-				case 1:
-					DERSequence cName = (DERSequence)derObject;
-					modifier.setClientName( PrincipalNameDecoder.decode( cName ) );
-					break;
-				case 2:
-					DERGeneralString realm = (DERGeneralString)derObject;
-					modifier.setRealm( realm.getString() );
-					break;
-				case 3:
-					DERSequence sname = (DERSequence)derObject;
-					modifier.setServerName( PrincipalNameDecoder.decode( sname ) );
-					break;
-				case 4:
-					DERGeneralizedTime from = (DERGeneralizedTime)derObject;
-					modifier.setFrom( KerberosTimeDecoder.decode( from ) );
-					break;
-				case 5:
-					DERGeneralizedTime till = (DERGeneralizedTime)derObject;
-					modifier.setTill( KerberosTimeDecoder.decode( till ) );
-					break;
-				case 6:
-					DERGeneralizedTime rtime = (DERGeneralizedTime)derObject;
-					modifier.setRtime( KerberosTimeDecoder.decode( rtime ) );
-					break;
-				case 7:
-					DERInteger nonce = (DERInteger)derObject;
-					modifier.setNonce( nonce.intValue() );
-					break;
-				case 8:
-					DERSequence etype = (DERSequence)derObject;
-					modifier.setEType( EncryptionTypeDecoder.decode( etype ) );
-					break;
-				case 9:
-					DERSequence hostAddresses = (DERSequence)derObject;
-					modifier.setAddresses( HostAddressDecoder.decodeSequence( hostAddresses ) );
-					break;
-				case 10:
-					DERSequence encryptedData = (DERSequence)derObject;
-					modifier.setEncAuthorizationData( EncryptedDataDecoder.decode( encryptedData ) );
-					break;
-				case 11:
-					DERSequence tag11 = (DERSequence)derObject;
-					modifier.setAdditionalTickets( TicketDecoder.decodeSequence( tag11 ) );
-					break;
-			}
-		}
-		
-		return modifier.getRequestBody();
-	}
-}
+    {
+        RequestBodyModifier modifier = new RequestBodyModifier();
 
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERBitString kdcOptions = (DERBitString) derObject;
+                    modifier.setKdcOptions( new KdcOptions( kdcOptions.getOctets() ) );
+                    break;
+                case 1:
+                    DERSequence cName = (DERSequence) derObject;
+                    modifier.setClientName( PrincipalNameDecoder.decode( cName ) );
+                    break;
+                case 2:
+                    DERGeneralString realm = (DERGeneralString) derObject;
+                    modifier.setRealm( realm.getString() );
+                    break;
+                case 3:
+                    DERSequence sname = (DERSequence) derObject;
+                    modifier.setServerName( PrincipalNameDecoder.decode( sname ) );
+                    break;
+                case 4:
+                    DERGeneralizedTime from = (DERGeneralizedTime) derObject;
+                    modifier.setFrom( KerberosTimeDecoder.decode( from ) );
+                    break;
+                case 5:
+                    DERGeneralizedTime till = (DERGeneralizedTime) derObject;
+                    modifier.setTill( KerberosTimeDecoder.decode( till ) );
+                    break;
+                case 6:
+                    DERGeneralizedTime rtime = (DERGeneralizedTime) derObject;
+                    modifier.setRtime( KerberosTimeDecoder.decode( rtime ) );
+                    break;
+                case 7:
+                    DERInteger nonce = (DERInteger) derObject;
+                    modifier.setNonce( nonce.intValue() );
+                    break;
+                case 8:
+                    DERSequence etype = (DERSequence) derObject;
+                    modifier.setEType( EncryptionTypeDecoder.decode( etype ) );
+                    break;
+                case 9:
+                    DERSequence hostAddresses = (DERSequence) derObject;
+                    modifier.setAddresses( HostAddressDecoder.decodeSequence( hostAddresses ) );
+                    break;
+                case 10:
+                    DERSequence encryptedData = (DERSequence) derObject;
+                    modifier.setEncAuthorizationData( EncryptedDataDecoder.decode( encryptedData ) );
+                    break;
+                case 11:
+                    DERSequence tag11 = (DERSequence) derObject;
+                    modifier.setAdditionalTickets( TicketDecoder.decodeSequence( tag11 ) );
+                    break;
+            }
+        }
+
+        return modifier.getRequestBody();
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KerberosTimeDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KerberosTimeDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KerberosTimeDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/KerberosTimeDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.text.ParseException;
@@ -23,27 +22,25 @@
 import org.apache.asn1.der.DERGeneralizedTime;
 import org.apache.kerberos.messages.value.KerberosTime;
 
-
 public class KerberosTimeDecoder
 {
-	/**
-	 * KerberosTime ::=   GeneralizedTime
-	 *             -- Specifying UTC time zone (Z)
-	 */
-	protected static KerberosTime decode( DERGeneralizedTime time )
-	{
-		Date date = null;
-		
-		try
-		{
-			date = time.getDate();
-		}
-		catch (ParseException pe)
-		{
-			pe.printStackTrace();
-		}
-		
-		return new KerberosTime( date );
-	}
-}
+    /**
+     * KerberosTime ::=   GeneralizedTime
+     *             -- Specifying UTC time zone (Z)
+     */
+    protected static KerberosTime decode( DERGeneralizedTime time )
+    {
+        Date date = null;
+
+        try
+        {
+            date = time.getDate();
+        }
+        catch ( ParseException pe )
+        {
+            pe.printStackTrace();
+        }
 
+        return new KerberosTime( date );
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/LastRequestDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/LastRequestDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/LastRequestDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/LastRequestDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -29,7 +28,6 @@
 import org.apache.kerberos.messages.value.LastRequestEntry;
 import org.apache.kerberos.messages.value.LastRequestType;
 
-
 public class LastRequestDecoder
 {
 	/**
@@ -81,4 +79,3 @@
 		return new LastRequestEntry( type, value );
 	}
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PreAuthenticationDataDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -30,74 +29,73 @@
 import org.apache.kerberos.messages.value.PreAuthenticationDataModifier;
 import org.apache.kerberos.messages.value.PreAuthenticationDataType;
 
-
 public class PreAuthenticationDataDecoder
 {
-	public PreAuthenticationData decode( byte[] encodedPreAuthData ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedPreAuthData );
-
-		DERSequence sequence = (DERSequence) ais.readObject();
-		
-		return decode( sequence );
-	}
-	
+    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,
-	 *            msg-type[2]           INTEGER,
-	 *            padata[3]             SEQUENCE OF PA-DATA OPTIONAL,
-	 *            req-body[4]           KDC-REQ-BODY
-	 * }
-	 */
-	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();
-			PreAuthenticationData paData = PreAuthenticationDataDecoder.decode( object );
-			paDataSequence[ii] = paData;
-			ii++;
-		}
-		
-		return paDataSequence;
-	}
-    
-	/**
-	 * PA-DATA ::=        SEQUENCE {
-	 *            padata-type[1]        INTEGER,
-	 *            padata-value[2]       OCTET STRING,
-	 *                          -- might be encoded AP-REQ
-	 * }
-	 */
-	protected static PreAuthenticationData decode( DERSequence sequence )
-	{
-		PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 1:
-					DERInteger padataType = (DERInteger) derObject;
-					PreAuthenticationDataType type = PreAuthenticationDataType.getTypeByOrdinal( padataType.intValue() );
-					modifier.setDataType( type );
-					break;
-				case 2:
-					DEROctetString padataValue = (DEROctetString) derObject;
-					modifier.setDataValue( padataValue.getOctets() );
-					break;
-			}
-		}
-		
-		return modifier.getPreAuthenticationData();
-	}
-}
+     *            pvno[1]               INTEGER,
+     *            msg-type[2]           INTEGER,
+     *            padata[3]             SEQUENCE OF PA-DATA OPTIONAL,
+     *            req-body[4]           KDC-REQ-BODY
+     * }
+     */
+    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();
+            PreAuthenticationData paData = PreAuthenticationDataDecoder.decode( object );
+            paDataSequence[ ii ] = paData;
+            ii++;
+        }
+
+        return paDataSequence;
+    }
 
+    /**
+     * PA-DATA ::=        SEQUENCE {
+     *            padata-type[1]        INTEGER,
+     *            padata-value[2]       OCTET STRING,
+     *                          -- might be encoded AP-REQ
+     * }
+     */
+    protected static PreAuthenticationData decode( DERSequence sequence )
+    {
+        PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 1:
+                    DERInteger padataType = (DERInteger) derObject;
+                    PreAuthenticationDataType type = PreAuthenticationDataType
+                            .getTypeByOrdinal( padataType.intValue() );
+                    modifier.setDataType( type );
+                    break;
+                case 2:
+                    DEROctetString padataValue = (DEROctetString) derObject;
+                    modifier.setDataValue( padataValue.getOctets() );
+                    break;
+            }
+        }
+
+        return modifier.getPreAuthenticationData();
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrincipalNameDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrincipalNameDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrincipalNameDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrincipalNameDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.util.Enumeration;
@@ -27,48 +26,46 @@
 import org.apache.kerberos.messages.value.PrincipalName;
 import org.apache.kerberos.messages.value.PrincipalNameModifier;
 
-
 public class PrincipalNameDecoder
 {
-	/**
-	 * PrincipalName ::=   SEQUENCE {
-	 *               name-type[0]     INTEGER,
-	 *               name-string[1]   SEQUENCE OF GeneralString
-	 * }
-	 */
-	public static PrincipalName decode( DERSequence sequence )
-	{
-		PrincipalNameModifier modifier = new PrincipalNameModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger nameType = (DERInteger)derObject;
-					modifier.setType( nameType.intValue() );
-					break;
-				case 1:
-					DERSequence nameString = (DERSequence)derObject;
-					decodeNameString( nameString, modifier );
-					break;
-			}
-		}
-		
-		return modifier.getPrincipalName();
-	}
-	
-	private static void decodeNameString( DERSequence sequence, PrincipalNameModifier modifier )
-	{
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERGeneralString object = (DERGeneralString) e.nextElement();
-			modifier.addName( object.getString() );
-		}
-	}
+    /**
+     * PrincipalName ::=   SEQUENCE {
+     *               name-type[0]     INTEGER,
+     *               name-string[1]   SEQUENCE OF GeneralString
+     * }
+     */
+    public static PrincipalName decode( DERSequence sequence )
+    {
+        PrincipalNameModifier modifier = new PrincipalNameModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger nameType = (DERInteger) derObject;
+                    modifier.setType( nameType.intValue() );
+                    break;
+                case 1:
+                    DERSequence nameString = (DERSequence) derObject;
+                    decodeNameString( nameString, modifier );
+                    break;
+            }
+        }
+
+        return modifier.getPrincipalName();
+    }
+
+    private static void decodeNameString( DERSequence sequence, PrincipalNameModifier modifier )
+    {
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERGeneralString object = (DERGeneralString) e.nextElement();
+            modifier.addName( object.getString() );
+        }
+    }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -29,48 +28,46 @@
 import org.apache.kerberos.messages.MessageType;
 import org.apache.kerberos.messages.application.PrivateMessage;
 
-
 public class PrivateMessageDecoder
 {
-	public PrivateMessage decode( byte[] encodedPrivateMessage ) throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedPrivateMessage );
-
-		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
-		
-		DERSequence privateMessage = (DERSequence) app.getObject();
-		
-		return decodePrivateMessageSequence( privateMessage );
-	}
-	
-	private PrivateMessage decodePrivateMessageSequence( DERSequence sequence )
-	{
-		PrivateMessage message = new PrivateMessage();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger) derObject;
-					message.setProtocolVersionNumber( tag0.intValue() );
-					break;
-				case 1:
-					DERInteger tag1 = (DERInteger) derObject;
-					message.setMessageType( MessageType.getTypeByOrdinal( tag1.intValue() ) );
-					break;
-				case 3:
-					DERSequence tag3 = (DERSequence)derObject;
-					message.setEncryptedPart( EncryptedDataDecoder.decode( tag3 ) );
-					break;
-			}
-		}
-		
-		return message;
-	}
-}
+    public PrivateMessage decode( byte[] encodedPrivateMessage ) throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedPrivateMessage );
+
+        DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
+
+        DERSequence privateMessage = (DERSequence) app.getObject();
+
+        return decodePrivateMessageSequence( privateMessage );
+    }
+
+    private PrivateMessage decodePrivateMessageSequence( DERSequence sequence )
+    {
+        PrivateMessage message = new PrivateMessage();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    message.setProtocolVersionNumber( tag0.intValue() );
+                    break;
+                case 1:
+                    DERInteger tag1 = (DERInteger) derObject;
+                    message.setMessageType( MessageType.getTypeByOrdinal( tag1.intValue() ) );
+                    break;
+                case 3:
+                    DERSequence tag3 = (DERSequence) derObject;
+                    message.setEncryptedPart( EncryptedDataDecoder.decode( tag3 ) );
+                    break;
+            }
+        }
 
+        return message;
+    }
+}

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/TicketDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/TicketDecoder.java?rev=233999&r1=233998&r2=233999&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/TicketDecoder.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/io/decoder/TicketDecoder.java Fri Aug 19 22:00:47 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.io.decoder;
 
 import java.io.IOException;
@@ -29,65 +28,63 @@
 import org.apache.kerberos.messages.components.Ticket;
 import org.apache.kerberos.messages.components.TicketModifier;
 
-
 public class TicketDecoder
 {
-	public static Ticket[] decodeSequence( DERSequence sequence ) throws IOException
-	{
-		Ticket[] tickets = new Ticket[ sequence.size() ];
-		
-		int ii = 0;
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERApplicationSpecific object = (DERApplicationSpecific) e.nextElement();
-			tickets[ii] = decode( object );
-		}
-		
-		return tickets;
-	}
-	
-	/**
-	 * Ticket ::=                    [APPLICATION 1] SEQUENCE {
+    public static Ticket[] decodeSequence( DERSequence sequence ) throws IOException
+    {
+        Ticket[] tickets = new Ticket[ sequence.size() ];
+
+        int ii = 0;
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERApplicationSpecific object = (DERApplicationSpecific) e.nextElement();
+            tickets[ ii ] = decode( object );
+        }
+
+        return tickets;
+    }
+
+    /**
+     * Ticket ::=                    [APPLICATION 1] SEQUENCE {
      *     tkt-vno[0]                   INTEGER,
      *     realm[1]                     Realm,
      *     sname[2]                     PrincipalName,
      *     enc-part[3]                  EncryptedData
      * }
      */
-	protected static Ticket decode( DERApplicationSpecific app ) throws IOException
-	{
-		DERSequence sequence = (DERSequence) app.getObject();
-		
-		TicketModifier modifier = new TicketModifier();
-		
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = (DERTaggedObject) e.nextElement();
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			
-			switch ( tag )
-			{
-				case 0:
-					DERInteger tag0 = (DERInteger)derObject;
-					modifier.setTicketVersionNumber( tag0.intValue() );
-					break;
-				case 1:
-					DERGeneralString tag1 = (DERGeneralString)derObject;
-					modifier.setServerRealm( tag1.getString() );
-					break;
-				case 2:
-					DERSequence tag2 = (DERSequence)derObject;
-					modifier.setServerName( PrincipalNameDecoder.decode( tag2 ) );
-					break;
-				case 3:
-					DERSequence tag3 = (DERSequence)derObject;
-					modifier.setEncPart( EncryptedDataDecoder.decode( tag3 ) );
-					break;
-			}
-		}
-		
-		return modifier.getTicket();
-	}
-}
+    protected static Ticket decode( DERApplicationSpecific app ) throws IOException
+    {
+        DERSequence sequence = (DERSequence) app.getObject();
+
+        TicketModifier modifier = new TicketModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = (DERTaggedObject) e.nextElement();
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+
+            switch ( tag )
+            {
+                case 0:
+                    DERInteger tag0 = (DERInteger) derObject;
+                    modifier.setTicketVersionNumber( tag0.intValue() );
+                    break;
+                case 1:
+                    DERGeneralString tag1 = (DERGeneralString) derObject;
+                    modifier.setServerRealm( tag1.getString() );
+                    break;
+                case 2:
+                    DERSequence tag2 = (DERSequence) derObject;
+                    modifier.setServerName( PrincipalNameDecoder.decode( tag2 ) );
+                    break;
+                case 3:
+                    DERSequence tag3 = (DERSequence) derObject;
+                    modifier.setEncPart( EncryptedDataDecoder.decode( tag3 ) );
+                    break;
+            }
+        }
 
+        return modifier.getTicket();
+    }
+}



Mime
View raw message