I am working on a HTTPS client and I managed to establish a secure connection and get the X509 certificate using: X509 *cert = SSL_get_certificate(ssl);
(ssl is SSL*).
How do I save the certificate to a file?
Also, I need to get "Subject DN" and "Issuer DN" fields from the certificate.
-- How do I save the certificate to a file?
#include <openssl/pem.h>
int PEM_write_X509(FILE *fp, X509 *x);
-- Also, I need to get "Subject DN" and "Issuer DN" fields from the certificate.
#include <openssl/x509.h>
X509_NAME * X509_get_issuer_name(X509 *a);
X509_NAME * X509_get_subject_name(X509 *a);