c - Getting common name efficiently from tls certificate with openssl -
i have pointer tls certificate , need commonname property;
i @ first create x509 object function d2i_x509 ;
x = d2i_x509(null, &p, certificate_lenght); if (x == null) return https_failure;
than call function x509_name_get_text_by_nid getting commonname
x509_name_get_text_by_nid(x509_get_subject_name(x),nid_commonname, hc->https_domain_name, 256);
it works me worried performance . think, certificate object parsed when need commonname . there better method getting commonname more efficiency .
there no more efficient way using openssl high-level api. if interested in having best performance possible, you'll need use low-level asn.1 parsing api. keep in mind cannot validate certificate without parsing entirely, concerned security implications of extracting cn.
Comments
Post a Comment