encTicketPart.setFlags( ticketFlags );
EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.DES_CBC_MD5 );
encTicketPart.setKey( sessionKey );
encTicketPart.setCName( new PrincipalName( clientPrincipal.getName(), PrincipalNameType.KRB_NT_PRINCIPAL ) );
encTicketPart.setTransited( new TransitedEncoding() );
encTicketPart.setAuthTime( new KerberosTime() );
long now = System.currentTimeMillis();
KerberosTime endTime = new KerberosTime( now + ONE_DAY );
encTicketPart.setEndTime( endTime );
KerberosTime renewTill = new KerberosTime( now + ONE_WEEK );
encTicketPart.setRenewTill( renewTill );
EncryptedData encryptedTicketPart = cipherTextHandler.seal( serverKey, encTicketPart, KeyUsage.AS_OR_TGS_REP_TICKET_WITH_SRVKEY );
Ticket ticket = new Ticket();
ticket.setTktVno( KerberosConstants.KERBEROS_V5 );
ticket.setSName( new PrincipalName( serverPrincipal.getName(), PrincipalNameType.KRB_NT_PRINCIPAL ) );
ticket.setRealm( serverPrincipal.getRealm() );
ticket.setEncPart( encryptedTicketPart );
return ticket;
}