I am developing an iOS application that will have to read the alternate name of the object from the certificate (.pfx).
Security.framework has no way to get this information, so I use OpenSSL (openssl-1.0.1e)
To read the Subject Name I use X509_get_subject_name (certificate), and for the Issuer I use X509_get_issuer_name (certificate) and it works.
The problem is the subjectβs alternate name. I cannot find any function to return this information.
Is it possible to use OpenSSL to get an alternative subject name? How?
Edit:
I imported the certificate into the MAC keychain. For the subject alternative name, I see the name NT and the name RFC 822.
I tried this, but it returns NULL:
GENERAL_NAME *name = (GENERAL_NAME*)X509_get_ext_d2i(cert,NID_subject_alt_name, NULL, NULL)
I am reading a certificate with this:
X509 *cert;
CFDataRef der = SecCertificateCopyData(certificate);
const unsigned char * ptr = CFDataGetBytePtr(der);
int len = CFDataGetLength(der);
d2i_X509(&cert,&ptr,len);