Hi all,

 

As the subject says I'm grabbing a public key from a PEMK encoded X509
cert and I compute the SHA-1 hash over this to create a signer id.  This
is done by using PEM_read_X509 to read the PEM cert into an x509 struct,
using X509_get_pubkey to obtain the public key as an EVP_PKEY from the
x509 struct and finally using i2d_PUBKEY to take the EVP_PKEY and
convert it to DER format.

 

I've done this before and I ran into the same issue which is that along
with the public key which can be found in the certificate file the
public key I am obtaining also includes a header.  From what I have read
this header identifies what type of public key it is and so on, but I
don't want this included in the computation of the hash.  Is there a way
besides hardcoding the offset where the public key begins to get rid of
this header?

 

For reference here is the public key my program obtains with the header
underlined and most of the public key not included (since it really
isn't that important):

Signer Public Key:
30:81:9b:30:10:06:07:2a:86:48:ce:3d:02:01:06:05:2b:81:04:00:23:03:81:86:
00:04:00:71:...:22:f3:6d:23

 

Thanks!

 

-John

Reply via email to