From 51c375bb43e9336311cd5e1682277f460215f924 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 28 Feb 2023 10:56:54 +0100 Subject: [PATCH] fixed error handling --- .../institution/impl/SecurityKeyServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java index ea37640d..1112ccda 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/institution/impl/SecurityKeyServiceImpl.java @@ -180,10 +180,14 @@ public class SecurityKeyServiceImpl implements SecurityKeyService { return Cryptor .decrypt(appSignatureKey + salt, connectionToken) .onErrorDo(error -> { + log.warn( "Failed to decrypt ASK with added salt value. Try to decrypt without added salt. Error: {}", error.getMessage()); - return Cryptor.decrypt(appSignatureKey, connectionToken).get(); + + return Cryptor + .decrypt(appSignatureKey, connectionToken) + .getOrThrow(); }) .map(signature -> createSignatureHash(signature));