LIBRESSL-X509_NAME_ENTRY_GET_OBJECT(3)
π LIBRESSL-X509_NAME_ENTRY_GET_OBJECT(3) β the X.501 relative distinguished name glow-up π
okay so bestie, this is the LIBRESSL-X509_NAME_ENTRY_GET_OBJECT(3) page and honestly? it's giving "small struct, big feelings" β¨. it's a libcrypto thing, so you already know we're in OpenSSL-adjacent territory. buckle up π¦
β¨ NAME β¨
X509_NAME_ENTRY_new, X509_NAME_ENTRY_free, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY_set, X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, X509_NAME_ENTRY_create_by_OBJ β X.501 relative distinguished name π
πΈ SYNOPSIS πΈ
library libcrypto
#include <openssl/x509.h>
X509_NAME_ENTRY *
X509_NAME_ENTRY_new(void);
void
X509_NAME_ENTRY_free(X509_NAME_ENTRY* ne);
ASN1_OBJECT *
X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);
ASN1_STRING *
X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
int
X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne);
int
X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj);
int
X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
const unsigned char *bytes, int len);
X509_NAME_ENTRY *
X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field,
int type, const unsigned char *bytes, int len);
X509_NAME_ENTRY *
X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type,
const unsigned char *bytes, int len);
X509_NAME_ENTRY *
X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
const ASN1_OBJECT *obj, int type, const unsigned char *bytes,
int len);
π¦ DESCRIPTION π¦
so an X.501 RelativeDistinguishedName is basically an ordered set of field-type-and-value pairs, no cap. it's literally the building block for making X.501 Name objects π. and the X509_NAME_ENTRY object? it stores exactly one of those pairs β one field type, one value. that's it, that's the whole vibe π
these X509_NAME_ENTRY objects are meant to be used by the X509_NAME objects documented over in X509_NAME_new(3). and here's the tea π΅: some of the info about how several X509_NAME_ENTRY objects combine to form an X.501 Name lives inside each individual X509_NAME_ENTRY object, not in the X509_NAME object. so a given X509_NAME_ENTRY object can only be used by one X509_NAME object at a time. sharing is not caring here, bestie π
X509_NAME_ENTRY_new()β allocates and initializes an emptyX509_NAME_ENTRYobject, representing an ASN.1RelativeDistinguishedNamestructure defined in RFC 5280 section 4.1.2.4, but containing not more than one type-value-pair. so like, one pair max, we don't do harem energy here πX509_NAME_ENTRY_free()β freesneand the type and value contained in it. clean up your mess, icon behavior β¨X509_NAME_ENTRY_get_object()β retrieves the field type ofnein anASN1_OBJECTstructure. πX509_NAME_ENTRY_get_data()β retrieves the field value ofnein anASN1_STRINGstructure. both of these are the ones you'd use to examine anX509_NAME_ENTRYobject as returned byX509_NAME_get_entry(3)πX509_NAME_ENTRY_set()β retrieves the index of the X.501RelativeDistinguishedName(RDN) thatneis part of in the X.501Nameobject using it. the first RDN has index0. if an RDN consists of more than oneX509_NAME_ENTRYobject, they all share the same index π«Ά. in practice, RDNs containing more than one type-value-pair are rarely used, so if anX509_NAME *nameobject usesne, thenX509_NAME_ENTRY_set(ne)usually agrees withsk_X509_NAME_ENTRY_find(name->entries, ne), but when multi-pair RDNs are used, it may be smaller. lowkey a subtle one, so clock it πX509_NAME_ENTRY_set_object()β sets the field type ofnetoobj. done and dusted πX509_NAME_ENTRY_set_data()β sets the field value ofneto the given string type and the value determined bybytesandlen. and here's the important bit: if thetypeargument is positive and includes theMBSTRING_FLAGbit,ASN1_STRING_set_by_NID(3)is used for setting the value, passing thetypeas theinformargument and using thenidcorresponding tone. fr fr, don't skip that flag check π₯
X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID(), and X509_NAME_ENTRY_create_by_OBJ() create and return an X509_NAME_ENTRY structure. three flavors, same energy π
except for X509_NAME_ENTRY_get_object() and X509_NAME_ENTRY_get_data(), these functions are rarely used β because X509_NAME_ENTRY structures are almost always part of X509_NAME structures, and the functions described in X509_NAME_add_entry_by_txt(3) are typically used to create and add new entries in a single operation. efficiency slay π
β¨
the arguments of these functions support similar options to the similarly named ones described in X509_NAME_add_entry_by_txt(3). so for example type can be set to MBSTRING_ASC, but in the case of X509_NAME_ENTRY_set_data() the field type must be set first so the relevant field information can be looked up internally. order matters, bestie β sequence is everything π§
π RETURN VALUES π
X509_NAME_ENTRY_new()β returns a validX509_NAME_ENTRYstructure if successful; otherwiseNULLis returned and an error code can be retrieved withERR_get_error(3). πX509_NAME_ENTRY_get_object()β returns a validASN1_OBJECTstructure if it is set orNULLif an error occurred.X509_NAME_ENTRY_get_data()β returns a validASN1_STRINGstructure if it is set orNULLif an error occurred.X509_NAME_ENTRY_set()β returns the zero-based index of the RDNneis used in, or0ifneis not yet used by anyX509_NAMEobject. π«ΆX509_NAME_ENTRY_set_object()β returns1if successful; otherwise0is returned and an error code can be retrieved withERR_get_error(3).X509_NAME_ENTRY_set_data()β returns1on success or0on error. in some cases of failure, the reason can be determined withERR_get_error(3).X509_NAME_ENTRY_create_by_txt(),X509_NAME_ENTRY_create_by_NID(),X509_NAME_ENTRY_create_by_OBJ()β return a validX509_NAME_ENTRYstructure on success orNULLif an error occurred. in some cases of failure, the reason can be determined withERR_get_error(3).
π SEE ALSO π
OBJ_nid2obj(3), X509_NAME_add_entry(3), X509_NAME_get_entry(3), X509_NAME_new(3) β go read these too, iykyk ππ
β STANDARDS β
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
- ITU-T Recommendation X.501, also known as ISO/IEC 9594-2: Information Technology β Open Systems Interconnection β The Directory: Models, section 9.3: Relative distinguished name
standards-coded, we love to see it π
π HISTORY π
X509_NAME_ENTRY_new() and X509_NAME_ENTRY_free() first appeared in SSLeay 0.5.1. and then X509_NAME_ENTRY_get_object(), X509_NAME_ENTRY_get_data(), X509_NAME_ENTRY_set_object(), X509_NAME_ENTRY_set_data(), X509_NAME_ENTRY_create_by_NID(), and X509_NAME_ENTRY_create_by_OBJ() first appeared in SSLeay 0.8.0. these functions have been available since OpenBSD 2.4. ancient. iconic. still here πβ¨
X509_NAME_ENTRY_create_by_txt() first appeared in OpenSSL 0.9.5 and has been available since OpenBSD 2.7. πΈ
X509_NAME_ENTRY_set() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3. the baby of the family πΌ
π CAVEATS π
not gonna lie, despite its name, X509_NAME_ENTRY_set() does not set anything. it gets. it retrieves. it's a getter with a villain origin story π. something like βX509_NAME_ENTRY_get_setβ would have been a better name. we said what we said π
and that's the whole page, bestie! this version came to you from Debian, dated December 21, 2025, and it's the X509_NAME_ENTRY_GET_OBJECT(3) page β mwah, go slay some X.509 ππ«Άπ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016, 2018, 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2002, 2005, 2006, 2017 The OpenSSL Project
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms