X509_NAME_add_entry_by_txt.3 revision 279265
Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "X509_NAME_add_entry_by_txt 3"
X509_NAME_add_entry_by_txt 3 "2015-01-08" "0.9.8zd" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, X509_NAME_add_entry_by_NID, X509_NAME_add_entry, X509_NAME_delete_entry - X509_NAME modification functions
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/x509.h> \& int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); \& int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); \& int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); \& int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, int loc, int set); \& X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); .Ve
"DESCRIPTION"
Header "DESCRIPTION" \fIX509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and \fIX509_NAME_add_entry_by_NID() add a field whose name is defined by a string field, an object obj or a \s-1NID \s0nid respectively. The field value to be added is in bytes of length len. If \fBlen is -1 then the field length is calculated internally using strlen(bytes).

The type of field is determined by type which can either be a definition of the type of bytes (such as \s-1MBSTRING_ASC\s0) or a standard \s-1ASN1\s0 type (such as V_ASN1_IA5STRING). The new entry is added to a position determined by loc and set.

\fIX509_NAME_add_entry() adds a copy of X509_NAME_ENTRY structure ne to name. The new entry is added to a position determined by loc and set. Since a copy of ne is added ne must be freed up after the call.

\fIX509_NAME_delete_entry() deletes an entry from name at position \fBloc. The deleted entry is returned and must be freed up.

"NOTES"
Header "NOTES" The use of string types such as \s-1MBSTRING_ASC\s0 or \s-1MBSTRING_UTF8\s0 is strongly recommened for the type 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 ASN1_STRING_set_by_NID().

If instead an \s-1ASN1\s0 type is used no checks are performed and the supplied data in bytes is used directly.

In X509_NAME_add_entry_by_txt() the field string represents the field name using OBJ_txt2obj(field, 0).

The loc and set parameters determine where a new entry should be added. For almost all applications loc can be set to -1 and set to 0. This adds a new entry to the end of name as a single valued RelativeDistinguishedName (\s-1RDN\s0).

\fBloc actually determines the index where the new entry is inserted: if it is -1 it is appended.

\fBset determines how the new type is added. If it is zero a new \s-1RDN\s0 is created.

If set is -1 or 1 it is added to the previous or next \s-1RDN\s0 structure respectively. This will then be a multivalued \s-1RDN:\s0 since multivalues RDNs are very seldom used set is almost always set to zero.

"EXAMPLES"
Header "EXAMPLES" Create an X509_NAME structure:

\*(L"C=UK, O=Disorganized Organization, CN=Joe Bloggs\*(R"

.Vb 10 X509_NAME *nm; nm = X509_NAME_new(); if (nm == NULL) /* Some error */ if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, "C", "UK", -1, -1, 0)) /* Error */ if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, "O", "Disorganized Organization", -1, -1, 0)) /* Error */ if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, "CN", "Joe Bloggs", -1, -1, 0)) /* Error */ .Ve

"RETURN VALUES"
Header "RETURN VALUES" \fIX509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), \fIX509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for success of 0 if an error occurred.

\fIX509_NAME_delete_entry() returns either the deleted X509_NAME_ENTRY structure of \s-1NULL\s0 if an error occurred.

"BUGS"
Header "BUGS" \fBtype can still be set to V_ASN1_APP_CHOOSE 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"
Header "SEE ALSO" \fIERR_get_error\|(3), d2i_X509_NAME\|(3)
"HISTORY"
Header "HISTORY"