Hello,
my application uses openssl to protect the communication, to allow acces
only for the users who have a certificate signed by my CA but I also need to
know the public key and the sha1 hash of the key. I was able to make an
application which meets first two points. But I'm stuck on finding the
solution for the last point. After I call SSL_get_verify_result I try to
obtain the public key like this:
X509 * cert = SSL_get_peer_certificate(ssl);
EVP_PKEY * key = X509_get_pubkey(cert);
printf_s("RSA-%d\n", BN_num_bits(key->pkey.rsa->n));
EVP_PKEY_free(key);
X509_free(cert);
The problem is that key struct seems to be empty, or at least the pkey
field. This is how it looks:
http://old.nabble.com/file/p33757674/x509pkey.png 
What is the right way to obtain the public key and its sha1 hash from a
client once the communication has been established?
-- 
View this message in context: 
http://old.nabble.com/Cannot-obtain-public-key-from-X509-cert-tp33757674p33757674.html
Sent from the OpenSSL - Dev mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to