[Help-gnutls] gnutls_x509_crq_get_dn_by_oid

Nikos Mavrogiannopoulos nmav at gnutls.org
Fri Apr 22 17:28:20 CEST 2005


On Friday 22 April 2005 14:22, Daniel Stenberg wrote:
> Hello!
>
> Can you please clarify what gnutls_x509_crq_get_dn_by_oid() stores in the
> area I point out to it with the 'buf' argument?
>
> The docs says it should be "a pointer to a structure to hold the name", but
> doesn't mention what structure or how such a struct should look like.
I changed it to:
a pointer where the DN part will be copied (may be null).


> I currently use it like this:
>
>    size=sizeof(certbuf);
>    rc = gnutls_x509_crt_get_dn_by_oid(x509_cert,
> GNUTLS_OID_X520_COMMON_NAME, 0, /* the first and only one */ TRUE, /* give
> to me raw please */ certbuf,
>                                       &size);
Why do you want the DER data and not a printable string?

A common use would be:
string[128];
size_t size=sizeof(string);
rc = gnutls_x509_crt_get_dn_by_oid(x509_cert,
     GNUTLS_OID_X520_COMMON_NAME, 0, 0, string, &size);

-- 
Nikos Mavrogiannopoulos





More information about the Gnutls-help mailing list