X509_NAME_add_entry (3)
Leading comments
Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) Standard preamble: ========================================================================
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 functionsSYNOPSIS
#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);
DESCRIPTION
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 aThe type of field is determined by type which can either be a definition of the type of bytes (such as
X509_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.
X509_NAME_delete_entry() deletes an entry from name at position loc. The deleted entry is returned and must be freed up.
NOTES
The use of string types such asIf instead an
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 (
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
If set is -1 or 1 it is added to the previous or next
EXAMPLES
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, "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 */
RETURN VALUES
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