{
throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_REQUIRED,
preparePreAuthenticationError( config.getEncryptionTypes() ) );
}
EncryptedTimeStamp timestamp = null;
for ( int ii = 0; ii < preAuthData.length; ii++ )
{
if ( preAuthData[ii].getPaDataType().equals( PaDataType.PA_ENC_TIMESTAMP ) )
{
EncryptedData dataValue;
try
{
dataValue = EncryptedDataDecoder.decode( preAuthData[ii].getPaDataValue() );
}
catch ( IOException ioe )
{
throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, ioe );
}
catch ( ClassCastException cce )
{
throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, cce );
}
timestamp = ( EncryptedTimeStamp ) cipherTextHandler.unseal( EncryptedTimeStamp.class,
clientKey, dataValue, KeyUsage.NUMBER1 );
}
}
if ( preAuthData.length > 0 && timestamp == null )
{
throw new KerberosException( ErrorType.KDC_ERR_PADATA_TYPE_NOSUPP );
}
if ( timestamp == null )
{
throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_REQUIRED,
preparePreAuthenticationError( config.getEncryptionTypes() ) );
}
if ( !timestamp.getTimeStamp().isInClockSkew( config.getAllowableClockSkew() ) )
{
throw new KerberosException( ErrorType.KDC_ERR_PREAUTH_FAILED );
}
/*