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

# libressl-d2i\_TS\_REQ(3)

decode and encode X.509 time-stamp protocol structures

## 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

Crypto Library (libcrypto, -lcrypto)

**#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.
