---
name: "libressl-X509_NAME_new"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-X509_NAME_new"
---

# libressl-X509\_NAME\_new(3)

X.501 Name object

## NAME

**X509\_NAME\_new**, **X509\_NAME\_free** – X.501 Name object

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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.
