---
name: "libressl-X509_REQ_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_REQ_new"
---

# libressl-X509\_REQ\_new(3)

PKCS#10 certification requests

## NAME

**X509\_REQ\_new**, **X509\_REQ\_dup**, **X509\_to\_X509\_REQ**, **X509\_REQ\_free**, **X509\_REQ\_INFO\_new**, **X509\_REQ\_INFO\_free** – PKCS#10 certification requests

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509.h\>**

*X509\_REQ* *\**\

**X509\_REQ\_new**(*void*);

*X509\_REQ* *\**\

**X509\_REQ\_dup**(*X509\_REQ \*req*);

*X509\_REQ* *\**\

**X509\_to\_X509\_REQ**(*X509 \*x*, *EVP\_PKEY \*pkey*, *const EVP\_MD \*md*);

*void*\

**X509\_REQ\_free**(*X509\_REQ \*req*);

*X509\_REQ\_INFO* *\**\

**X509\_REQ\_INFO\_new**(*void*);

*void*\

**X509\_REQ\_INFO\_free**(*X509\_REQ\_INFO \*req\_info*);

## DESCRIPTION

**X509\_REQ\_new**() allocates and initializes an empty *X509\_REQ* object, representing an ASN.1 *CertificationRequest* structure defined in RFC 2986 section 4.2. It can hold a pointer to an *X509\_REQ\_INFO* object discussed below together with a cryptographic signature and information about the signature algorithm used.

**X509\_REQ\_dup**() creates a deep copy of *req* using ASN1\_item\_dup(3), setting the reference count of the copy to 1.

**X509\_to\_X509\_REQ**() allocates a new certification request object, copies the subject name and the public key into it from the certificate *x*, and sets the version to zero. Unless *pkey* is NULL, it also signs the request with X509\_REQ\_sign(3) using *pkey* and *md*.

**X509\_REQ\_free**() frees *req*. If *req* is a NULL pointer, no action occurs.

**X509\_REQ\_INFO\_new**() allocates and initializes an empty *X509\_REQ\_INFO* object, representing an ASN.1 *CertificationRequestInfo* structure defined in RFC 2986 section 4.1. It is used inside the *X509\_REQ* object and can hold the subject and the public key of the requested certificate and additional attributes. **X509\_REQ\_INFO\_free**() frees *req\_info*. If *req\_info* is a NULL pointer, no action occurs.

## RETURN VALUES

**X509\_REQ\_new**(), **X509\_REQ\_dup**(), **X509\_to\_X509\_REQ**(), and **X509\_REQ\_INFO\_new**() return the new *X509\_REQ* or *X509\_REQ\_INFO* object, respectively, or NULL if an error occurs.

## SEE ALSO

d2i\_X509\_REQ(3), PEM\_read\_X509\_REQ(3), X509\_new(3), X509\_REQ\_add1\_attr(3), X509\_REQ\_add\_extensions(3), X509\_REQ\_check\_private\_key(3), X509\_REQ\_digest(3), X509\_REQ\_get0\_signature(3), X509\_REQ\_get\_pubkey(3), X509\_REQ\_get\_subject\_name(3), X509\_REQ\_get\_version(3), X509\_REQ\_print\_ex(3), X509\_REQ\_sign(3)

## STANDARDS

RFC 2986: PKCS #10: Certification Request Syntax Specification

## HISTORY

**X509\_REQ\_new**(), **X509\_REQ\_free**(), **X509\_REQ\_INFO\_new**(), and **X509\_REQ\_INFO\_free**() first appeared in SSLeay 0.4.4, **X509\_REQ\_dup**() in SSLeay 0.5.1, and **X509\_to\_X509\_REQ**() in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.
