Manual Pages for UNIX Darwin command on man X509_NAME_add_entry_by_OBJ
MyWebUniversity

Manual Pages for UNIX Darwin command on man X509_NAME_add_entry_by_OBJ

X509NAMEaddentrybytxt(3) OpenSSL X509NAMEaddentrybytxt(3)

NAME

X509NAMEaddentrybytxt, X509NAMEaddentrybyOBJ,

X509NAMEaddentrybyNID, X509NAMEaddentry, X509NAMEdeleteentry

- X509NAME modification functions

SYNOPSIS

int X509NAMEaddentrybytxt(X509NAME *name, const char *field, int

type, const unsigned char *bytes, int len, int loc, int set);

int X509NAMEaddentrybyOBJ(X509NAME *name, ASN1OBJECT *obj, int

type, unsigned char *bytes, int len, int loc, int set);

int X509NAMEaddentrybyNID(X509NAME *name, int nid, int type,

unsigned char *bytes, int len, int loc, int set);

int X509NAMEaddentry(X509NAME *name,X509NAMEENTRY *ne, int loc,

int set);

X509NAMEENTRY *X509NAMEdeleteentry(X509NAME *name, int loc);

DESCRIPTION

X509NAMEaddentrybytxt(), X509NAMEaddentrybyOBJ() and

X509NAMEaddentrybyNID() add a field whose name is defined by a

string ffiieelldd, an object oobbjj or a NID nniidd respectively. The field value

to be added is in bbyytteess of length lleenn. If lleenn is -1 then the field

length is calculated internally using strlen(bytes). The type of field is determined by ttyyppee which can either be a definition of the type of bbyytteess (such as MMBBSSTTRRIINNGGAASSCC) or a standard ASN1 type (such as VVAASSNN11IIAA55SSTTRRIINNGG). The new entry is added to a position determined by lloocc and sseett.

59AEdety) ds cp o X509NAMEENTRY srcue ne o

nnaammee. The new entry is added to a position determined by lloocc and sseett. Since a copy of nnee is added nnee must be freed up after the call.

X509NAMEdeleteentry() deletes an entry from nnaammee at position lloocc.

The deleted entry is returned and must be freed up. NNOOTTEESS The use of string types such as MMBBSSTTRRIINNGGAASSCC or MMBBSSTTRRIINNGGUUTTFF88 is strongly recommened for the ttyyppee parameter. This allows the internal code to correctly determine the type of the field and to apply length checks according to the relevant standards. This is done using ASN1STRINGsetbyNID(). If instead an ASN1 type is used no checks are performed and the supplied data in bbyytteess is used directly.

In X509NAMEaddentrybytxt() the ffiieelldd string represents the field

name using OBJtxt2obj(field, 0). The lloocc and sseett parameters determine where a new entry should be added.

For almost all applications lloocc can be set to -1 and sseett to 0. This

adds a new entry to the end of nnaammee as a single valued RelativeDistinguishedName (RDN). lloocc actually determines the index where the new entry is inserted: if

it is -1 it is appended.

sseett determines how the new type is added. If it is zero a new RDN is created.

If sseett is -1 or 1 it is added to the previous or next RDN structure

respectively. This will then be a multivalued RDN: since multivalues RDNs are very seldom used sseett is almost always set to zero. EEXXAAMMPPLLEESS

rae n X509NAME tutr:

"C=UK, O=Disorganized Organization, CN=Joe Bloggs"

X509NAME *nm;

nm = X509NAMEnew();

if (nm == NULL) /* Some error */

if (!X509NAMEaddentrybytxt(nm, MBSTRINGASC,

"C", "UK", -1, -1, 0))

/* Error */

if (!X509NAMEaddentrybytxt(nm, MBSTRINGASC,

"O", "Disorganized Organization", -1, -1, 0))

/* Error */

if (!X509NAMEaddentrybytxt(nm, MBSTRINGASC,

"CN", "Joe Bloggs", -1, -1, 0))

/* Error */

RETURN VALUES

X509NAMEaddentrybytxt(), X509NAMEaddentrybyOBJ(),

X509NAMEaddentrybyNID() and X509NAMEaddentry() return 1 for

success of 0 if an error occurred.

59AEeeenr( rtrs ihr h dltd X509NAMEENTRY

structure of NNUULLLL if an error occurred.

BUGS

ttyyppee can still be set to VVAASSNN11AAPPPPCCHHOOOOSSEE to use a different algorithm to determine field types. Since this form does not understand multicharacter types, performs no length checks and can result in invalid field types its use is strongly discouraged.

SEE ALSO

ERRgeterror(3), d2iX509NAME(3)

HISTORY

0.9.7l 2005-03-30 X509NAMEaddentrybytxt(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™