I have been able to extract a custom extension from a X.509 certificate by its index with:
X509_EXTENSION* ex = X509_get_ext(x509, extension_index);
开发者_StackOverflow
How do I extract the extension by its OID instead of its index?
Got it working with the following:
int my_nid = OBJ_create("1.2.3.4", "MyShortObjectName", "My Long Object Name");
int my_idx = X509_get_ext_by_NID(x509, my_nid, -1);
X509_EXTENSION* ex = X509_get_ext(x509, my_idx);
精彩评论