D2I_TS_REQ(3) | Library Functions Manual | D2I_TS_REQ(3)

# NAME

`d2i_TS_REQ`, `i2d_TS_REQ`, `d2i_TS_REQ_bio`, `i2d_TS_REQ_bio`, `d2i_TS_REQ_fp`, `i2d_TS_REQ_fp`, `d2i_TS_RESP`, `i2d_TS_RESP`, `d2i_TS_RESP_bio`, `i2d_TS_RESP_bio`, `d2i_TS_RESP_fp`, `i2d_TS_RESP_fp`, `d2i_TS_STATUS_INFO`, `i2d_TS_STATUS_INFO`, `d2i_TS_TST_INFO`, `i2d_TS_TST_INFO`, `d2i_TS_TST_INFO_bio`, `i2d_TS_TST_INFO_bio`, `d2i_TS_TST_INFO_fp`, `i2d_TS_TST_INFO_fp`, `d2i_TS_ACCURACY`, `i2d_TS_ACCURACY`, `d2i_TS_MSG_IMPRINT`, `i2d_TS_MSG_IMPRINT`, `d2i_TS_MSG_IMPRINT_bio`, `i2d_TS_MSG_IMPRINT_bio`, `d2i_TS_MSG_IMPRINT_fp`, `i2d_TS_MSG_IMPRINT_fp` — decode and encode X.509 time-stamp protocol structures

# SYNOPSIS

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

TS_REQ *
`d2i_TS_REQ`(TS_REQ **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_REQ`(const TS_REQ *val_in, unsigned char **der_out);

TS_REQ *
`d2i_TS_REQ_bio`(BIO *in_bio, TS_REQ **val_out);

int
`i2d_TS_REQ_bio`(BIO *out_bio, TS_REQ *val_in);

TS_REQ *
`d2i_TS_REQ_fp`(FILE *in_fp, TS_REQ **val_out);

int
`i2d_TS_REQ_fp`(FILE *out_fp, TS_REQ *val_in);

TS_RESP *
`d2i_TS_RESP`(TS_RESP **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_RESP`(const TS_RESP *val_in, unsigned char **der_out);

TS_RESP *
`d2i_TS_RESP_bio`(BIO *in_bio, TS_RESP **val_out);

int
`i2d_TS_RESP_bio`(BIO *out_bio, TS_RESP *val_in);

TS_RESP *
`d2i_TS_RESP_fp`(FILE *in_fp, TS_RESP **val_out);

int
`i2d_TS_RESP_fp`(FILE *out_fp, TS_RESP *val_in);

TS_STATUS_INFO *
`d2i_TS_STATUS_INFO`(TS_STATUS_INFO **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_STATUS_INFO`(const TS_STATUS_INFO *val_in, unsigned char **der_out);

TS_TST_INFO *
`d2i_TS_TST_INFO`(TS_TST_INFO **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_TST_INFO`(const TS_TST_INFO *val_in, unsigned char **der_out);

TS_TST_INFO *
`d2i_TS_TST_INFO_bio`(BIO *in_bio, TS_TST_INFO **val_out);

int
`i2d_TS_TST_INFO_bio`(BIO *out_bio, TS_TST_INFO *val_in);

TS_TST_INFO *
`d2i_TS_TST_INFO_fp`(FILE *in_fp, TS_TST_INFO **val_out);

int
`i2d_TS_TST_INFO_fp`(FILE *out_fp, TS_TST_INFO *val_in);

TS_ACCURACY *
`d2i_TS_ACCURACY`(TS_ACCURACY **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_ACCURACY`(const TS_ACCURACY *val_in, unsigned char **der_out);

TS_MSG_IMPRINT *
`d2i_TS_MSG_IMPRINT`(TS_MSG_IMPRINT **val_out, const unsigned char **der_in, long length);

int
`i2d_TS_MSG_IMPRINT`(const TS_MSG_IMPRINT *val_in, unsigned char **der_out);

TS_MSG_IMPRINT *
`d2i_TS_MSG_IMPRINT_bio`(BIO *in_bio, TS_MSG_IMPRINT **val_out);

int
`i2d_TS_MSG_IMPRINT_bio`(BIO *out_bio, TS_MSG_IMPRINT *val_in);

TS_MSG_IMPRINT *
`d2i_TS_MSG_IMPRINT_fp`(FILE *in_fp, TS_MSG_IMPRINT **val_out);

int
`i2d_TS_MSG_IMPRINT_fp`(FILE *out_fp, TS_MSG_IMPRINT *val_in);

# DESCRIPTION

These functions decode and encode X.509 structures used for the time-stamp protocol. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

`d2i_TS_REQ`() and `i2d_TS_REQ`() decode and encode an ASN.1 TimeStampReq structure defined in RFC 3161 section 2.4.1. `d2i_TS_REQ_bio`(), `i2d_TS_REQ_bio`(), `d2i_TS_REQ_fp`(), and `i2d_TS_REQ_fp`() are similar except that they decode or encode using a BIO or FILE pointer.

`d2i_TS_RESP`() and `i2d_TS_RESP`() decode and encode an ASN.1 TimeStampResp structure defined in RFC 3161 section 2.4.2. `d2i_TS_RESP_bio`(), `i2d_TS_RESP_bio`(), `d2i_TS_RESP_fp`(), and `i2d_TS_RESP_fp`() are similar except that they decode or encode using a BIO or FILE pointer.

`d2i_TS_STATUS_INFO`() and `i2d_TS_STATUS_INFO`() decode and encode an ASN.1 PKIStatusInfo structure defined in RFC 3161 section 2.4.2.

`d2i_TS_TST_INFO`() and `i2d_TS_TST_INFO`() decode and encode an ASN.1 TSTInfo structure defined in RFC 3161 section 2.4.2. `d2i_TS_TST_INFO_bio`(), `i2d_TS_TST_INFO_bio`(), `d2i_TS_TST_INFO_fp`(), and `i2d_TS_TST_INFO_fp`() are similar except that they decode or encode using a BIO or FILE pointer.

`d2i_TS_ACCURACY`() and `i2d_TS_ACCURACY`() decode and encode an ASN.1 Accuracy structure defined in RFC 3161 section 2.4.2.

`d2i_TS_MSG_IMPRINT`() and `i2d_TS_MSG_IMPRINT`() decode and encode an ASN.1 MessageImprint structure defined in RFC 3161 section 2.4.1. `d2i_TS_MSG_IMPRINT_bio`(), `i2d_TS_MSG_IMPRINT_bio`(), `d2i_TS_MSG_IMPRINT_fp`(), and `i2d_TS_MSG_IMPRINT_fp`() are similar except that they decode or encode using a BIO or FILE pointer.

# RETURN VALUES

`d2i_TS_REQ`(), `d2i_TS_REQ_bio`(), `d2i_TS_REQ_fp`(), `d2i_TS_RESP`(), `d2i_TS_RESP_bio`(), `d2i_TS_RESP_fp`(), `d2i_TS_STATUS_INFO`(), `d2i_TS_TST_INFO`(), `d2i_TS_TST_INFO_bio`(), `d2i_TS_TST_INFO_fp`(), `d2i_TS_ACCURACY`(), `d2i_TS_MSG_IMPRINT`(), `d2i_TS_MSG_IMPRINT_bio`(), and `d2i_TS_MSG_IMPRINT_fp`() return an object of the respective type or `NULL` if an error occurs.

`i2d_TS_REQ`(), `i2d_TS_RESP`(), `i2d_TS_STATUS_INFO`(), `i2d_TS_TST_INFO`(), `i2d_TS_ACCURACY`(), and `i2d_TS_MSG_IMPRINT`() return the number of bytes successfully encoded or a negative value if an error occurs.

`i2d_TS_REQ_bio`(), `i2d_TS_REQ_fp`(), `i2d_TS_RESP_bio`(), `i2d_TS_RESP_fp`(), `i2d_TS_TST_INFO_bio`(), `i2d_TS_TST_INFO_fp`(), `i2d_TS_MSG_IMPRINT_bio`(), and `i2d_TS_MSG_IMPRINT_fp`() return 1 for success or 0 if an error occurs.

# SEE ALSO

ASN1_item_d2i(3), TS_REQ_new(3)

# STANDARDS

RFC 3161: Internet X.509 Public Key Infrastructure Time-Stamp Protocol

# HISTORY

These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.

June 8, 2025 | Debian