Reputation: 2359
X509_extension structure have a variable of ASN1_object . i want to read what is the content in that . Can any one tell me how to do that
Upvotes: 3
Views: 4118
Reputation: 1
You can access the data value of the object as int the code fragment below:
ASN1_OBJECT *obj = X509_EXTENSION_get_object(ex);
char *dt_value = (char *)ext->value->data
printf("Object Value: %s\n", dt_value);
Upvotes: 0
Reputation: 747
An ASN1_OBJECT is just OpenSSL's representation of an OID, an object identifier. If you only want to know it's OID, then:
ASN1_OBJECT *obj = X509_EXTENSION_get_object(ex); // ex is your X509_EXTENSION *
char buff[1024];
OBJ_obj2txt(buff, 1024, obj, 0); // 0 means it will prefer a textual representation (if available) rather than the numerical one
Then buf will contain a C string with the OID.
Regards.
Upvotes: 7