Skip to content

Commit 44a7b72

Browse files
committed
Return X500Principal from getPeerPrincipal() and getLocalPrincipal()
1 parent 276eff7 commit 44a7b72

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/java/com/wolfssl/provider/jsse/WolfSSLImplementSSLSession.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,12 @@ public Certificate[] getLocalCertificates() {
673673
public synchronized Principal getPeerPrincipal()
674674
throws SSLPeerUnverifiedException {
675675

676-
/* Use standard Java X509Certificate.getSubjectDN()
677-
* for X500Name equals() compatibility */
676+
/* Return X500Principal for proper equals() symmetry */
678677
Certificate[] certs = getPeerCertificates();
679678
if (certs != null && certs.length > 0 &&
680679
certs[0] instanceof X509Certificate) {
681-
return ((X509Certificate) certs[0]).getSubjectDN();
680+
return ((X509Certificate) certs[0])
681+
.getSubjectX500Principal();
682682
}
683683
throw new SSLPeerUnverifiedException("No peer certificate");
684684
}
@@ -699,7 +699,7 @@ public Principal getLocalPrincipal() {
699699
if (certs.length > 0){
700700
/* When chain of certificates exceeds one,
701701
* the user certifcate is the first */
702-
localPrincipal = certs[0].getSubjectDN();
702+
localPrincipal = certs[0].getSubjectX500Principal();
703703
}
704704

705705
/* free native resources earlier than garbage collection if

0 commit comments

Comments
 (0)