KerberosKey kerberosKey = new KerberosKey( principal, "secret".toCharArray(), "AES128" );
EncryptionKey key = new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, kerberosKey.getEncoded() );
String zuluTime = "20070410190400Z";
int microSeconds = 460450;
PaEncTsEnc encryptedTimeStamp = getEncryptedTimeStamp( zuluTime, microSeconds );
EncryptedData encryptedData = null;
try
{
encryptedData = lockBox.seal( key, encryptedTimeStamp, KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );
}
catch ( KerberosException ke )
{
fail( "Should not have caught exception." );
}
try
{
byte[] paEncTsEncData = lockBox.decrypt( key, encryptedData, KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );
PaEncTsEnc object = KerberosDecoder.decodePaEncTsEnc( paEncTsEncData );
assertEquals( "TimeStamp", "20070410190400Z", object.getPaTimestamp().toString() );
assertEquals( "MicroSeconds", 460450, object.getPausec() );
}
catch ( KerberosException ke )
{
fail( "Should not have caught exception." );
}