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" '' '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.
. de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} . de IX .. .\}
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"
way too many mistakes in technical documents.
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.
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.
\*(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
\fIX509_NAME_delete_entry() returns either the deleted X509_NAME_ENTRY structure of \s-1NULL\s0 if an error occurred.