catch ( DecoderException de )
{
fail( de.getMessage() );
}
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() );
}
catch ( EncoderException ee )
{
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
} );
stream.flip();
// Allocate a AsReq Container
asReqContainer = new AsReqContainer( stream );
// Decode the AsReq PDU
try
{
kerberosDecoder.decode( stream, asReqContainer );
}
catch ( DecoderException de )
{
fail( de.getMessage() );
}
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() );
}
catch ( EncoderException ee )