diff options
author | Popescu, Serban <serban.popescu@amdocs.com> | 2019-01-14 09:12:02 -0500 |
---|---|---|
committer | Serban Popescu <serban.popescu@amdocs.com> | 2019-01-14 09:14:27 -0500 |
commit | b6b7262ae3939a19856843761882bf04fc09bb26 (patch) | |
tree | e7376a96cdee5ad05d3333978aa340a800102e71 | |
parent | 57e7ef7a5b1a20b6237c78f3a85a9b4bb5aefa54 (diff) |
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 <serban.popescu@amdocs.com>
-rw-r--r-- | sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java | 4 |
1 files changed, 3 insertions, 1 deletions
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()); } |