开发者

Extracting a custom extension from a X.509 certificate by OID with OpenSSL

开发者 https://www.devze.com 2023-04-03 16:59 出处:网络
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);

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号