You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 17:15:29 UTC
svn commit: r1235326 [19/28] - in /directory/apacheds/trunk:
jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partitio...
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqBodyDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqBodyDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqBodyDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqBodyDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -66,123 +66,123 @@ public class KdcReqBodyDecoderTest
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x15B );
-
+
stream.put( new byte[]
- {
- 0x30, (byte)0x82, 0x01, 0x57,
- (byte)0xA0, 0x07,
- 0x03, 0x05,
- 0x00, 0x01, 0x04, 0x00, 0x32,
- (byte)0xA1, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA3, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA4, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA6, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12,
- (byte)0xA9, 0x2E,
- 0x30, 0x2C,
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
- (byte)0xAA, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- (byte)0xAB, (byte)0x81, (byte)0x83,
- 0x30, (byte)0x81, (byte)0x80,
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f'
- });
+ {
+ 0x30, ( byte ) 0x82, 0x01, 0x57,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05,
+ 0x00, 0x01, 0x04, 0x00, 0x32,
+ ( byte ) 0xA1, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA3, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA4, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA6, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12,
+ ( byte ) 0xA9, 0x2E,
+ 0x30, 0x2C,
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
+ ( byte ) 0xAA, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ ( byte ) 0xAB, ( byte ) 0x81, ( byte ) 0x83,
+ 0x30, ( byte ) 0x81, ( byte ) 0x80,
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ } );
stream.flip();
// Allocate a KdcReqBody Container
Asn1Container kdcReqBodyContainer = new KdcReqBodyContainer( stream );
-
+
// Decode the KdcReqBody PDU
try
{
@@ -194,35 +194,37 @@ public class KdcReqBodyDecoderTest
}
KdcReqBody body = new KdcReqBody();
-
- body.setKdcOptions( new KdcOptions( new byte[]{0x00, 0x01, 0x04, 0x00, 0x32} ) );
+
+ body.setKdcOptions( new KdcOptions( new byte[]
+ { 0x00, 0x01, 0x04, 0x00, 0x32 } ) );
body.setCName( new PrincipalName( "client", PrincipalNameType.KRB_NT_ENTERPRISE ) );
body.setRealm( "EXAMPLE.COM" );
body.setSName( new PrincipalName( "server", PrincipalNameType.KRB_NT_ENTERPRISE ) );
-
+
body.setFrom( new KerberosTime( System.currentTimeMillis() ) );
body.setTill( new KerberosTime( System.currentTimeMillis() ) );
body.setRtime( new KerberosTime( System.currentTimeMillis() ) );
body.setNonce( 12345 );
-
+
body.addEType( EncryptionType.AES256_CTS_HMAC_SHA1_96 );
body.addEType( EncryptionType.DES3_CBC_MD5 );
body.addEType( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
-
+
HostAddresses addresses = new HostAddresses();
addresses.addHostAddress( new HostAddress( HostAddrType.ADDRTYPE_INET, "192.168.0.1".getBytes() ) );
addresses.addHostAddress( new HostAddress( HostAddrType.ADDRTYPE_INET, "192.168.0.2".getBytes() ) );
body.setAddresses( addresses );
- EncryptedData encAuthorizationData = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, "abcdef".getBytes() );
+ EncryptedData encAuthorizationData = new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96,
+ "abcdef".getBytes() );
body.setEncAuthorizationData( encAuthorizationData );
-
+
Ticket ticket1 = new Ticket();
ticket1.setTktVno( 5 );
ticket1.setRealm( "EXAMPLE.COM" );
ticket1.setSName( new PrincipalName( "client", PrincipalNameType.KRB_NT_PRINCIPAL ) );
ticket1.setEncPart( new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, "abcdef".getBytes() ) );
-
+
body.addAdditionalTicket( ticket1 );
Ticket ticket2 = new Ticket();
@@ -230,22 +232,22 @@ public class KdcReqBodyDecoderTest
ticket2.setRealm( "EXAMPLE.COM" );
ticket2.setSName( new PrincipalName( "server", PrincipalNameType.KRB_NT_PRINCIPAL ) );
ticket2.setEncPart( new EncryptedData( EncryptionType.AES128_CTS_HMAC_SHA1_96, "abcdef".getBytes() ) );
-
+
body.addAdditionalTicket( ticket2 );
-
+
// Check the encoding
int length = body.computeLength();
// Check the length
assertEquals( 0x15B, length );
-
+
// Check the encoding
ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = body.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x15B, encodedPdu.limit() );
}
@@ -254,18 +256,18 @@ public class KdcReqBodyDecoderTest
fail();
}
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ-BODY with nothing in it
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqBodyEmpty() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-
+
stream.put( new byte[]
{ 0x30, 0x00 } );
@@ -278,23 +280,23 @@ public class KdcReqBodyDecoderTest
kerberosDecoder.decode( stream, kdcReqBodyContainer );
fail();
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ-BODY with empty options tag
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqBodyEmptyOptionTag() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-
+
stream.put( new byte[]
- {
+ {
0x30, 0x02,
- (byte)0xA0, 0x00
- } );
+ ( byte ) 0xA0, 0x00
+ } );
stream.flip();
@@ -305,24 +307,24 @@ public class KdcReqBodyDecoderTest
kerberosDecoder.decode( stream, kdcReqBodyContainer );
fail();
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ-BODY with empty options value
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqBodyEmptyOptionValue() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x06 );
-
+
stream.put( new byte[]
- {
+ {
0x30, 0x04,
- (byte)0xA0, 0x02,
- 0x02, 0x00
- } );
+ ( byte ) 0xA0, 0x02,
+ 0x02, 0x00
+ } );
stream.flip();
@@ -333,125 +335,125 @@ public class KdcReqBodyDecoderTest
kerberosDecoder.decode( stream, kdcReqBodyContainer );
fail();
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ-BODY with no options
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqBodyNoOptions() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x152 );
-
+
stream.put( new byte[]
- {
- 0x30, (byte)0x82, 0x01, 0x4E,
- (byte)0xA1, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA3, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA4, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA6, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12,
- (byte)0xA9, 0x2E,
- 0x30, 0x2C,
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
- (byte)0xAA, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- (byte)0xAB, (byte)0x81, (byte)0x83,
- 0x30, (byte)0x81, (byte)0x80,
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f'
- });
+ {
+ 0x30, ( byte ) 0x82, 0x01, 0x4E,
+ ( byte ) 0xA1, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA3, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA4, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA6, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12,
+ ( byte ) 0xA9, 0x2E,
+ 0x30, 0x2C,
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
+ ( byte ) 0xAA, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ ( byte ) 0xAB, ( byte ) 0x81, ( byte ) 0x83,
+ 0x30, ( byte ) 0x81, ( byte ) 0x80,
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ } );
stream.flip();
@@ -474,35 +476,35 @@ public class KdcReqBodyDecoderTest
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x40 );
-
+
stream.put( new byte[]
- {
- 0x30, (byte)0x3E,
- (byte)0xA0, 0x07,
- 0x03, 0x05,
- 0x00, 0x01, 0x04, 0x00, 0x32,
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12
- });
+ {
+ 0x30, ( byte ) 0x3E,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05,
+ 0x00, 0x01, 0x04, 0x00, 0x32,
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12
+ } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a KdcReqBody Container
KdcReqBodyContainer kdcReqBodyContainer = new KdcReqBodyContainer( stream );
-
+
// Decode the KdcReqBody PDU
try
{
@@ -514,21 +516,21 @@ public class KdcReqBodyDecoderTest
}
KdcReqBody body = kdcReqBodyContainer.getKdcReqBody();
-
+
assertNotNull( body );
-
+
// Check the encoding
ByteBuffer bb = ByteBuffer.allocate( body.computeLength() );
try
{
bb = body.encode( bb );
-
+
// Check the length
assertEquals( 0x40, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
-
+ String encodedPdu = Strings.dumpBytes( bb.array() );
+
//assertEquals( decodedPdu, encodedPdu );
}
catch ( EncoderException ee )
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcReqDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -55,142 +55,142 @@ public class KdcReqDecoderTest
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x18F );
-
+
stream.put( new byte[]
- {
- 0x30, (byte)0x82, 0x01, (byte)0x8B,
- (byte)0xA1, 0x03,
+ {
+ 0x30, ( byte ) 0x82, 0x01, ( byte ) 0x8B,
+ ( byte ) 0xA1, 0x03,
0x02, 0x01, 0x05,
- (byte)0xA2, 0x03,
+ ( byte ) 0xA2, 0x03,
0x02, 0x01, 0x0A,
- (byte)0xA3, 0x20,
+ ( byte ) 0xA3, 0x20,
0x30, 0x1E,
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'a', 'b', 'c', 'd',
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'e', 'f', 'g', 'h',
- (byte)0xA4, (byte)0x82, 0x01, 0x5B,
- 0x30, (byte)0x82, 0x01, 0x57,
- (byte)0xA0, 0x07,
- 0x03, 0x05,
- 0x00, 0x01, 0x04, 0x00, 0x32,
- (byte)0xA1, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA3, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA4, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA6, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12,
- (byte)0xA9, 0x2E,
- 0x30, 0x2C,
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
- (byte)0xAA, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- (byte)0xAB, (byte)0x81, (byte)0x83,
- 0x30, (byte)0x81, (byte)0x80,
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f'
- });
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'a', 'b', 'c', 'd',
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'e', 'f', 'g', 'h',
+ ( byte ) 0xA4, ( byte ) 0x82, 0x01, 0x5B,
+ 0x30, ( byte ) 0x82, 0x01, 0x57,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05,
+ 0x00, 0x01, 0x04, 0x00, 0x32,
+ ( byte ) 0xA1, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA3, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA4, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA6, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12,
+ ( byte ) 0xA9, 0x2E,
+ 0x30, 0x2C,
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
+ ( byte ) 0xAA, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ ( byte ) 0xAB, ( byte ) 0x81, ( byte ) 0x83,
+ 0x30, ( byte ) 0x81, ( byte ) 0x80,
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ } );
stream.flip();
// Allocate a KdcReq Container
KdcReqContainer kdcReqContainer = new KdcReqContainer( stream );
kdcReqContainer.setKdcReq( new AsReq() );
-
+
// Decode the KdcReq PDU
try
{
@@ -202,20 +202,20 @@ public class KdcReqDecoderTest
}
KdcReq kdcReq = kdcReqContainer.getKdcReq();
-
+
// Check the encoding
int length = kdcReq.computeLength();
// Check the length
assertEquals( 0x193, length );
-
+
// Check the encoding
ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = kdcReq.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x193, encodedPdu.limit() );
}
@@ -224,18 +224,18 @@ public class KdcReqDecoderTest
fail();
}
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ with nothing in it
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqEmpty() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-
+
stream.put( new byte[]
{ 0x30, 0x00 } );
@@ -248,23 +248,23 @@ public class KdcReqDecoderTest
kerberosDecoder.decode( stream, kdcReqContainer );
fail();
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ with empty Pvno tag
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqEmptyPvnoTag() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-
+
stream.put( new byte[]
- {
+ {
0x30, 0x02,
- (byte)0xA1, 0x00
- } );
+ ( byte ) 0xA1, 0x00
+ } );
stream.flip();
@@ -275,24 +275,24 @@ public class KdcReqDecoderTest
kerberosDecoder.decode( stream, kdcReqContainer );
fail();
}
-
-
+
+
/**
* Test the decoding of a KDC-REQ with empty Pvno value
*/
- @Test( expected = DecoderException.class)
+ @Test(expected = DecoderException.class)
public void testKdcReqEmptyPvnoValue() throws DecoderException
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x06 );
-
+
stream.put( new byte[]
- {
+ {
0x30, 0x04,
- (byte)0xA1, 0x02,
- 0x02, 0x00
- } );
+ ( byte ) 0xA1, 0x02,
+ 0x02, 0x00
+ } );
stream.flip();
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KerberosMessageDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KerberosMessageDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KerberosMessageDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KerberosMessageDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -58,30 +58,47 @@ public class KerberosMessageDecoderTest
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x21 );
-
+
stream.put( new byte[]
- {
- 0x6F, 0x1F,
- 0x30, 0x1D,
- (byte)0xA0, 0x03, // pvno
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x03, // msg-type
- 0x02, 0x01, 0x0F,
- (byte)0xA2, 0x11, // enc-part
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- });
+ {
+ 0x6F, 0x1F,
+ 0x30, 0x1D,
+ ( byte ) 0xA0, 0x03, // pvno
+ 0x02,
+ 0x01,
+ 0x05,
+ ( byte ) 0xA1,
+ 0x03, // msg-type
+ 0x02,
+ 0x01,
+ 0x0F,
+ ( byte ) 0xA2,
+ 0x11, // enc-part
+ 0x30,
+ 0x0F,
+ ( byte ) 0xA0,
+ 0x03,
+ 0x02,
+ 0x01,
+ 0x11,
+ ( byte ) 0xA2,
+ 0x08,
+ 0x04,
+ 0x06,
+ 'a',
+ 'b',
+ 'c',
+ 'd',
+ 'e',
+ 'f',
+ } );
stream.flip();
// Allocate a KerberosMessage Container
KerberosMessageContainer kerberosMessageContainer = new KerberosMessageContainer();
kerberosMessageContainer.setStream( stream );
-
+
// Decode the ApRep PDU
try
{
@@ -92,21 +109,21 @@ public class KerberosMessageDecoderTest
fail( de.getMessage() );
}
- ApRep apRep = (ApRep)kerberosMessageContainer.getMessage();
-
+ ApRep apRep = ( ApRep ) kerberosMessageContainer.getMessage();
+
// Check the encoding
int length = apRep.computeLength();
// Check the length
assertEquals( 0x21, length );
-
+
// Check the encoding
ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = apRep.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x21, encodedPdu.limit() );
}
@@ -114,145 +131,145 @@ public class KerberosMessageDecoderTest
{
fail();
}
-
+
// Now try to decode a TGS-REQ
stream = ByteBuffer.allocate( 0x193 );
stream.put( new byte[]
- {
- 0x6C, (byte)0x82, 0x01, (byte)0x8F,
- 0x30, (byte)0x82, 0x01, (byte)0x8B,
- (byte)0xA1, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA2, 0x03,
- 0x02, 0x01, 0x0C,
- (byte)0xA3, 0x20,
- 0x30, 0x1E,
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'a', 'b', 'c', 'd',
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'e', 'f', 'g', 'h',
- (byte)0xA4, (byte)0x82, 0x01, 0x5B,
- 0x30, (byte)0x82, 0x01, 0x57,
- (byte)0xA0, 0x07,
- 0x03, 0x05,
- 0x00, 0x01, 0x04, 0x00, 0x32,
- (byte)0xA1, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA3, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA4, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA6, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12,
- (byte)0xA9, 0x2E,
- 0x30, 0x2C,
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
- (byte)0xAA, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- (byte)0xAB, (byte)0x81, (byte)0x83,
- 0x30, (byte)0x81, (byte)0x80,
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f'
- });
+ {
+ 0x6C, ( byte ) 0x82, 0x01, ( byte ) 0x8F,
+ 0x30, ( byte ) 0x82, 0x01, ( byte ) 0x8B,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA2, 0x03,
+ 0x02, 0x01, 0x0C,
+ ( byte ) 0xA3, 0x20,
+ 0x30, 0x1E,
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'a', 'b', 'c', 'd',
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'e', 'f', 'g', 'h',
+ ( byte ) 0xA4, ( byte ) 0x82, 0x01, 0x5B,
+ 0x30, ( byte ) 0x82, 0x01, 0x57,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05,
+ 0x00, 0x01, 0x04, 0x00, 0x32,
+ ( byte ) 0xA1, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA3, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA4, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA6, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12,
+ ( byte ) 0xA9, 0x2E,
+ 0x30, 0x2C,
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
+ ( byte ) 0xAA, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ ( byte ) 0xAB, ( byte ) 0x81, ( byte ) 0x83,
+ 0x30, ( byte ) 0x81, ( byte ) 0x80,
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ } );
stream.flip();
// Allocate a TgsReq Container
TgsReqContainer tgsReqContainer = new TgsReqContainer( stream );
-
+
// Decode the TgsReq PDU
try
{
@@ -264,22 +281,22 @@ public class KerberosMessageDecoderTest
}
TgsReq tgsReq = tgsReqContainer.getTgsReq();
-
+
assertTrue( tgsReq instanceof TgsReq );
-
+
// Check the encoding
length = tgsReq.computeLength();
// Check the length
assertEquals( 0x193, length );
-
+
// Check the encoding
encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = tgsReq.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x193, encodedPdu.limit() );
}
@@ -290,141 +307,141 @@ public class KerberosMessageDecoderTest
// Now decode AS-REQ
stream = ByteBuffer.allocate( 0x193 );
-
+
stream.put( new byte[]
- {
- 0x6A, (byte)0x82, 0x01, (byte)0x8F,
- 0x30, (byte)0x82, 0x01, (byte)0x8B,
- (byte)0xA1, 0x03,
+ {
+ 0x6A, ( byte ) 0x82, 0x01, ( byte ) 0x8F,
+ 0x30, ( byte ) 0x82, 0x01, ( byte ) 0x8B,
+ ( byte ) 0xA1, 0x03,
0x02, 0x01, 0x05,
- (byte)0xA2, 0x03,
+ ( byte ) 0xA2, 0x03,
0x02, 0x01, 0x0A,
- (byte)0xA3, 0x20,
+ ( byte ) 0xA3, 0x20,
0x30, 0x1E,
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'a', 'b', 'c', 'd',
- 0x30, 0x0D,
- (byte)0xA1,0x03,
- 0x02, 0x01, 01,
- (byte)0xA2, 0x06,
- 0x04, 0x04, 'e', 'f', 'g', 'h',
- (byte)0xA4, (byte)0x82, 0x01, 0x5B,
- 0x30, (byte)0x82, 0x01, 0x57,
- (byte)0xA0, 0x07,
- 0x03, 0x05,
- 0x00, 0x01, 0x04, 0x00, 0x32,
- (byte)0xA1, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA3, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA4, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA6, 0x11,
- 0x18, 0x0F,
- '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
- (byte)0xA7, 0x04,
- 0x02, 0x02,
- 0x30, 0x39,
- (byte)0xA8, 0x0B,
- 0x30, 0x09,
- 0x02, 0x01, 0x06,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12,
- (byte)0xA9, 0x2E,
- 0x30, 0x2C,
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
- 0x30, 0x14,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x0D,
- 0x04, 0x0B,
- '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
- (byte)0xAA, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- (byte)0xAB, (byte)0x81, (byte)0x83,
- 0x30, (byte)0x81, (byte)0x80,
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 'c', 'l', 'i', 'e', 'n', 't',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f',
- 0x61, 0x3E,
- 0x30, 0x3C,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA1, 0x0D,
- 0x1B, 0x0B,
- 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
- (byte)0xA2, 0x13,
- 0x30, 0x11,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0A,
- 0x30, 0x08,
- 0x1B, 0x06,
- 's', 'e', 'r', 'v', 'e', 'r',
- (byte)0xA3, 0x11,
- 0x30, 0x0F,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x11,
- (byte)0xA2, 0x08,
- 0x04, 0x06,
- 'a', 'b', 'c', 'd', 'e', 'f'
- });
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'a', 'b', 'c', 'd',
+ 0x30, 0x0D,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 01,
+ ( byte ) 0xA2, 0x06,
+ 0x04, 0x04, 'e', 'f', 'g', 'h',
+ ( byte ) 0xA4, ( byte ) 0x82, 0x01, 0x5B,
+ 0x30, ( byte ) 0x82, 0x01, 0x57,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05,
+ 0x00, 0x01, 0x04, 0x00, 0x32,
+ ( byte ) 0xA1, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA3, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA4, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA6, 0x11,
+ 0x18, 0x0F,
+ '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
+ ( byte ) 0xA7, 0x04,
+ 0x02, 0x02,
+ 0x30, 0x39,
+ ( byte ) 0xA8, 0x0B,
+ 0x30, 0x09,
+ 0x02, 0x01, 0x06,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12,
+ ( byte ) 0xA9, 0x2E,
+ 0x30, 0x2C,
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+ 0x30, 0x14,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x0D,
+ 0x04, 0x0B,
+ '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
+ ( byte ) 0xAA, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ ( byte ) 0xAB, ( byte ) 0x81, ( byte ) 0x83,
+ 0x30, ( byte ) 0x81, ( byte ) 0x80,
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 'c', 'l', 'i', 'e', 'n', 't',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ 0x61, 0x3E,
+ 0x30, 0x3C,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA1, 0x0D,
+ 0x1B, 0x0B,
+ 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
+ ( byte ) 0xA2, 0x13,
+ 0x30, 0x11,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0A,
+ 0x30, 0x08,
+ 0x1B, 0x06,
+ 's', 'e', 'r', 'v', 'e', 'r',
+ ( byte ) 0xA3, 0x11,
+ 0x30, 0x0F,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x11,
+ ( byte ) 0xA2, 0x08,
+ 0x04, 0x06,
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ } );
stream.flip();
// Allocate a AsReq Container
AsReqContainer asReqContainer = new AsReqContainer( stream );
-
+
// Decode the AsReq PDU
try
{
@@ -436,22 +453,22 @@ public class KerberosMessageDecoderTest
}
AsReq asReq = asReqContainer.getAsReq();
-
+
assertTrue( asReq instanceof AsReq );
-
+
// Check the encoding
length = asReq.computeLength();
// Check the length
assertEquals( 0x193, length );
-
+
// Check the encoding
encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = asReq.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x193, encodedPdu.limit() );
}
@@ -459,64 +476,64 @@ public class KerberosMessageDecoderTest
{
fail();
}
-
+
// Now decode AS-REQ
stream = ByteBuffer.allocate( 0x97 );
-
+
stream.put( new byte[]
- {
- 0x6A, (byte)0x81, (byte)0x94,
- 0x30, (byte)0x81, (byte)0x91,
- (byte)0xA1, 0x03,
- 0x02, 0x01, 0x05,
- (byte)0xA2, 0x03,
- 0x02, 0x01, 0x0A,
- (byte)0xA4, (byte)0x81, (byte)0x84,
- 0x30, (byte)0x81, (byte)0x81,
- (byte)0xA0, 0x07,
- 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
- (byte)0xA1, 0x14,
- 0x30, 0x12,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x01,
- (byte)0xA1, 0x0B,
- 0x30, 0x09,
- 0x1B, 0x07,
- 0x68, 0x6E, 0x65, 0x6C, 0x73, 0x6F, 0x6E,
- (byte)0xA2, 0x0D,
- 0x1B, 0x0B,
- 0x45, 0x58, 0x41, 0x4D, 0x50, 0x4C, 0x45, 0x2E, 0x43, 0x4F, 0x4D,
- (byte)0xA3, 0x20,
- 0x30, 0x1E,
- (byte)0xA0, 0x03,
- 0x02, 0x01, 0x02,
- (byte)0xA1, 0x17,
- 0x30, 0x15,
- 0x1B, 0x06,
- 0x6B, 0x72, 0x62, 0x74, 0x67, 0x74,
- 0x1B, 0x0B,
- 0x45, 0x58, 0x41, 0x4D, 0x50, 0x4C, 0x45, 0x2E, 0x43, 0x4F, 0x4D,
- (byte)0xA5, 0x11,
- 0x18, 0x0F,
- 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A,
- (byte)0xA7, 0x06,
- 0x02, 0x04,
- 0x4C, (byte)0xF5, (byte)0x8E, (byte)0xCA,
- (byte)0xA8, 0x14,
- 0x30, 0x12,
- 0x02, 0x01, 0x03,
- 0x02, 0x01, 0x01,
- 0x02, 0x01, 0x17,
- 0x02, 0x01, 0x10,
- 0x02, 0x01, 0x11,
- 0x02, 0x01, 0x12
+ {
+ 0x6A, ( byte ) 0x81, ( byte ) 0x94,
+ 0x30, ( byte ) 0x81, ( byte ) 0x91,
+ ( byte ) 0xA1, 0x03,
+ 0x02, 0x01, 0x05,
+ ( byte ) 0xA2, 0x03,
+ 0x02, 0x01, 0x0A,
+ ( byte ) 0xA4, ( byte ) 0x81, ( byte ) 0x84,
+ 0x30, ( byte ) 0x81, ( byte ) 0x81,
+ ( byte ) 0xA0, 0x07,
+ 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ ( byte ) 0xA1, 0x14,
+ 0x30, 0x12,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x01,
+ ( byte ) 0xA1, 0x0B,
+ 0x30, 0x09,
+ 0x1B, 0x07,
+ 0x68, 0x6E, 0x65, 0x6C, 0x73, 0x6F, 0x6E,
+ ( byte ) 0xA2, 0x0D,
+ 0x1B, 0x0B,
+ 0x45, 0x58, 0x41, 0x4D, 0x50, 0x4C, 0x45, 0x2E, 0x43, 0x4F, 0x4D,
+ ( byte ) 0xA3, 0x20,
+ 0x30, 0x1E,
+ ( byte ) 0xA0, 0x03,
+ 0x02, 0x01, 0x02,
+ ( byte ) 0xA1, 0x17,
+ 0x30, 0x15,
+ 0x1B, 0x06,
+ 0x6B, 0x72, 0x62, 0x74, 0x67, 0x74,
+ 0x1B, 0x0B,
+ 0x45, 0x58, 0x41, 0x4D, 0x50, 0x4C, 0x45, 0x2E, 0x43, 0x4F, 0x4D,
+ ( byte ) 0xA5, 0x11,
+ 0x18, 0x0F,
+ 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A,
+ ( byte ) 0xA7, 0x06,
+ 0x02, 0x04,
+ 0x4C, ( byte ) 0xF5, ( byte ) 0x8E, ( byte ) 0xCA,
+ ( byte ) 0xA8, 0x14,
+ 0x30, 0x12,
+ 0x02, 0x01, 0x03,
+ 0x02, 0x01, 0x01,
+ 0x02, 0x01, 0x17,
+ 0x02, 0x01, 0x10,
+ 0x02, 0x01, 0x11,
+ 0x02, 0x01, 0x12
} );
stream.flip();
// Allocate a AsReq Container
asReqContainer = new AsReqContainer( stream );
-
+
// Decode the AsReq PDU
try
{
@@ -528,22 +545,22 @@ public class KerberosMessageDecoderTest
}
asReq = asReqContainer.getAsReq();
-
+
assertTrue( asReq instanceof AsReq );
-
+
// Check the encoding
length = asReq.computeLength();
// Check the length
assertEquals( 0x97, length );
-
+
// Check the encoding
encodedPdu = ByteBuffer.allocate( length );
-
+
try
{
encodedPdu = asReq.encode( encodedPdu );
-
+
// Check the length
assertEquals( 0x97, encodedPdu.limit() );
}
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbCredDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbCredDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbCredDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbCredDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
package org.apache.directory.shared.kerberos.codec;
+
import static org.junit.Assert.assertEquals;
import java.nio.ByteBuffer;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.kerbe
import org.apache.directory.shared.kerberos.messages.Ticket;
import org.junit.Test;
+
/**
* Test cases for KrbCred codec
*
@@ -46,38 +48,39 @@ public class KrbCredDecoderTest
@Test
public void testDecodeKrebCred() throws Exception
{
- EncryptedData encPart = new EncryptedData( EncryptionType.DES3_CBC_MD5, 0, new byte[]{ 0, 1 } );
+ EncryptedData encPart = new EncryptedData( EncryptionType.DES3_CBC_MD5, 0, new byte[]
+ { 0, 1 } );
PrincipalName pName = new PrincipalName( "pname", PrincipalNameType.KRB_NT_PRINCIPAL );
-
+
String realm = "ticketRealm";
Ticket t1 = new Ticket( pName, encPart );
t1.setRealm( realm );
-
+
Ticket t2 = new Ticket( pName, encPart );
t2.setRealm( realm );
-
+
List<Ticket> tickets = new ArrayList<Ticket>();
tickets.add( t1 );
tickets.add( t2 );
-
+
KrbCred expected = new KrbCred();
expected.setTickets( tickets );
expected.setEncPart( encPart );
-
+
int krbCredLen = expected.computeLength();
ByteBuffer stream = ByteBuffer.allocate( krbCredLen );
-
+
expected.encode( stream );
stream.flip();
-
+
KrbCredContainer container = new KrbCredContainer( stream );
-
+
Asn1Decoder decoder = new Asn1Decoder();
-
+
decoder.decode( stream, container );
-
+
KrbCred actual = container.getKrbCred();
-
+
assertEquals( expected.getProtocolVersionNumber(), actual.getProtocolVersionNumber() );
assertEquals( expected.getMessageType(), actual.getMessageType() );
assertEquals( expected.getTickets(), actual.getTickets() );