From d1c972fe8da68e63ad153226e1310b550d85b2bb Mon Sep 17 00:00:00 2001 From: BLasan Date: Mon, 11 Mar 2024 10:12:38 +0530 Subject: [PATCH] fixes: https://github.com/wso2/api-manager/issues/2101 --- .../wso2/carbon/apimgt/impl/utils/CertificateMgtUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/CertificateMgtUtils.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/CertificateMgtUtils.java index 3e9dd0db0638..860afdc78d6e 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/CertificateMgtUtils.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/CertificateMgtUtils.java @@ -620,8 +620,10 @@ public String getUniqueIdentifierOfCertificate(String certificate) { while (serverCert.available() > 0) { Certificate generatedCertificate = cf.generateCertificate(serverCert); X509Certificate x509Certificate = (X509Certificate) generatedCertificate; - uniqueIdentifier = x509Certificate.getSerialNumber() + "_" + x509Certificate.getSubjectDN(); - uniqueIdentifier = uniqueIdentifier.replaceAll(",", "#").replaceAll("\"", "'"); + uniqueIdentifier = x509Certificate.getSerialNumber() + "_" + x509Certificate.getIssuerDN(); + uniqueIdentifier = uniqueIdentifier.replaceAll(",", "#").replaceAll("\"", "'") + .replaceAll("&(?!amp;)", "&") + .replaceAll("<", "<").replaceAll(">", ">"); } } catch (CertificateException e) { log.error("Error while getting serial number of the certificate.", e);