X509_NAME_NEW(3) | Library Functions Manual | X509_NAME_NEW(3)

# NAME

`X509_NAME_new`, `X509_NAME_free` — X.501 Name object

# SYNOPSIS

library “libcrypto”
`#include <openssl/x509.h>`

X509_NAME *
`X509_NAME_new`(void);

void
`X509_NAME_free`(X509_NAME *name);

# DESCRIPTION

An X.501 Name is an ordered sequence of relative distinguished names. A relative distinguished name is a set of key-value pairs; see X509_NAME_ENTRY_new(3) for details.

Various X.509 structures contain X.501 Name substructures. They are for example used for the issuers of certificates and certificate revocation lists and for the subjects of certificates and certificate requests.

`X509_NAME_new`() allocates and initializes an empty X509_NAME object, representing an ASN.1 Name structure defined in RFC 5280 section 4.1.2.4. Data can be added to such objects with the functions described in X509_NAME_add_entry_by_txt(3), and they can be inspected with the functions described in X509_NAME_get_index_by_NID(3).

`X509_NAME_free`() frees name and all the X509_NAME_ENTRY objects contained in it. If name is a `NULL` pointer, no action occurs.

# RETURN VALUES

`X509_NAME_new`() returns a new X509_NAME object or `NULL` if an error occurred.

# SEE ALSO

d2i_X509_NAME(3), GENERAL_NAME_new(3), NAME_CONSTRAINTS_new(3), SSL_load_client_CA_file(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_cmp(3), X509_NAME_digest(3), X509_NAME_ENTRY_new(3), X509_NAME_get_index_by_NID(3), X509_NAME_hash(3), X509_NAME_print_ex(3), X509_new(3)

# 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: Names

# HISTORY

`X509_NAME_new`() and `X509_NAME_free`() appeared in SSLeay 0.4 or earlier and have been available since OpenBSD 2.4.

June 8, 2025 | Debian