Skip to content

Commit

Permalink
Fixed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: ase-101 <[email protected]>
  • Loading branch information
ase-101 committed Jan 25, 2024
1 parent 045a314 commit b509612
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b509612

Please sign in to comment.