| * Test the decoding of a PrincipalName
*/
@Test
public void testPrincipalName()
{
Asn1Decoder kerberosDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x29 );
stream.put( new byte[]
{ 0x30, 0x27,
( byte ) 0xA0, 0x03, // name-type
0x02,
0x01,
0x01, // NT-PRINCIPAL
( byte ) 0xA1,
0x20, // name-string
0x30,
0x1E,
0x1B,
0x08,
'h',
'n',
'e',
'l',
's',
'o',
'n',
'1',
0x1B,
0x08,
'h',
'n',
'e',
'l',
's',
'o',
'n',
'2',
0x1B,
0x08,
'h',
'n',
'e',
'l',
's',
'o',
'n',
'3',
} );
String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a PrincipalName Container
Asn1Container principalNameContainer = new PrincipalNameContainer();
// Decode the PrincipalName PDU
try
{
kerberosDecoder.decode( stream, principalNameContainer );
}
catch ( DecoderException de )
{
fail( de.getMessage() );
}
|