diff --git a/src/main/java/com/knecon/fforesight/tenantcommons/EncryptionDecryptionService.java b/src/main/java/com/knecon/fforesight/tenantcommons/EncryptionDecryptionService.java index 8d45d32..0a5e70a 100644 --- a/src/main/java/com/knecon/fforesight/tenantcommons/EncryptionDecryptionService.java +++ b/src/main/java/com/knecon/fforesight/tenantcommons/EncryptionDecryptionService.java @@ -53,7 +53,11 @@ public class EncryptionDecryptionService { @SneakyThrows public String encrypt(String strToEncrypt) { - return Base64.getEncoder().encodeToString(encrypt(strToEncrypt.getBytes())); + if (strToEncrypt != null) { + return Base64.getEncoder().encodeToString(encrypt(strToEncrypt.getBytes())); + } + return null; + } @@ -75,6 +79,10 @@ public class EncryptionDecryptionService { @SneakyThrows public String decrypt(String strToDecrypt) { + if (strToDecrypt == null) { + return null; + } + byte[] bytes = Base64.getDecoder().decode(strToDecrypt); return new String(decrypt(bytes), StandardCharsets.UTF_8); }