* @throws KerberosException
*/
public Ticket getTicket( KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal,
EncryptionKey serverKey ) throws KerberosException
{
EncTicketPartModifier encTicketModifier = new EncTicketPartModifier();
TicketFlags ticketFlags = new TicketFlags();
ticketFlags.setFlag( TicketFlag.RENEWABLE );
encTicketModifier.setFlags( ticketFlags );
EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.DES_CBC_MD5 );
encTicketModifier.setSessionKey( sessionKey );
encTicketModifier.setClientPrincipal( clientPrincipal );
encTicketModifier.setTransitedEncoding( new TransitedEncoding() );
encTicketModifier.setAuthTime( new KerberosTime() );
long now = System.currentTimeMillis();
KerberosTime endTime = new KerberosTime( now + ONE_DAY );
encTicketModifier.setEndTime( endTime );
KerberosTime renewTill = new KerberosTime( now + ONE_WEEK );
encTicketModifier.setRenewTill( renewTill );
EncTicketPart encTicketPart = encTicketModifier.getEncTicketPart();
EncryptedData encryptedTicketPart = cipherTextHandler.seal( serverKey, encTicketPart, KeyUsage.NUMBER2 );
Ticket ticket = new Ticket();
ticket.setTktVno( KerberosConstants.KERBEROS_V5 );