diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml
index 7e69c7d236f..4828cea68ea 100644
--- a/authentication-demo-service/pom.xml
+++ b/authentication-demo-service/pom.xml
@@ -48,7 +48,7 @@
0.8.2
true
- 1.2.0.1-B1
+ 1.2.0.1-SNAPSHOT
@@ -116,7 +116,7 @@
io.mosip.kernel
kernel-core
- 1.2.0.1-B1
+ 1.2.0.1-SNAPSHOT
org.springframework.boot
@@ -201,7 +201,7 @@
io.mosip.kernel
kernel-templatemanager-velocity
- 1.2.0.1-B1
+ 1.2.0.1-SNAPSHOT
org.springframework.cloud
@@ -226,7 +226,7 @@
io.mosip.kernel
kernel-keymanager-service
- 1.2.0.1-B2
+ 1.2.0.1-SNAPSHOT
lib
diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/Decrypt.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/Decrypt.java
index 97acbd0ef02..05383777f5b 100644
--- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/Decrypt.java
+++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/Decrypt.java
@@ -477,12 +477,13 @@ public String decryptEkycData(
@PostMapping(path = "/decryptWithPartnerKey", produces = MediaType.TEXT_PLAIN_VALUE)
public String decryptWithPartnerKey(
@RequestBody String data,
+ @RequestParam(name = "partnerType", required = true) PartnerTypes partnerType,
@RequestParam(name = "partnerName", required = false) String partnerName,
@RequestParam(name = "keyFileNameByPartnerName", required = false) boolean keyFileNameByPartnerName,
@RequestParam(name = "certsDir", required = false) String certsDir,
@RequestParam(name = "moduleName", required = false) String moduleName
) throws Exception {
- PrivateKeyEntry ekycKey = keyMgrUtil.getKeyEntry(keyMgrUtil.getKeysDirPath(certsDir, moduleName), PartnerTypes.EKYC, partnerName, keyFileNameByPartnerName);
+ PrivateKeyEntry ekycKey = keyMgrUtil.getKeyEntry(keyMgrUtil.getKeysDirPath(certsDir, moduleName), partnerType, partnerName, keyFileNameByPartnerName);
return cryptoCoreUtil.decrypt(data, ekycKey);
}
diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/helper/KeyMgrUtil.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/helper/KeyMgrUtil.java
index 05de3e74cb4..22996dc8ffe 100644
--- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/helper/KeyMgrUtil.java
+++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/helper/KeyMgrUtil.java
@@ -157,7 +157,7 @@ private PrivateKeyEntry getPrivateKeyEntry(String filePath) throws NoSuchAlgorit
KeyStore keyStore = KeyStore.getInstance(KEY_STORE);
try(InputStream p12FileStream = new FileInputStream(filePath);) {
keyStore.load(p12FileStream, getP12Pass());
- return (PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, new PasswordProtection (getP12Pass()));
+ return (PrivateKeyEntry) keyStore.getEntry(getKeyAlias(), new PasswordProtection (getP12Pass()));
}
}
return null;
@@ -208,7 +208,7 @@ private PrivateKeyEntry generateKeys(PrivateKey signKey, String signCertType, St
KeyStore keyStore = KeyStore.getInstance(KEY_STORE);
keyStore.load(null, getP12Pass());
- keyStore.setEntry(KEY_ALIAS, privateKeyEntry, new PasswordProtection (getP12Pass()));
+ keyStore.setEntry(getKeyAlias(), privateKeyEntry, new PasswordProtection (getP12Pass()));
Path parentPath = Paths.get(p12FilePath).getParent();
if (parentPath != null && !Files.exists(parentPath)) {
Files.createDirectories(parentPath);
@@ -368,7 +368,7 @@ public boolean updatePartnerCertificate(String partnerType, X509Certificate upda
KeyStore keyStore = KeyStore.getInstance(KEY_STORE);
keyStore.load(null, getP12Pass());
- keyStore.setEntry(KEY_ALIAS, newPrivateKeyEntry, new PasswordProtection (getP12Pass()));
+ keyStore.setEntry(getKeyAlias(), newPrivateKeyEntry, new PasswordProtection (getP12Pass()));
OutputStream outputStream = new FileOutputStream(partnerFilePath);
keyStore.store(outputStream, getP12Pass());
@@ -379,6 +379,10 @@ public boolean updatePartnerCertificate(String partnerType, X509Certificate upda
return false;
}
+ private String getKeyAlias() {
+ return environment.getProperty("p12.key.alias", KEY_ALIAS);
+ }
+
public String getKeysDirPath(String certsDir, String moduleName) {
String domain = environment.getProperty(DOMAIN_URL, "localhost").replace("https://", "").replace("http://", "").replace("/", "");
diff --git a/authentication-demo-service/src/main/resources/application.properties b/authentication-demo-service/src/main/resources/application.properties
index 39929be1fe9..cf22ff0f99e 100644
--- a/authentication-demo-service/src/main/resources/application.properties
+++ b/authentication-demo-service/src/main/resources/application.properties
@@ -578,3 +578,4 @@ mosip.iris.provider=ai.tech5.auth.service.T5AuthIrisImpl
#openapi properties to sort tag and operations of id-authentication services
springdoc.swagger-ui.tagsSorter=alpha
springdoc.swagger-ui.operationsSorter=alpha
+p12.key.alias=keyalias