Skip to content

Commit

Permalink
Merge pull request #12134 from BLasan/fix-mtls-cert-character-issue
Browse files Browse the repository at this point in the history
Fix: Reserved character Issue in Certs #12134
  • Loading branch information
BLasan authored Aug 1, 2024
2 parents de3b00c + d1c972f commit d0a2629
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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("<", "&lt;").replaceAll(">", "&gt;");
}
} catch (CertificateException e) {
log.error("Error while getting serial number of the certificate.", e);
Expand Down

0 comments on commit d0a2629

Please sign in to comment.