encTicketPart.setFlags( ticketFlags );
EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.DES_CBC_MD5 );
encTicketPart.setKey( sessionKey );
encTicketPart.setCName( new PrincipalName( clientPrincipal ) );
encTicketPart.setCRealm( clientPrincipal.getRealm() );
encTicketPart.setTransited( new TransitedEncoding() );
encTicketPart.setAuthTime( new KerberosTime() );
long now = System.currentTimeMillis();
KerberosTime endTime = new KerberosTime( now + KerberosTime.DAY );
encTicketPart.setEndTime( endTime );
KerberosTime renewTill = new KerberosTime( now + KerberosTime.WEEK );
encTicketPart.setRenewTill( renewTill );
EncryptedData encryptedTicketPart = lockBox.seal( serverKey, encTicketPart,
KeyUsage.AS_OR_TGS_REP_TICKET_WITH_SRVKEY );
Ticket ticket = new Ticket();
ticket.setSName( new PrincipalName( serverPrincipal.getName(), serverPrincipal.getNameType() ) );
ticket.setRealm( serverPrincipal.getRealm() );
ticket.setEncPart( encryptedTicketPart );
ticket.setEncTicketPart( encTicketPart );