Skip to content

Commit 55efd62

Browse files
fix: replace deprecated X509Certificate.getSubjectDN() and getIssuerDN()
Replace deprecated methods with their X500Principal equivalents: - getSubjectDN() → getSubjectX500Principal() - getIssuerDN() → getIssuerX500Principal() Both deprecated methods have implementation-dependent behavior, while X500Principal provides well-defined RFC 2253 output via getName(). Fixes #3282 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c3a07f commit 55efd62

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clients/src/main/java/org/apache/kafka/common/security/ssl/CommonNameLoggingTrustManagerFactoryWrapper.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import java.security.MessageDigest;
3030
import java.security.NoSuchAlgorithmException;
3131
import java.security.NoSuchProviderException;
32-
import java.security.Principal;
32+
3333
import java.security.PublicKey;
3434
import java.security.SignatureException;
3535
import java.security.cert.CertificateEncodingException;
@@ -321,8 +321,8 @@ public int getBasicConstraints() {
321321
}
322322

323323
@Override
324-
public Principal getIssuerDN() {
325-
return this.origCertificate.getIssuerDN();
324+
public X500Principal getIssuerDN() {
325+
return this.origCertificate.getIssuerX500Principal();
326326
}
327327

328328
@Override
@@ -371,8 +371,8 @@ public byte[] getSignature() {
371371
}
372372

373373
@Override
374-
public Principal getSubjectDN() {
375-
return this.origCertificate.getSubjectDN();
374+
public X500Principal getSubjectDN() {
375+
return this.origCertificate.getSubjectX500Principal();
376376
}
377377

378378
@Override

0 commit comments

Comments
 (0)