Search code examples
certificate

Extract Issuer and Subject from certificate


I have a fairly basic question, but I haven't found the answer for that.

There is a certificate (called "authToken") which I have not too much information about.

I know:

  • it's in X509 format
  • I can get its public key

Now, from the public key, can I somehow extract the details of this certificate? Like the issuer, date, subject, etc?

Most preferably in Java, but I'm very open to anything else also.


Solution

  • While the certificate includes these information the public key does not. The public key is part of the certificate, not the certificate part of the public key.

    Extraction of these information from the certificate can for example be done with a simple openssl x509 -in cert.pem -subject -issuer. Help on doing this in various programming languages is off-topic here since it is a pure programming question. But it can usually easily be found using a search engine.