Hi Akash, I have encountered the same issue as you mentioned in your email but I still haven't figured out the cause of the failure. However, after I replaced "d2i(0, &data, ext->value->length)" function with X509V3_EXT_d2i(ext), the problem was gone.
Regards Bob ________________________________ From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Akash Deo Sent: Thursday, May 26, 2011 11:57 PM To: openssl-users@openssl.org Subject: Trying to get URI of CRL from certificate extension Hi, I am trying to get URI of the CRL from certificate extension using below function: static char *get_distribution_point(X509 *cert) { int extcount, i, j; const char *extstr; CONF_VALUE *nval; unsigned char *data; X509_EXTENSION *ext; X509V3_EXT_METHOD *meth; STACK_OF(CONF_VALUE) *val; if ((extcount = X509_get_ext_count(cert)) > 0) { for (i = 0; i < extcount; i++) { ext = X509_get_ext(cert, i); extstr = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); if (strcasecmp(extstr, "crlDistributionPoints")) continue; if (!(meth = X509V3_EXT_get(ext))) break; data = ext->value->data; val = meth->i2v(meth, meth->d2i(0, &data, ext->value->length), 0); for (j = 0; j < sk_CONF_VALUE_num(val); j++) { nval = sk_CONF_VALUE_value(val, j); if (!strcasecmp(nval->name, "URI")) return strdup(nval->value); } } } return 0; } Above function fails at val = meth->i2v(meth, meth->d2i(0, &data, ext->value->length), 0); Any suggestions ? Please help Thanks & Regards, Akash Deo