NAME
X509NAMEgetindexbyNID, X509NAMEgetindexbyOBJ,
X509NAMEgetentry, X509NAMEentrycount, X509NAMEgettextbyNID,
X509NAMEgettextbyOBJ - X509NAME lookup and enumeration functions
SYNOPSIS
int X509NAMEgetindexbyNID(X509NAME *name,int nid,int lastpos);
int X509NAMEgetindexbyOBJ(X509NAME *name,ASN1OBJECT *obj, int
lastpos);int X509NAMEentrycount(X509NAME *name); X509NAMEENTRY
*X509NAMEgetentry(X509NAME *name, int loc);
int X509NAMEgettextbyNID(X509NAME *name, int nid, char *buf,int
len); int X509NAMEgettextbyOBJ(X509NAME *name, ASN1OBJECT *obj,
char *buf,int len);DESCRIPTION
hs fntos lo a X509NAME srcue o e xmnd Te
X509NAME tutr i te ae s h Name tp dfnd n F25
(and elsewhere) and used for example in certificate subject and issuer names.X509NAMEgetindexbyNID() and X509NAMEgetindexbyOBJ() retrieve
the next index matching nniidd or oobbjj after llaassttppooss. llaassttppooss shouldinitially be set to -1. If there are no more entries -1 is returned.
X509NAMEentrycount() returns the total number of entries in nnaammee.
59AEeety) eree te X509NAMEENTRY rm name
corresponding to index lloocc. Acceptable values for lloocc run from 0 to(X509NAMEentrycount(name) - 1). The value returned is an internal
pointer which must not be freed.X509NAMEgettextbyNID(), X509NAMEgettextbyOBJ() retrieve the
"text" from the first entry in nnaammee which matches nniidd or oobbjj, if nosuch entry exists -1 is returned. At most lleenn bytes will be written and
the text written to bbuuff will be null terminated. The length of the output string written is returned excluding the terminating null. If bbuuff isthen the amount of space needed in bbuuff (excluding the final null) is returned. NNOOTTEESS X509NAMEgettextbyNID() and X509NAMEgettextbyOBJ() are legacy
functions which have various limitations which make them of minimal use in practice. They can only find the first matching entry and will copy the contents of the field verbatim: this can be highly confusing if the target is a muticharacter string type like a BMPString or a UTF8String.For a more general solution X509NAMEgetindexbyNID() or
X509NAMEgetindexbyOBJ() should be used followed by
X509NAMEgetentry() on any matching indices and then the various
X509NAMEENTRY tlt fntos n h rsl.
EEXXAAMMPPLLEESS Process all entries: int i;X509NAMEENTRY *e;
for (i = 0; i < X509NAMEentrycount(nm); i++)
{e = X509NAMEgetentry(nm, i);
/* Do something with e */ } Process all commonName entries: int loc;X509NAMEENTRY *e;
loc = -1;
for (;;) {lastpos = X509NAMEgetindexbyNID(nm, NIDcommonName, lastpos);
if (lastpos == -1)
break;e = X509NAMEgetentry(nm, lastpos);
/* Do something with e */ }RETURN VALUES
X509NAMEgetindexbyNID() and X509NAMEgetindexbyOBJ() return
the index of the next matching entry or -1 if not found.
X509NAMEentrycount() returns the total number of entries.
59AEeety) eun a X509NAME pitr o h rqetd
entry or NNUULLLL if the index is invalid.SEE ALSO
ERRgeterror(3), d2iX509NAME(3)
HISTORY TBA0.9.7l 2002-11-12 X509NAMEgetindexbyNID(3)