| {
@Test
public void testDecodeChangePasswdData() throws Exception
{
Asn1Decoder decoder = new Asn1Decoder();
ByteBuffer buf = ByteBuffer.allocate( 0x30 );
buf.put( new byte[]
{
0x30, 0x2E,
( byte ) 0xA0, 0x08, // newpasswd
0x04,
0x06,
's',
'e',
'c',
'r',
'e',
't',
( byte ) 0xA1,
0x13, // targname
0x30,
0x11,
( byte ) 0xA0,
0x03, // name-type
0x02,
0x01,
0x01, // NT-PRINCIPAL
( byte ) 0xA1,
0x0A, // name-string
0x30,
0x08,
0x1B,
0x06,
'k',
'r',
'b',
't',
'g',
't',
( byte ) 0xA2,
0x0D,
0x1B,
0x0B,
'E',
'X',
'A',
'M',
'P',
'L',
'E',
'.',
'C',
'O',
'M'
} );
String decodedPdu = Strings.dumpBytes( buf.array() );
buf.flip();
ChangePasswdDataContainer container = new ChangePasswdDataContainer( buf );
decoder.decode( buf, container );
ChangePasswdData chngPwdData = container.getChngPwdData();
assertArrayEquals( "secret".getBytes(), chngPwdData.getNewPasswd() );
assertEquals( "krbtgt", chngPwdData.getTargName().getNameString() );
|