directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r125326 - incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder
Date Sun, 16 Jan 2005 01:12:30 GMT
Author: erodriguez
Date: Sat Jan 15 17:12:29 2005
New Revision: 125326

URL: http://svn.apache.org/viewcvs?view=rev&rev=125326
Log:
Redirecting Kerberos ASN.1 DER decoding to use Apache libraries.
Modified:
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/ApplicationRequestDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,14 +14,23 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.*;
-import org.apache.kerberos.messages.value.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.util.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERBitString;
+import org.apache.asn1.der.DERInteger;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.messages.ApplicationRequest;
+import org.apache.kerberos.messages.MessageType;
+import org.apache.kerberos.messages.value.ApOptions;
 
 public class ApplicationRequestDecoder extends KerberosMessageDecoder {
 	

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthenticatorDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,12 +14,16 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.components.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import java.io.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERSequence;
+import org.apache.kerberos.messages.components.Authenticator;
 
 public class AuthenticatorDecoder extends KerberosMessageDecoder {
 	

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/AuthorizationDataDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,12 +14,15 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.value.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 
-import java.io.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERSequence;
+import org.apache.kerberos.messages.value.AuthorizationData;
 
 public class AuthorizationDataDecoder extends KerberosMessageDecoder {
 	

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncKrbPrivPartDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,13 +14,23 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.components.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.util.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERGeneralizedTime;
+import org.apache.asn1.der.DERInteger;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DEROctetString;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.messages.components.EncKrbPrivPart;
+import org.apache.kerberos.messages.components.EncKrbPrivPartModifier;
 
 public class EncKrbPrivPartDecoder extends KerberosMessageDecoder {
 	

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/EncTicketPartDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,14 +14,24 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.components.*;
-import org.apache.kerberos.messages.value.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.util.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERBitString;
+import org.apache.asn1.der.DERGeneralString;
+import org.apache.asn1.der.DERGeneralizedTime;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.messages.components.EncTicketPart;
+import org.apache.kerberos.messages.components.EncTicketPartModifier;
+import org.apache.kerberos.messages.value.TicketFlags;
 
 public class EncTicketPartDecoder extends KerberosMessageDecoder {
 	

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KdcRequestDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,26 +14,44 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.*;
-import org.apache.kerberos.messages.components.*;
-import org.apache.kerberos.messages.value.*;
-import org.bouncycastle.asn1.*;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.util.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERBitString;
+import org.apache.asn1.der.DERGeneralString;
+import org.apache.asn1.der.DERGeneralizedTime;
+import org.apache.asn1.der.DERInteger;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DEROctetString;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.messages.KdcRequest;
+import org.apache.kerberos.messages.MessageType;
+import org.apache.kerberos.messages.components.Ticket;
+import org.apache.kerberos.messages.value.KdcOptions;
+import org.apache.kerberos.messages.value.PreAuthenticationData;
+import org.apache.kerberos.messages.value.PreAuthenticationDataModifier;
+import org.apache.kerberos.messages.value.PreAuthenticationDataType;
+import org.apache.kerberos.messages.value.RequestBody;
+import org.apache.kerberos.messages.value.RequestBodyModifier;
 
-public class KdcRequestDecoder extends KerberosMessageDecoder {
 
-	public KdcRequest decode(InputStream is) throws IOException {
-		
-		ASN1InputStream ais = new ASN1InputStream(is);
+public class KdcRequestDecoder extends KerberosMessageDecoder
+{
+	public KdcRequest decode( ByteBuffer in ) throws IOException
+	{
+		ASN1InputStream ais = new ASN1InputStream( newInputStream( in ) );
 		
 		DERApplicationSpecific app = (DERApplicationSpecific) ais.readObject();
 		
 		DERSequence kdcreq = (DERSequence) app.getObject();
-		return decodeKdcRequestSequence(kdcreq);
+		return decodeKdcRequestSequence( kdcreq );
 	}
 	
 	/*

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/KerberosMessageDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,19 +14,73 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.crypto.checksum.*;
-import org.apache.kerberos.crypto.encryption.*;
-import org.apache.kerberos.messages.components.*;
-import org.apache.kerberos.messages.value.*;
-import org.bouncycastle.asn1.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.text.*;
-import java.util.*;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERGeneralString;
+import org.apache.asn1.der.DERGeneralizedTime;
+import org.apache.asn1.der.DERInteger;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DEROctetString;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.crypto.checksum.ChecksumType;
+import org.apache.kerberos.crypto.encryption.EncryptionType;
+import org.apache.kerberos.messages.components.Authenticator;
+import org.apache.kerberos.messages.components.AuthenticatorModifier;
+import org.apache.kerberos.messages.components.Ticket;
+import org.apache.kerberos.messages.components.TicketModifier;
+import org.apache.kerberos.messages.value.AuthorizationData;
+import org.apache.kerberos.messages.value.AuthorizationDataEntry;
+import org.apache.kerberos.messages.value.AuthorizationType;
+import org.apache.kerberos.messages.value.Checksum;
+import org.apache.kerberos.messages.value.EncryptedData;
+import org.apache.kerberos.messages.value.EncryptedDataModifier;
+import org.apache.kerberos.messages.value.EncryptionKey;
+import org.apache.kerberos.messages.value.HostAddress;
+import org.apache.kerberos.messages.value.HostAddressType;
+import org.apache.kerberos.messages.value.HostAddresses;
+import org.apache.kerberos.messages.value.KerberosTime;
+import org.apache.kerberos.messages.value.LastRequest;
+import org.apache.kerberos.messages.value.LastRequestEntry;
+import org.apache.kerberos.messages.value.LastRequestType;
+import org.apache.kerberos.messages.value.PrincipalName;
+import org.apache.kerberos.messages.value.PrincipalNameModifier;
+import org.apache.kerberos.messages.value.TransitedEncoding;
+import org.apache.kerberos.messages.value.TransitedEncodingType;
 
-public abstract class KerberosMessageDecoder {
+public abstract class KerberosMessageDecoder
+{
+    public InputStream newInputStream( final ByteBuffer buf )
+    {
+        return new InputStream()
+		{
+            public synchronized int read() throws IOException
+			{
+                if ( !buf.hasRemaining() )
+                {
+                    return -1;
+                }
+                return buf.get();
+            }
+    
+            public synchronized int read( byte[] bytes, int off, int len ) throws IOException
+			{
+                // Read only what's left
+                len = Math.min( len, buf.remaining() );
+                buf.get( bytes, off, len );
+                return len;
+            }
+        };
+    }
 	
 	/*
 	Ticket ::=                    [APPLICATION 1] SEQUENCE {

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java?view=diff&rev=125326&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java&r1=125325&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java&r2=125326
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/decoder/PrivateMessageDecoder.java
Sat Jan 15 17:12:29 2005
@@ -14,14 +14,21 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.io.decoder;
 
-import org.apache.kerberos.messages.*;
-import org.apache.kerberos.messages.application.*;
-import org.bouncycastle.asn1.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
 
-import java.io.*;
-import java.util.*;
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERApplicationSpecific;
+import org.apache.asn1.der.DERInteger;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
+import org.apache.kerberos.messages.MessageType;
+import org.apache.kerberos.messages.application.PrivateMessage;
 
 public class PrivateMessageDecoder extends KerberosMessageDecoder {
 	

Mime
View raw message