Hi all! I'm trying to scratch a distpoint from an X509 certificate. The code is shown below. It works, but it's a little bit dirty... 'i2d_DIST_POINT_NAME' delivers me the distpoints, but I have to skip four bytes the extract the string.
Does anyone know: - The data type created by 'i2d_DIST_POINT_NAME' ? - An openssl-standard function, that is able to extract the string? - Another approuch to extract the CRL-Distpoints from an X509v3-cert? TIA, Sebastian -- char *getCrlDistPoint(X509 *xcert, unsigned char *filter) { X509_EXTENSION * ext = NULL; STACK_OF(DIST_POINT) * distpoints = NULL; DIST_POINT *dist; unsigned char *dbuf,buf[1024], *p, *hugo; unsigned int i, y; memset (buf, 0, sizeof(buf)); i = X509_get_ext_by_NID(xcert, NID_crl_distribution_points, -1); ext = X509_get_ext(xcert, i); if(ext == NULL || ext->value == NULL) return NULL; dbuf = ext->value->data; distpoints =(STACK_OF(DIST_POINT)*) d2i_CRL_DIST_POINTS(&distpoints, &dbuf, ext->value->length); if(distpoints == NULL ) return ""; for (i=0; i < distpoints->num; i++) { dist = sk_DIST_POINT_value(distpoints, i); memset (buf, 0, sizeof(buf)); p = buf; hugo = NULL; y = i2d_DIST_POINT_NAME(dist->distpoint, &p); if (y > 0) { if (!memcmp(filter, buf + 4, 4)) { if (NULL != (hugo = (unsigned char *) malloc(y -3))) { memcpy(hugo, buf + 4, y -3); } } } DIST_POINT_free(dist); } sk_DIST_POINT_free(distpoints); return hugo; } ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]