D2I_OCSP_RESPONSE(3) | Library Functions Manual | D2I_OCSP_RESPONSE(3)

# NAME

`d2i_OCSP_RESPONSE`, `i2d_OCSP_RESPONSE`, `d2i_OCSP_RESPBYTES`, `i2d_OCSP_RESPBYTES`, `d2i_OCSP_BASICRESP`, `i2d_OCSP_BASICRESP`, `d2i_OCSP_RESPDATA`, `i2d_OCSP_RESPDATA`, `d2i_OCSP_RESPID`, `i2d_OCSP_RESPID`, `d2i_OCSP_SINGLERESP`, `i2d_OCSP_SINGLERESP`, `d2i_OCSP_CERTSTATUS`, `i2d_OCSP_CERTSTATUS`, `d2i_OCSP_REVOKEDINFO`, `i2d_OCSP_REVOKEDINFO`, `d2i_OCSP_CRLID`, `i2d_OCSP_CRLID` — decode and encode OCSP responses

# SYNOPSIS

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

OCSP_RESPONSE *
`d2i_OCSP_RESPONSE`(OCSP_RESPONSE **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_RESPONSE`(OCSP_RESPONSE *val_in, unsigned char **der_out);

OCSP_RESPBYTES *
`d2i_OCSP_RESPBYTES`(OCSP_RESPBYTES **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_RESPBYTES`(OCSP_RESPBYTES *val_in, unsigned char **der_out);

OCSP_BASICRESP *
`d2i_OCSP_BASICRESP`(OCSP_BASICRESP **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_BASICRESP`(OCSP_BASICRESP *val_in, unsigned char **der_out);

OCSP_RESPDATA *
`d2i_OCSP_RESPDATA`(OCSP_RESPDATA **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_RESPDATA`(OCSP_RESPDATA *val_in, unsigned char **der_out);

OCSP_RESPID *
`d2i_OCSP_RESPID`(OCSP_RESPID **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_RESPID`(OCSP_RESPID *val_in, unsigned char **der_out);

OCSP_SINGLERESP *
`d2i_OCSP_SINGLERESP`(OCSP_SINGLERESP **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_SINGLERESP`(OCSP_SINGLERESP *val_in, unsigned char **der_out);

OCSP_CERTSTATUS *
`d2i_OCSP_CERTSTATUS`(OCSP_CERTSTATUS **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_CERTSTATUS`(OCSP_CERTSTATUS *val_in, unsigned char **der_out);

OCSP_REVOKEDINFO *
`d2i_OCSP_REVOKEDINFO`(OCSP_REVOKEDINFO **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_REVOKEDINFO`(OCSP_REVOKEDINFO *val_in, unsigned char **der_out);

OCSP_CRLID *
`d2i_OCSP_CRLID`(OCSP_CRLID **val_out, const unsigned char **der_in, long length);

int
`i2d_OCSP_CRLID`(OCSP_CRLID *val_in, unsigned char **der_out);

# DESCRIPTION

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

`d2i_OCSP_RESPONSE`() and `i2d_OCSP_RESPONSE`() decode and encode an ASN.1 OCSPResponse structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_RESPBYTES`() and `i2d_OCSP_RESPBYTES`() decode and encode an ASN.1 ResponseBytes structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_BASICRESP`() and `i2d_OCSP_BASICRESP`() decode and encode an ASN.1 BasicOCSPResponse structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_RESPDATA`() and `i2d_OCSP_RESPDATA`() decode and encode an ASN.1 ResponseData structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_RESPID`() and `i2d_OCSP_RESPID`() decode and encode an ASN.1 ResponderID structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_SINGLERESP`() and `i2d_OCSP_SINGLERESP`() decode and encode an ASN.1 SingleResponse structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_CERTSTATUS`() and `i2d_OCSP_CERTSTATUS`() decode and encode an ASN.1 CertStatus structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_REVOKEDINFO`() and `i2d_OCSP_REVOKEDINFO`() decode and encode an ASN.1 RevokedInfo structure defined in RFC 6960 section 4.2.1.

`d2i_OCSP_CRLID`() and `i2d_OCSP_CRLID`() decode and encode an ASN.1 CrlID structure defined in RFC 6960 section 4.4.2.

# RETURN VALUES

`d2i_OCSP_RESPONSE`(), `d2i_OCSP_RESPBYTES`(), `d2i_OCSP_BASICRESP`(), `d2i_OCSP_RESPDATA`(), `d2i_OCSP_RESPID`(), `d2i_OCSP_SINGLERESP`(), `d2i_OCSP_CERTSTATUS`(), `d2i_OCSP_REVOKEDINFO`(), and `d2i_OCSP_CRLID`() return an object of the respective type or `NULL` if an error occurs.

`i2d_OCSP_RESPONSE`(), `i2d_OCSP_RESPBYTES`(), `i2d_OCSP_BASICRESP`(), `i2d_OCSP_RESPDATA`(), `i2d_OCSP_RESPID`(), `i2d_OCSP_SINGLERESP`(), `i2d_OCSP_CERTSTATUS`(), `i2d_OCSP_REVOKEDINFO`(), and `i2d_OCSP_CRLID`() return the number of bytes successfully encoded or a negative value if an error occurs.

# SEE ALSO

ASN1_item_d2i(3), OCSP_CRLID_new(3), OCSP_REQUEST_new(3), OCSP_RESPONSE_new(3), OCSP_SINGLERESP_new(3)

# STANDARDS

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

# HISTORY

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

June 8, 2025 | Debian