I've looking for an example of decoding the crlDistributionPoints extension; e.g. obtaining the specified URI (assuming that the value specifies a URI, that is). This seems like it should be easy. By digging around in the archives of this list, I've been able to figure out I can get the ASN.1-encoded value for the extension using this:

int loc = X509_get_ext_by_NID(cert, NID_crl_distribution_points, -1);
    X509_EXTENSION *ext = X509_get_ext(cert, loc);
    ASN1_OCTET_STRING *os = X509_EXTENSION_get_data(ext);

It seems like I want to go from ASN1_OCTET_STRING to a GENERAL_NAME structure, but I just can't seem to figure out how to get there. I've seen some snippets that use ASN1_STRING_data and ASN1_STRING_length, followed by some d2i_* function, but I'm not sure what's going on there because it doesn't seem to work for me -- probably because I just don't know what the heck I'm doing.

Thanks for any pointers/assistance.

--c



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to