OPENSSL-TS(1ossl)
๐ NAME ๐
okay bestie, welcome to openssl-ts(1ossl) โ this is openssl-ts - Time Stamping Authority command. That's the whole NAME section, and yes, it's giving main-character crypto energy. ๐
๐ธ SYNOPSIS ๐ธ
these are the exact invocation shapes, so keep the flags exactly as written โ no renaming, no merging, no "I thought it said..." energy. ๐
openssl ts -help
the query era:
openssl ts -query [-config configfile] [-data file_to_hash] [-digest
digest_bytes] [-digest] [-tspolicy object_id] [-no_nonce] [-cert] [-in
request.tsq] [-out request.tsq] [-text] [-rand files] [-writerand file]
[-provider name] [-provider-path path] [-provparam [name:]key=value]
[-propquery propq]
the reply era:
openssl ts -reply [-config configfile] [-section tsa_section]
[-queryfile request.tsq] [-passin password_src] [-signer tsa_cert.pem]
[-inkey filename|uri] [-digest] [-chain certs_file.pem] [-tspolicy
object_id] [-in response.tsr] [-token_in] [-out response.tsr]
[-token_out] [-text] [-engine id] [-provider name] [-provider-path path]
[-provparam [name:]key=value] [-propquery propq]
the verify era, and bestie it has a lot of options:
openssl ts -verify [-data file_to_hash] [-digest digest_bytes]
[-queryfile request.tsq] [-in response.tsr] [-token_in] [-untrusted
files|uris] [-CAfile file] [-CApath dir] [-CAstore uri]
[-allow_proxy_certs] [-attime timestamp] [-no_check_time]
[-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy]
[-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map]
[-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose
purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first]
[-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num]
[-verify_email email] [-verify_hostname hostname] [-verify_ip ip]
[-verify_name name] [-x509_strict] [-issuer_checks] [-provider name]
[-provider-path path] [-provparam [name:]key=value] [-propquery propq]
๐ DESCRIPTION ๐
okay so openssl ts is your basic Time Stamping Authority (TSA) client and server application, exactly as specified in RFC 3161 (Time-Stamp Protocol, TSP). A TSA can be part of a PKI deployment, and its whole role is to provide long term proof of the existence of a certain datum before a particular time. iconic, honestly. ๐ฐ๏ธโจ
here's the protocol tea in three little steps:
- The TSA client computes a one-way hash value for a data file and sends the hash to the TSA. no cap, that's step one. ๐ฆ
- The TSA attaches the current date and time to the received hash value, signs them and sends the timestamp token back to the client. By creating this token the TSA certifies the existence of the original data file at the time of response generation. literally the receipt from the timestamp gods. โจ
- The TSA client receives the timestamp token and verifies the signature on it. It also checks if the token contains the same hash value that it had sent to the TSA. vibe check on the hash, periodt. ๐
there is one DER encoded protocol data unit defined for transporting a timestamp request to the TSA and one for sending the timestamp response back to the client. so yes, DER encoded, both directions, that's the transport tea. ๐
this command has three main functions: creating a timestamp request based on a data file, creating a timestamp response based on a request, verifying if a response corresponds to a particular request or a data file. three jobs, one command, main character energy. ๐
heads up bestie: there is no support for sending the requests/responses automatically over HTTP or TCP yet as suggested in RFC 3161. The users must send the requests either by ftp or e-mail. that's the rule, no cap. ๐ญ๐ฎ
๐ OPTIONS ๐
-helpโ prints a usage message, so you know what's up โจ-queryโ makes a TS query, bestie. Full deets live in "Timestamp Request generation" ๐-replyโ makes a TS reply. Deets in "Timestamp Response generation" ๐-verifyโ checks a TS response. Deets in "Timestamp Response verification" ๐ซถ
๐ธ Timestamp Request generation ๐ธ
The -query command is your girl for creating and printing a timestamp request, and these are the options that come with it:
-configconfigfile โ the config file to use. Optional! For what the default is, peek at "COMMAND SUMMARY" inopenssl(1)๐-datafile_to_hash โ the data file you need the timestamp request created for. If you pass neither-datanor the-digestparameter,stdinis the default, no cap. (Optional)-digestdigest_bytes โ okay so you can literally spell out the message imprint yourself without a data file. It's gotta be hex format, two characters per byte, and the bytes can optionally be separated by colons (like1A:F6:01:...or1AF601...). The number of bytes has to match the message digest algorithm in use. (Optional)-digestโ the message digest to apply to the data file. Any digest that theopenssl-dgst(1)command supports works here. Default isSHA-256. (Optional)-tspolicyobject_id โ the policy the client expects the TSA to use when making the timestamp token. You can use dotted OID notation or OID names defined in the config file. If no policy is requested, the TSA just uses its own default policy. (Optional)-no_nonceโ pass this and no nonce goes in the request. Otherwise a 64-bit long pseudo-random nonce is included. Highly recommend using a nonce to protect against replay attacks, fr fr ๐ฅ (Optional)-certโ the TSA is expected to include its signing certificate in the response. (Optional)-inrequest.tsq โ names a previously created timestamp request in DER format that gets printed into the output file. Super useful when you need to examine a request's content in human-readable format ๐ (Optional)-outrequest.tsq โ name of the output file the request gets written to. Default isstdout. (Optional)-textโ if you specify this, the output is human-readable text format instead of DER. (Optional)-randfiles,-writerandfile โ see "Random State Options" inopenssl(1)for the deets ๐
๐ Timestamp Response generation ๐
A timestamp response (TimeStampResp) consists of a response status plus the timestamp token itself (ContentInfo), if the token generation was successful. The -reply command is for creating a timestamp response or timestamp token based on a request, and printing the response/token in human-readable format. If -token_out is not specified, the output is always a timestamp response (TimeStampResp) โ otherwise it's a timestamp token (ContentInfo) โญ
-configconfigfile โ the config file to use. Optional! For what the default is, see "COMMAND SUMMARY" inopenssl(1). Also check "CONFIGURATION FILE OPTIONS" for the configurable variables ๐-sectiontsa_section โ the name of the config file section holding the settings for response generation. If you don't specify it, the default TSA section is used, see "CONFIGURATION FILE OPTIONS" for details. (Optional)-queryfilerequest.tsq โ the name of the file containing a DER encoded timestamp request. (Optional)-passinpassword_src โ specifies the password source for the private key of the TSA. See the description inopenssl(1). (Optional)-signertsa_cert.pem โ the signer certificate of the TSA in PEM format. Heads up: the TSA signing certificate must have exactly one extended key usage assigned to it:timeStamping. That extended key usage also has to be critical, otherwise the certificate is going to be refused, periodt ๐ Overrides thesigner_certvariable of the config file. (Optional)-inkeyfilename|uri โ the signer private key of the TSA in PEM format. Overrides thesigner_keyconfig file option. (Optional)-digestโ the signing digest to use. Overrides thesigner_digestconfig file option. (Mandatory unless it's specified in the config file ๐)-chaincerts_file.pem โ the collection of certificates in PEM format that all get included in the response in addition to the signer certificate if the-certoption was used for the request. This file is supposed to contain the certificate chain for the signer certificate from its issuer upwards. Ngl the-replycommand does not build a certificate chain automatically. (Optional)-tspolicyobject_id โ the default policy to use for the response unless the client explicitly requires a particular TSA policy. The OID can be given in dotted notation or with its name. Overrides thedefault_policyconfig file option. (Optional)-inresponse.tsr โ specifies a previously created timestamp response, or timestamp token (if-token_inis also specified), in DER format that gets written to the output file. This option does not require a request โ it's useful, like, when you need to examine the content of a response or token, or when you wanna extract the timestamp token from a response. If the input is a token and the output is a timestamp response, a default'granted'status info is added to the token. (Optional)-token_inโ this flag can be used together with the-inoption and it indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)-outresponse.tsr โ the response is written to this file. The format and content of the file depends on other options (see-text,-token_out). Default isstdout. (Optional)-token_outโ the output is a timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)-textโ if this option is specified, the output is human-readable text format instead of DER. (Optional)-engineid โ see "Engine Options" inopenssl(1). Btw this option is deprecated ๐ซ-providername-provider-pathpath-provparam[name:]key=value-propquerypropq โ see "Provider Options" inopenssl(1),provider(7), andproperty(7)โจ
๐ฆ Timestamp Response verification ๐ฆ
The -verify command is for verifying whether a timestamp response or timestamp token is valid and matches a particular timestamp request or data file. Little flex: the -verify command does not use the configuration file ๐
-datafile_to_hash โ the response or token must be verified against file_to_hash. The file is hashed with the message digest algorithm specified in the token. The-digestand-queryfileoptions must not be specified with this one. (Optional)-digestdigest_bytes โ the response or token must be verified against the message digest specified with this option. The number of bytes must match the message digest algorithm specified in the token. The-dataand-queryfileoptions must not be specified with this one. (Optional)-queryfilerequest.tsq โ the original timestamp request in DER format. The-dataand-digestoptions must not be specified with this one. (Optional)-inresponse.tsr โ the timestamp response that needs to be verified, in DER format. (Mandatory ๐)-token_inโ this flag can be used together with the-inoption and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)-untrustedfiles|uris โ a set of additional untrusted certificates which might be needed when building the certificate chain for the TSA's signing certificate. These don't need to contain the TSA signing certificate and intermediate CA certificates as far as the response already includes them. (Optional)
Multiple sources may be given, separated by commas and/or whitespace. Each file may contain multiple certificates ๐
-CAfilefile,-CApathdir,-CAstoreuri โ see "Trusted Certificate Options" inopenssl-verification-options(1)for the deets. At least one of-CAfile,-CApathor-CAstoremust be specified โ ๏ธ-allow_proxy_certs,-attime,-no_check_time,-check_ss_sig,-crl_check,-crl_check_all,-explicit_policy,-extended_crl,-ignore_critical,-inhibit_any,-inhibit_map,-no_alt_chains,-partial_chain,-policy,-policy_check,-policy_print,-purpose,-suiteB_128,-suiteB_128_only,-suiteB_192,-trusted_first,-use_deltas,-auth_level,-verify_depth,-verify_email,-verify_hostname,-verify_ip,-verify_name,-x509_strict-issuer_checksโ set various options of certificate chain verification. See "Verification Options" inopenssl-verification-options(1)for details ๐
Any verification errors cause the command to exit, no exceptions ๐
๐ CONFIGURATION FILE OPTIONS ๐
Okay so bestie, here's the tea on -query and -reply โ they both vibe with a config file. Peep config(5) for the whole syntax situation. The -query command only ever touches the symbolic OID names section, and honestly it works fine without it. But -reply? She needs that config file to function, no cap.
And like, whenever there's a command line switch that matches a variable? The switch always wins. Always. Config file settings get overridden, periodt.
tsa section, default_tsa
This is the main character section โจ โ it specifies the name of another section that has all the options for the -reply command. You can override this default section with the -section command line switch. (Optional)
oid_file
Specifies a file with extra OBJECT IDENTIFIERS in it. Every line is: the numerical form of the object identifier, then whitespace, then the short name, then whitespace, then finally the long name. That's the whole lineup. (Optional)
oid_section
Specifies a section in the config file holding extra object identifiers. Each line is the short name of the OID, then =, then the numerical form. When you use this option the short and long names are the same. (Optional)
RANDFILE
At startup this file gets loaded into the random number generator, and at exit 256 bytes get written to it. (Note: using a RANDFILE is not necessary anymore, see the HISTORY section ๐)
serial
The name of the file containing the hexadecimal serial number of the last timestamp response created. This number gets incremented by 1 for each response. If the file doesn't exist when a response is generated, a new file is created with serial number 1. (Mandatory)
crypto_device
Specifies the OpenSSL engine that'll be set as the default for all available algorithms. Default value is built-in, but you can specify any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM). (Optional)
signer_cert
TSA signing certificate in PEM format. Same as the -signer command line option. (Optional)
certs
A file with a set of PEM encoded certificates that need to be included in the response. Same as the -chain command line option. (Optional)
signer_key
The private key of the TSA in PEM format. Same as the -inkey command line option. (Optional)
signer_digest
Which signing digest to use. Same as the -digest command line option. (Mandatory unless specified on the command line)
default_policy
The default policy to use when the request doesn't mandate any policy. Same as the -tspolicy command line option. (Optional)
other_policies
Comma separated list of policies the TSA also accepts โ these only get used if the request explicitly specifies one of them. (Optional)
digests
The list of message digest algorithms the TSA accepts. At least one algorithm must be specified. (Mandatory)
accuracy
The accuracy of the TSA's time source, in seconds, milliseconds and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any component is missing, zero is assumed for that field. (Optional)
clock_precision_digits
Specifies the max number of digits representing the fraction of seconds that need to be included in the time field. Trailing zeros must be removed from the time, so there might actually be fewer digits, or no fraction of seconds at all. Supported only on UNIX platforms. The maximum value is 6, default is 0. (Optional)
ordering
If this is yes, responses generated by this TSA can always be ordered, even if the time difference between two responses is less than the sum of their accuracies. Default is no. (Optional)
tsa_name
Set this to yes if the subject name of the TSA must be included in the TSA name field of the response. Default is no. (Optional)
ess_cert_id_chain
The SignedData objects the TSA creates always contain the certificate identifier of the signing certificate in a signed attribute (see RFC 2634, Enhanced Security Services). If this variable is no, only that signing certificate identifier goes into the SigningCertificate signed attribute. If it's yes and the certs variable or the -chain option is specified, then the certificate identifiers of the chain get included too โ and -chain overrides the certs variable. Default is no. (Optional)
ess_cert_id_alg
This one specifies the hash function used to calculate the TSA's public key certificate identifier. Default is sha256. (Optional)
๐ EXAMPLES ๐
Every example below just presumes OPENSSL_CONF is set to a proper configuration file โ like, the example config file openssl/apps/openssl.cnf will do the trick. ๐ซถ
โจ Timestamp Request โจ
To create a timestamp request for design1.txt with SHA-256 digest, no nonce, no policy, and no requirement for a certificate in the response:
openssl ts -query -data design1.txt -no_nonce \
-out design1.tsq
To create a similar timestamp request but specifying the message imprint explicitly:
openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
-no_nonce -out design1.tsq
To print the content of the previous request in human readable format:
openssl ts -query -in design1.tsq -text
To create a timestamp request that includes the SHA-512 digest of design2.txt, requests the signer certificate and nonce, and specifies a policy id (assuming tsa_policy1 is defined in the OID section of the config file):
openssl ts -query -data design2.txt -sha512 \
-tspolicy tsa_policy1 -cert -out design2.tsq
๐ Timestamp Response ๐
Before generating a response, a signing certificate must be created for the TSA โ one that contains the timeStamping critical extended key usage extension without any other key usage extensions. You can add this line to the user certificate section of the config file to generate a proper certificate:
extendedKeyUsage = critical,timeStamping
See openssl-req(1), openssl-ca(1), and openssl-x509(1) for instructions. The examples below assume cacert.pem contains the CA's certificate, tsacert.pem is the signing certificate issued by cacert.pem, and tsakey.pem is the private key of the TSA.
To create a timestamp response for a request:
openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \
-signer tsacert.pem -out design1.tsr
If you want to use the settings in the config file you could just write:
openssl ts -reply -queryfile design1.tsq -out design1.tsr
To print a timestamp reply to stdout in human readable format:
openssl ts -reply -in design1.tsr -text
To create a timestamp token instead of a timestamp response:
openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out
To print a timestamp token to stdout in human readable format:
openssl ts -reply -in design1_token.der -token_in -text -token_out
To extract the timestamp token from a response:
openssl ts -reply -in design1.tsr -out design1_token.der -token_out
To add 'granted' status info to a timestamp token, thereby creating a valid response:
openssl ts -reply -in design1_token.der -token_in -out design1.tsr
๐ฆ Timestamp Verification ๐ฆ
To verify a timestamp reply against a request:
openssl ts -verify -queryfile design1.tsq -in design1.tsr \
-CAfile cacert.pem -untrusted tsacert.pem
To verify a timestamp reply that includes the certificate chain:
openssl ts -verify -queryfile design2.tsq -in design2.tsr \
-CAfile cacert.pem
To verify a timestamp token against the original data file:
openssl ts -verify -data design2.txt -in design2.tsr \
-CAfile cacert.pem
To verify a timestamp token against a message imprint:
openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
-in design2.tsr -CAfile cacert.pem
You could also look at the test directory for more examples ๐
๐ BUGS ๐
- No support for timestamps over SMTP, though it's quite easy to implement an automatic e-mail based TSA with
procmail(1)andperl(1). HTTP server support is provided as a separate apache module. HTTP client support is provided bytsget(1). Pure TCP/IP protocol is not supported. - The file containing the last serial number of the TSA is not locked when being read or written. This is a whole problem if more than one instance of
openssl(1)is trying to create a timestamp response at the same time ๐ญ Not an issue when using the apache server module, she does proper locking. - Look for the
FIXMEword in the source files. - The source code should really be reviewed by somebody else, too.
- More testing is needed, I have done only some basic tests (see
test/testtsa).
๐ง HISTORY ๐ง
OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding mechanism. That new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring randomness. This option is retained mainly for compatibility reasons.
The -engine option was deprecated in OpenSSL 3.0.
๐ SEE ALSO ๐
openssl(1), tsget(1), openssl-req(1), openssl-x509(1), openssl-ca(1), openssl-genrsa(1), config(5), ossl_store-file(7)
๐ธ COPYRIGHT ๐ธ
Copyright 2006-2025 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 a wrap bestie!! ๐ This iconic little page is from OpenSSL 3.5.0, dated 2026-09-25, and lives under the name OPENSSL-TS(1ossl) โ go forth and timestamp slay โจ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 ยท Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 ยท Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 ยท Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms