encryptedPassword = encrypter.encrypt(passwordBytes);
node.putValue(key, encryptedPassword, new PreferenceKeyMetadata<>(byte[].class));
}
catch (EncryptionOperationNotPossibleException e)
{
throw new PreferencesException("Failed to encrypt password: " + e, e);
}
catch (UserAbortedEnteringPasswordException e)
{
//Could be thrown if the encrypter is a sourced encrypter
//In this case, treat as a cancel
return(null);
}
}
else
{
try
{
passwordBytes = encrypter.decrypt(encryptedPassword);
}
catch (EncryptionOperationNotPossibleException e)
{
throw new PreferencesException("Failed to decrypt password: " + e, e);
}
catch (UserAbortedEnteringPasswordException e)
{
//Could be thrown if the encrypter is a sourced encrypter
//In this case, treat as a cancel