decryptValue static method
Implementation
static String decryptValue(String encryptedValue, String decryptionKey,
{String? ivBase64}) {
try {
var aesKey = AES(Key.fromBase64(decryptionKey));
var decrypter = Encrypter(aesKey);
return decrypter.decrypt64(encryptedValue, iv: getIV(ivBase64));
} on Exception catch (e, trace) {
_logger
.severe('Exception while decrypting value: ${e.toString()} $trace');
throw AtKeyException(e.toString());
} on Error catch (e) {
// Catching error since underlying decryption library may throw Error e.g corrupt pad block
_logger.severe('Error while decrypting value: ${e.toString()}');
throw AtKeyException(e.toString(),
intent: Intent.decryptData,
exceptionScenario: ExceptionScenario.decryptionFailed);
}
}