D2I_OCSP_REQUEST(3) | Library Functions Manual | D2I_OCSP_REQUEST(3)

# NAME

`d2i_OCSP_REQUEST`, `i2d_OCSP_REQUEST`, `d2i_OCSP_SIGNATURE`, `i2d_OCSP_SIGNATURE`, `d2i_OCSP_REQINFO`, `i2d_OCSP_REQINFO`, `d2i_OCSP_ONEREQ`, `i2d_OCSP_ONEREQ`, `d2i_OCSP_CERTID`, `i2d_OCSP_CERTID`, `d2i_OCSP_SERVICELOC`, `i2d_OCSP_SERVICELOC` — decode and encode OCSP requests

# SYNOPSIS

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

OCSP_REQUEST *
`d2i_OCSP_REQUEST`(OCSP_REQUEST **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_REQUEST`(OCSP_REQUEST *val_in, unsigned char **der_out);

OCSP_SIGNATURE *
`d2i_OCSP_SIGNATURE`(OCSP_SIGNATURE **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_SIGNATURE`(OCSP_SIGNATURE *val_in, unsigned char **der_out);

OCSP_REQINFO *
`d2i_OCSP_REQINFO`(OCSP_REQINFO **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_REQINFO`(OCSP_REQINFO *val_in, unsigned char **der_out);

OCSP_ONEREQ *
`d2i_OCSP_ONEREQ`(OCSP_ONEREQ **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_ONEREQ`(OCSP_ONEREQ *val_in, unsigned char **der_out);

OCSP_CERTID *
`d2i_OCSP_CERTID`(OCSP_CERTID **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_CERTID`(OCSP_CERTID *val_in, unsigned char **der_out);

OCSP_SERVICELOC *
`d2i_OCSP_SERVICELOC`(OCSP_SERVICELOC **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_SERVICELOC`(OCSP_SERVICELOC *val_in, unsigned char **der_out);

# DESCRIPTION

These functions decode and encode ASN.1 structures used for OCSP requests. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

`d2i_OCSP_REQUEST`() and `i2d_OCSP_REQUEST`() decode and encode an ASN.1 OCSPRequest structure defined in RFC 6960 section 4.1.1.

`d2i_OCSP_SIGNATURE`() and `i2d_OCSP_SIGNATURE`() decode and encode an ASN.1 Signature structure defined in RFC 6960 section 4.1.1.

`d2i_OCSP_REQINFO`() and `i2d_OCSP_REQINFO`() decode and encode an ASN.1 TBSRequest structure defined in RFC 6960 section 4.1.1.

`d2i_OCSP_ONEREQ`() and `i2d_OCSP_ONEREQ`() decode and encode an ASN.1 Request structure defined in RFC 6960 section 4.1.1.

`d2i_OCSP_CERTID`() and `i2d_OCSP_CERTID`() decode and encode an ASN.1 CertID structure defined in RFC 6960 section 4.1.1.

`d2i_OCSP_SERVICELOC`() and `i2d_OCSP_SERVICELOC`() decode and encode an ASN.1 ServiceLocator structure defined in RFC 6960 section 4.4.6.

# RETURN VALUES

`d2i_OCSP_REQUEST`(), `d2i_OCSP_SIGNATURE`(), `d2i_OCSP_REQINFO`(), `d2i_OCSP_ONEREQ`(), `d2i_OCSP_CERTID`(), and `d2i_OCSP_SERVICELOC`() return an object of the respective type or `NULL` if an error occurs.

`i2d_OCSP_REQUEST`(), `i2d_OCSP_SIGNATURE`(), `i2d_OCSP_REQINFO`(), `i2d_OCSP_ONEREQ`(), `i2d_OCSP_CERTID`(), and `i2d_OCSP_SERVICELOC`() return the number of bytes successfully encoded or a negative value if an error occurs.

# SEE ALSO

ASN1_item_d2i(3), OCSP_CERTID_new(3), OCSP_REQUEST_new(3), OCSP_SERVICELOC_new(3)

# STANDARDS

RFC 6960: X.509 Internet Public Key Infrastructure Online Certificate Status Protocol, section 4.1: Request Syntax

# HISTORY

These functions first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

June 8, 2025 | Debian