问题
I'm trying to get the DN from a certificate in ASN.1/DER format. I have searched OpenSSL but still cannot find the exact function to get the DN.
Does anyone have any experience regarding this or can point me to books or any website?
回答1:
I already found a way to do this. I just put here if anyone want to do the same.
X509_NAME * cert_entry = X509_get_issuer_name(cert);
unsigned char buff[100] = {0};
unsigned char * p = buff;
int i = i2d_X509_NAME(cert_entry,&p);
for(int b = 0;b<i;b++)
{
printf("%02X ",buff[b]);
}
This will print an hexa format.
来源:https://stackoverflow.com/questions/39634163/get-dn-from-certificate-in-asn-1-format