From b6b7262ae3939a19856843761882bf04fc09bb26 Mon Sep 17 00:00:00 2001 From: "Popescu, Serban" Date: Mon, 14 Jan 2019 09:12:02 -0500 Subject: Do not attempt to decrypt unobfuscated passwords Passwords can be either encrypted or not, only decrypt when obfuscated Change-Id: I274f34d99fb559d0694d3c0ade0c61755c3d1b6d Issue-ID: AAI-2072 Signed-off-by: Serban Popescu --- .../src/main/java/org/onap/aai/sparky/util/Encryptor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java index bb9ceec..a239b36 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java @@ -36,6 +36,8 @@ import org.onap.aai.sparky.logging.AaiUiMsgs; public class Encryptor { private static final Logger LOG = LoggerFactory.getInstance().getLogger(Encryptor.class); + private static final String PWD_OBFUSCATION_PATTERN = "OBF:"; + /** * Instantiates a new encryptor. */ @@ -67,7 +69,7 @@ public class Encryptor { public String decryptValue(String value) { String decyptedValue = ""; try { - decyptedValue = Password.deobfuscate(value); + decyptedValue = value.startsWith(PWD_OBFUSCATION_PATTERN)? Password.deobfuscate(value) : value; } catch (Exception exc) { LOG.error(AaiUiMsgs.DECRYPTION_ERROR, value, exc.toString()); } -- cgit 1.2.3-korg