}
private static void buildReply( ChangePasswordContext changepwContext ) throws KerberosException, UnknownHostException
{
Authenticator authenticator = changepwContext.getAuthenticator();
Ticket ticket = changepwContext.getTicket();
CipherTextHandler cipherTextHandler = changepwContext.getCipherTextHandler();
// begin building reply
// create priv message
// user-data component is short result code
EncKrbPrivPartModifier modifier = new EncKrbPrivPartModifier();
byte[] resultCode =
{ ( byte ) 0x00, ( byte ) 0x00 };
modifier.setUserData( resultCode );
modifier.setSenderAddress( new HostAddress( InetAddress.getLocalHost() ) );
EncKrbPrivPart privPart = modifier.getEncKrbPrivPart();
// get the subsession key from the Authenticator
EncryptionKey subSessionKey = authenticator.getSubSessionKey();
EncryptedData encPrivPart;
try
{
encPrivPart = cipherTextHandler.seal( subSessionKey, privPart, KeyUsage.NUMBER13 );
}
catch ( KerberosException ke )
{
throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ke );
}
PrivateMessage privateMessage = new PrivateMessage( encPrivPart );
// Begin AP_REP generation
EncApRepPartModifier encApModifier = new EncApRepPartModifier();
encApModifier.setClientTime( authenticator.getClientTime() );
encApModifier.setClientMicroSecond( authenticator.getClientMicroSecond() );
encApModifier.setSequenceNumber( new Integer( authenticator.getSequenceNumber() ) );
encApModifier.setSubSessionKey( authenticator.getSubSessionKey() );
EncApRepPart repPart = encApModifier.getEncApRepPart();
EncryptedData encRepPart;