Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/X509_NAME_add_entry_by_NID.html |
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>X509_NAME_add_entry_by_txt</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@hsxx.drive.ne.jp" /> </head> <body style="background-color: white"> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#notes">NOTES</a></li> <li><a href="#return_values">RETURN VALUES</a></li> <li><a href="#examples">EXAMPLES</a></li> <li><a href="#bugs">BUGS</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#copyright">COPYRIGHT</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <hr /> <h1><a name="name">NAME</a></h1> <p>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</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> #include <openssl/x509.h></pre> <pre> 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);</pre> <pre> int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len, int loc, int set);</pre> <pre> int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, const unsigned char *bytes, int len, int loc, int set);</pre> <pre> int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, int loc, int set);</pre> <pre> X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and X509_NAME_add_entry_by_NID() add a field whose name is defined by a string <strong>field</strong>, an object <strong>obj</strong> or a NID <strong>nid</strong> respectively. The field value to be added is in <strong>bytes</strong> of length <strong>len</strong>. If <strong>len</strong> is -1 then the field length is calculated internally using strlen(bytes).</p> <p>The type of field is determined by <strong>type</strong> which can either be a definition of the type of <strong>bytes</strong> (such as <strong>MBSTRING_ASC</strong>) or a standard ASN1 type (such as <strong>V_ASN1_IA5STRING</strong>). The new entry is added to a position determined by <strong>loc</strong> and <strong>set</strong>.</p> <p>X509_NAME_add_entry() adds a copy of <strong>X509_NAME_ENTRY</strong> structure <strong>ne</strong> to <strong>name</strong>. The new entry is added to a position determined by <strong>loc</strong> and <strong>set</strong>. Since a copy of <strong>ne</strong> is added <strong>ne</strong> must be freed up after the call.</p> <p>X509_NAME_delete_entry() deletes an entry from <strong>name</strong> at position <strong>loc</strong>. The deleted entry is returned and must be freed up.</p> <p> </p> <hr /> <h1><a name="notes">NOTES</a></h1> <p>The use of string types such as <strong>MBSTRING_ASC</strong> or <strong>MBSTRING_UTF8</strong> is strongly recommended for the <strong>type</strong> 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().</p> <p>If instead an ASN1 type is used no checks are performed and the supplied data in <strong>bytes</strong> is used directly.</p> <p>In X509_NAME_add_entry_by_txt() the <strong>field</strong> string represents the field name using OBJ_txt2obj(field, 0).</p> <p>The <strong>loc</strong> and <strong>set</strong> parameters determine where a new entry should be added. For almost all applications <strong>loc</strong> can be set to -1 and <strong>set</strong> to 0. This adds a new entry to the end of <strong>name</strong> as a single valued RelativeDistinguishedName (RDN).</p> <p><strong>loc</strong> actually determines the index where the new entry is inserted: if it is -1 it is appended.</p> <p><strong>set</strong> determines how the new type is added. If it is zero a new RDN is created.</p> <p>If <strong>set</strong> 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 <strong>set</strong> is almost always set to zero.</p> <p> </p> <hr /> <h1><a name="return_values">RETURN VALUES</a></h1> <p>X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), X509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for success of 0 if an error occurred.</p> <p>X509_NAME_delete_entry() returns either the deleted <strong>X509_NAME_ENTRY</strong> structure of <strong>NULL</strong> if an error occurred.</p> <p> </p> <hr /> <h1><a name="examples">EXAMPLES</a></h1> <p>Create an <strong>X509_NAME</strong> structure:</p> <p>"C=UK, O=Disorganized Organization, CN=Joe Bloggs"</p> <pre> X509_NAME *nm;</pre> <pre> nm = X509_NAME_new(); if (nm == NULL) /* Some error */ if (!X509_NAME_add_entry_by_txt(nm, "C", MBSTRING_ASC, "UK", -1, -1, 0)) /* Error */ if (!X509_NAME_add_entry_by_txt(nm, "O", MBSTRING_ASC, "Disorganized Organization", -1, -1, 0)) /* Error */ if (!X509_NAME_add_entry_by_txt(nm, "CN", MBSTRING_ASC, "Joe Bloggs", -1, -1, 0)) /* Error */</pre> <p> </p> <hr /> <h1><a name="bugs">BUGS</a></h1> <p><strong>type</strong> can still be set to <strong>V_ASN1_APP_CHOOSE</strong> 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.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><em>ERR_get_error(3)</em>, <em>d2i_X509_NAME(3)</em></p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.</p> <p>Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p> </body> </html>