Search code examples
javasecurityauthenticationx509

X509Certificate: what is the difference between getIssuerDN() and getSubjectDN() methods


I'm using X509Certificate class in java, and when I want to get the subject name I try:

x509certificate.getIssuerDN().getName();

and

x509certificate.getSubjectDN().getName();

both methods have the same result. So what is the difference between them ??


Solution

  • This methods reads from two different fields in certificate. It may returns the same result in your case but not in common.

    Please refer to getIssuerDN() and getSubjectDN().