if (subject != null)
{
try
{
// Decrypt the authentication request.
final AuthenticationRequestImpl authRequest = (AuthenticationRequestImpl) PublicCryptoUtil.INSTANCE.decrypt(encryptedAuthRequest);
// Get all public credentials from the authentication request.
final Set credentials = authRequest.getCredentials();
// Add all of the Subjects public credentials to the authentication request
credentials.addAll(subject.getPublicCredentials());
// "Re-encrypt" the updated authRequest.
byte[] encrypt = PublicCryptoUtil.INSTANCE.encrypt(authRequest);
encryptedAuthRequest = encrypt;