Hi, I am a newbe to openssl. The documentation is not very enlightning to me so far I'm afraid.
What I am trying to do is to take the "sha-1 hash of a public key obtained from a peer". So, I first do a SSL_connect, obtaining the X509 certificate of the peer. So far so good, this is standard SSL stuff described in various examples. Then I obtain the RSA public key from this certificate using the call pubkey = X509_get_pubkey(peer_cert); where pubkey is of type EVP_PKEY*. However, after this I am not sure what to do. I cannot directly make a digest of 'pubkey', as below: EVP_DigestInit(&ex, EVP_sha1()); EVP_DigestUpdate(&ex, (void*)pubkey sizeof((void*)pubkey)); EVP_DigestFinal(&ex, md_value ,(unsigned int*) &i); as this really only hashes the EVP_PKEY struct, not the public key itself. Can anyone shed some light on how to obtain the RSA public key specifically and digest this key? I am a bit lost in the OpenSSL datastructures.. I followed the EVP_PKEY struct definition back to rsa_st, defined in rsa.h, however, this remains rather cryptic and I am not sure how to use it (if I can use it directly). In the end, I suppose I need to do something like pubkey->pkey.rsa->... however I am not sure what field(s) to use. Can anyone point me in the right direction? E.g., what fields in the pkey.rsa (rsa_st) struct are used to store the public key, or maybe someone can tell me how a (raw) public key is 'normally' digested? Thanks for reading, Guido. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]