Skip to content

Commit 32e1a54

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

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,11 @@ 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]).getSubjectX500Principal();
682681
}
683682
throw new SSLPeerUnverifiedException("No peer certificate");
684683
}
@@ -699,7 +698,7 @@ public Principal getLocalPrincipal() {
699698
if (certs.length > 0){
700699
/* When chain of certificates exceeds one,
701700
* the user certifcate is the first */
702-
localPrincipal = certs[0].getSubjectDN();
701+
localPrincipal = certs[0].getSubjectX500Principal();
703702
}
704703

705704
/* free native resources earlier than garbage collection if

0 commit comments

Comments
 (0)