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

# libressl-d2i\_X509\_REQ(3)

decode and encode PKCS#10 certification requests

## NAME

**d2i\_X509\_REQ**, **i2d\_X509\_REQ**, **d2i\_X509\_REQ\_bio**, **d2i\_X509\_REQ\_fp**, **i2d\_X509\_REQ\_bio**, **i2d\_X509\_REQ\_fp**, **d2i\_X509\_REQ\_INFO**, **i2d\_X509\_REQ\_INFO** – decode and encode PKCS#10 certification requests

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*X509\_REQ* *\**\

**d2i\_X509\_REQ**(*X509\_REQ \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_X509\_REQ**(*X509\_REQ \*val\_in*, *unsigned char \*\*der\_out*);

*X509\_REQ* *\**\

**d2i\_X509\_REQ\_bio**(*BIO \*in\_bio*, *X509\_REQ \*\*val\_out*);

*X509\_REQ* *\**\

**d2i\_X509\_REQ\_fp**(*FILE \*in\_fp*, *X509\_REQ \*\*val\_out*);

*int*\

**i2d\_X509\_REQ\_bio**(*BIO \*out\_bio*, *X509\_REQ \*val\_in*);

*int*\

**i2d\_X509\_REQ\_fp**(*FILE \*out\_fp*, *X509\_REQ \*val\_in*);

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

**d2i\_X509\_REQ\_INFO**(*X509\_REQ\_INFO \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_X509\_REQ\_INFO**(*X509\_REQ\_INFO \*val\_in*, *unsigned char \*\*der\_out*);

## DESCRIPTION

These functions decode and encode PKCS#10 certification requests. For details about the semantics, examples, caveats, and bugs, see ASN1\_item\_d2i(3).

**d2i\_X509\_REQ**() and **i2d\_X509\_REQ**() decode and encode an ASN.1 *CertificationRequest* structure defined in RFC 2986 section 4.2. **d2i\_X509\_REQ\_bio**(), **d2i\_X509\_REQ\_fp**(), **i2d\_X509\_REQ\_bio**(), and **i2d\_X509\_REQ\_fp**() are similar except that they decode or encode using a *BIO* or *FILE* pointer.

**d2i\_X509\_REQ\_INFO**() and **i2d\_X509\_REQ\_INFO**() decode and encode an ASN.1 *CertificationRequestInfo* structure defined in RFC 2986 section 4.1.

## RETURN VALUES

**d2i\_X509\_REQ**(), **d2i\_X509\_REQ\_bio**(), and **d2i\_X509\_REQ\_fp**() return an *X509\_REQ* object or NULL if an error occurs.

**d2i\_X509\_REQ\_INFO**() returns an *X509\_REQ\_INFO* object or NULL if an error occurs.

**i2d\_X509\_REQ**() and **i2d\_X509\_REQ\_INFO**() return the number of bytes successfully encoded or a negative value if an error occurs.

**i2d\_X509\_REQ\_bio**() and **i2d\_X509\_REQ\_fp**() return 1 for success or 0 if an error occurs.

## SEE ALSO

ASN1\_item\_d2i(3), PEM\_read\_X509\_REQ(3), X509\_REQ\_new(3)

## STANDARDS

RFC 2986: PKCS #10: Certification Request Syntax Specification

## HISTORY

**d2i\_X509\_REQ**(), **i2d\_X509\_REQ**(), **d2i\_X509\_REQ\_fp**(), **i2d\_X509\_REQ\_fp**(), **d2i\_X509\_REQ\_INFO**(), and **i2d\_X509\_REQ\_INFO**() first appeared in SSLeay 0.5.1. **d2i\_X509\_REQ\_bio**() and **i2d\_X509\_REQ\_bio**() first appeared in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.
