{
fail( de.getMessage() );
}
// Check the decoded AdKdcIssued
AdKdcIssued adKdcIssued = ( ( AdKdcIssuedContainer ) adKdcIssuedContainer).getAdKdcIssued();
Checksum checksum = adKdcIssued.getAdChecksum();
assertEquals( ChecksumType.getTypeByValue( 2 ), checksum.getChecksumType() );
assertTrue( Arrays.equals( Strings.getBytesUtf8("chksum"), checksum.getChecksumValue() ) );
assertEquals( "EXAMPLE.COM", adKdcIssued.getIRealm() );
PrincipalName principalName = adKdcIssued.getISName();
assertNotNull( principalName );
assertEquals( PrincipalNameType.KRB_NT_PRINCIPAL, principalName.getNameType() );
assertTrue( principalName.getNames().contains( "hnelson" ) );
AuthorizationData authData = adKdcIssued.getElements();
assertNotNull( authData.getAuthorizationData().size() );
assertEquals( 2, authData.getAuthorizationData().size() );
String[] expected = new String[]{ "abcdef", "ghijkl" };
int i = 0;
for ( AuthorizationDataEntry ad : authData.getAuthorizationData() )
{
assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
assertTrue( Arrays.equals( Strings.getBytesUtf8(expected[i++]), ad.getAdData() ) );
}
ByteBuffer bb = ByteBuffer.allocate( adKdcIssued.computeLength() );
// Check the encoding
try
{
bb = adKdcIssued.encode( bb );
// Check the length
assertEquals( 0x60, bb.limit() );
String encodedPdu = Strings.dumpBytes(bb.array());