From b509612d13ff54d4a67b4a74679253c20d08d50f Mon Sep 17 00:00:00 2001 From: ase-101 Date: Thu, 25 Jan 2024 13:33:34 +0530 Subject: [PATCH] Fixed review comments Signed-off-by: ase-101 --- .../main/java/io/mosip/signup/helper/CryptoHelper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/signup-service/src/main/java/io/mosip/signup/helper/CryptoHelper.java b/signup-service/src/main/java/io/mosip/signup/helper/CryptoHelper.java index c7ed6c38..a405d442 100644 --- a/signup-service/src/main/java/io/mosip/signup/helper/CryptoHelper.java +++ b/signup-service/src/main/java/io/mosip/signup/helper/CryptoHelper.java @@ -27,6 +27,12 @@ public class CryptoHelper { @Value("${mosip.signup.cache.symmetric-algorithm-name}") private String symmetricAlgorithm; + @Value("${mosip.signup.cache.symmetric-key.algorithm-name:AES}") + private String symmetricKeyAlgorithm; + + @Value("${mosip.signup.cache.symmetric-key.size:256}") + private int symmetricKeySize; + @Autowired private CacheUtilService cacheUtilService; @@ -94,8 +100,8 @@ private String getActiveKeyAlias() { private void generateSecretKey(String alias) { try { - KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); - keyGenerator.init(256); + KeyGenerator keyGenerator = KeyGenerator.getInstance(symmetricKeyAlgorithm); + keyGenerator.init(symmetricKeySize); cacheUtilService.setSecretKey(alias, IdentityProviderUtil.b64Encode(keyGenerator.generateKey().getEncoded())); cacheUtilService.setActiveKeyAlias(ALIAS_CACHE_KEY, alias); } catch (NoSuchAlgorithmException e) {