KdcReqBody body = new KdcReqBody();
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() );
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();
ticket2.setTktVno( 5 );
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