TS_VERIFY_CTX(3ossl)
π NAME π
Hiii bestie, welcome to the TS_VERIFY_CTX(3ossl) page from the OpenSSL manual β¨ β this is the whole squad of functions that manage the TS response verification context. The full lineup is: TS_VERIFY_CTX, TS_VERIFY_CTX_new, TS_VERIFY_CTX_init, TS_VERIFY_CTX_free, TS_VERIFY_CTX_cleanup, TS_VERIFY_CTX_set_flags, TS_VERIFY_CTX_add_flags, TS_VERIFY_CTX_set0_data, TS_VERIFY_CTX_set0_imprint, TS_VERIFY_CTX_set0_store, TS_VERIFY_CTX_set0_certs, TS_VERIFY_CTX_set_certs, TS_VERIFY_CTS_set_certs, TS_VERIFY_CTX_set_data, TS_VERIFY_CTX_set_imprint, TS_VERIFY_CTX_set_store.
Yes, that's a lot of names. Yes, some of them are deprecated. We'll get to that, don't worry π
πΈ SYNOPSIS πΈ
#include <openssl/ts.h>
typedef struct TS_verify_ctx TS_VERIFY_CTX;
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);
int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f);
int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f);
int TS_VERIFY_CTX_set0_data(TS_VERIFY_CTX *ctx, BIO *b);
int TS_VERIFY_CTX_set0_imprint(TS_VERIFY_CTX *ctx,
unsigned char *hexstr, long len);
int TS_VERIFY_CTX_set0_store(TS_VERIFY_CTX *ctx, X509_STORE *s);
int TS_VERIFY_CTX_set0_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs);
The following functions have been deprecated since OpenSSL 3.4:
BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b);
unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
unsigned char *hexstr, long len);
X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s);
STACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx,
STACK_OF(X509) *certs);
The following function has been deprecated since OpenSSL 3.0:
STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,
STACK_OF(X509) *certs);
π¦ DESCRIPTION π¦
Okay so, the Time-Stamp Protocol (TSP) is defined by RFC 3161. TSP is a protocol used to provide long-term proof of the existence of certain data before a particular time π°οΈ. TSP defines a Time Stamping Authority (TSA) and an entity that makes requests to the TSA. Usually, the TSA is referred to as the server side, and the requesting entity is referred to as the client.
In TSP, when a server sends a response to a client, the server normally needs to sign the response data β the TimeStampToken (TST) β with its private key. Then the client verifies the received TST using the server's certificate chain π. It's giving trust-but-verify, and honestly? Iconic.
For all the following methods, unless noted otherwise, ctx is the verification context created in advance.
TS_VERIFY_CTX_new()β returns an allocatedTS_VERIFY_CTXstructure β¨.TS_VERIFY_CTX_init()β initializes a verification context.TS_VERIFY_CTX_free()β frees up aTS_VERIFY_CTXobject.ctxis the verification context to be freed. IfctxisNULL, the call is ignored (so no dramatic crash, she just moves on π ).TS_VERIFY_CTX_set_flags()β sets the flags in the verification context.fare the flags to be set.TS_VERIFY_CTX_add_flags()β adds flags to the verification context.fare the flags to be added (OR'd).TS_VERIFY_CTX_set0_data()β sets the data to be verified.bis theBIOwith the data. A previously assignedBIOis freed π«Ά.TS_VERIFY_CTX_set0_imprint()β sets the message imprint.hexstris the message imprint to be assigned. A previously assigned imprint is freed.TS_VERIFY_CTX_set0_store()β sets the store for the verification context.sis the store to be assigned. A previously assigned store is freed.TS_VERIFY_CTX_set0_certs()β used to set the server's certificate chain when verifying a TST.certsis a stack ofX509certificates.TS_VERIFY_CTX_cleanup()β frees all data associated with the givenTS_VERIFY_CTXobject and initializes it.ctxis the verification context created in advance. IfctxisNULL, the call is ignored.
π The deprecated girlies (read the fine print, bestie) π
All of the following functions described are deprecated. Applications should instead use the functions TS_VERIFY_CTX_set0_data(3), TS_VERIFY_CTX_set0_imprint(3), TS_VERIFY_CTX_set0_store(3), TS_VERIFY_CTX_set0_certs(3).
Like, they still work, but they're the old version of the outfit. The set0_ ones are the main character now π
TS_VERIFY_CTX_set_data()β used to set theBIOwith the data to be verified. A previously assignedBIOis not freed by this call π.bis theBIOwith the data to assign.TS_VERIFY_CTX_set_imprint()β used to set the message imprint. A previously assigned imprint is freed by this call.hexstris the string with the message imprint to assign.TS_VERIFY_CTX_set_store()β used to set the certificate store. A previously assigned store is not freed by this call.sis the store to assign.TS_VERIFY_CTX_set_certs()β used to set the server's certificate chain. A previously assigned stack is not freed by this call.certsis a stack ofX509certificates.TS_VERIFY_CTS_set_certs()β a misspelled version ofTS_VERIFY_CTX_set_certs()which takes the same parameters and returns the same result. Yes, the typo is canon. It's in the ABI. We keep her for compatibility π«
β RETURN VALUES β
TS_VERIFY_CTX_new()β returns an allocatedTS_VERIFY_CTXstructure.TS_VERIFY_CTX_set_flags()β returns the flags passed via parameterf.TS_VERIFY_CTX_add_flags()β returns the flags of the context after the ones passed via parameterfare added to it.TS_VERIFY_CTX_set0_data(),TS_VERIFY_CTX_set0_imprint(),TS_VERIFY_CTX_set0_store(), andTS_VERIFY_CTX_set0_certs()β return1if the value could be successfully set and0in case of any error. Slay or flop, no in-between π- The deprecated functions
TS_VERIFY_CTX_set_data(),TS_VERIFY_CTX_set_imprint(),TS_VERIFY_CTX_set_store(),TS_VERIFY_CTX_set_certs()β return the parameter the user passes via parameterbio,hexstr,sorcerts.
π SEE ALSO π
OSSL_ESS_check_signing_certs(3) β go read that one too, bestie, it's the whole ecosystem π§
π₯ HISTORY π₯
TS_VERIFY_CTX_set0_data(), TS_VERIFY_CTX_set0_imprint(), TS_VERIFY_CTX_set0_store(), TS_VERIFY_CTX_set0_certs() replace the functions TS_VERIFY_CTX_set_data(), TS_VERIFY_CTX_set_imprint(), TS_VERIFY_CTX_set_store(), TS_VERIFY_CTX_set_certs() that were deprecated in OpenSSL 3.4.0.
The spelling of TS_VERIFY_CTX_set_certs() was corrected in OpenSSL 3.0.0. The misspelled version TS_VERIFY_CTS_set_certs() has been retained for compatibility reasons, but it is deprecated in OpenSSL 3.0.0. Not me mourning the typo era πͺ¦
π COPYRIGHT π
Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
And that's the page, bestie π This one's from 3.5.6, dated 2026-04-07, and it's the TS_VERIFY_CTX(3ossl) manual page β you're so welcome, go verify some timestamps ππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms