Get issuerNameHash and issuerKeyHash of x509

th flag

I need to get the following out of x509 CA certificates:

  • the Hash of the DER encoded public key (excluding tag and length) of the subject public key field
  • the hash of the issuers distinguished name, that must be calculated over the DER encoding of the issuer's name field

I tried to use X509_issuer_name_hash and X509_pubkey_digest , but apparently they return not the results that I expect.

This question and the answers posted is close to what I look for: How can I get issuerNameHash and issuerKeyHash from PEM or DER certificates? but I would like to have an explanation on how to do this in C++ and OpenSSL.

UPDATE: X509_pubkey_digest is exactly what i needed, I just made a mistake converting to hexstring. The hash of the issuer's distinguished name is still open though.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.