MirBSD manpage: X509_NAME_add_entry(3), X509_NAME_add_entry_by_NID(3), X509_NAME_add_entry_by_OBJ(3), X509_NAME_add_entry_by_txt(3), X509_NAME_delete_entry(3)



     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


     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

     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


     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 field, an object obj or a NID nid
     respectively. The field value to be added is in bytes of
     length len. If len 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 MBSTRING_ASC) or
     a standard ASN1 type (such as V_ASN1_IA5STRING). The new
     entry is added to a position determined by loc and set.

     X509_NAME_add_entry() adds a copy of X509_NAME_ENTRY struc-
     ture ne to name. The new entry is added to a position deter-
     mined by loc and set. Since a copy of ne is added ne must be
     freed up after the call.

     X509_NAME_delete_entry() deletes an entry from name at posi-
     tion loc. The deleted entry is returned and must be freed


     The use of string types such as MBSTRING_ASC or
     MBSTRING_UTF8 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

MirBSD #10-current         2005-04-29                           1


     If instead an ASN1 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 (RDN).

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

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

     If set 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 set is almost
     always set to zero.


     Create an X509_NAME structure:

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

      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 */


     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.

     X509_NAME_delete_entry() returns either the deleted
     X509_NAME_ENTRY structure of NULL if an error occurred.


     type can still be set to V_ASN1_APP_CHOOSE to use a dif-
     ferent algorithm to determine field types. Since this form

MirBSD #10-current         2005-04-29                           2


     does not understand multicharacter types, performs no length
     checks and can result in invalid field types its use is
     strongly discouraged.


     ERR_get_error(3), d2i_X509_NAME(3)


MirBSD #10-current         2005-04-29                           3

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung