OPENSSL-TS(1ossl)
β¨ NAME β¨
openssl-ts β Time Stamping Authority command π
okay bestie, this is the openssl-ts page from the OpenSSL manual set β officially OPENSSL-TS(1ossl) β¨
π¦ SYNOPSIS π¦
hereβs the full shape of it, no cap β every flag and arg stays exactly as written:
openssl ts -help
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]
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]
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 real talk: this command is a 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 β
hereβs the brief protocol tea, bestie:
- The TSA client computes a one-way hash value for a data file and sends the hash to the TSA π₯
- 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 π
- 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 π
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 π 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 π
lowkey important: there is no support for sending the requests/responses automatically over HTTP or TCP yet as suggested inRFC 3161π The users must send the requests either byftpor
β¨ OPTIONS β¨
So like, here's the whole menu of flags bestie π every single one, no skips.
-helpβ prints out a usage message. that's it. that's the whole gig π«Ά-queryβ generates a TS query. for the deets, see "Timestamp Request generation" down below β¨-replyβ generates a TS reply. details live in "Timestamp Response generation" π-verifyβ verifies a TS response. see "Timestamp Response verification" for the full tea π΅
πΈ Timestamp Request generation πΈ
okay so the -query command is your girl for creating and printing a timestamp request, and these are the options she rolls with:
-configconfigfile β the configuration file to use. it's Optional; for what the default value is, go look at "COMMAND SUMMARY" inopenssl(1)π-datafile_to_hash β the data file you need the timestamp request created for. if neither-datanor-digestis specified,stdinis the default. (Optional) π-digestdigest_bytes β yes you can specify the message imprint explicitly without the data file!! the imprint has to be in hexadecimal format, two characters per byte, and the bytes can optionally be separated by colons (like1A:F6:01:...or1AF601...). the number of bytes must match the message digest algorithm in use. (Optional) π₯-digestβ the message digest to apply to the data file. any digest supported by theopenssl-dgst(1)command works here. default isSHA-256. (Optional) β¨-tspolicyobject_id β the policy the client expects the TSA to use when creating the timestamp token. you can use either the dotted OID notation or OID names defined in the config file. if no policy is requested, the TSA will use its own default policy. (Optional) π-no_nonceβ if you give this option, no nonce is specified in the request. otherwise a 64-bit long pseudo-random nonce gets included in the request. highkey recommended to use a nonce, it protects against replay attacks π‘οΈ (Optional)-certβ the TSA is expected to include its signing certificate in the response. (Optional) π-inrequest.tsq β specifies a previously created timestamp request in DER format that will be printed into the output file. super useful when you need to examine the content of a request in human-readable format. (Optional) π-outrequest.tsq β name of the output file the request gets written to. default isstdout. (Optional) π-textβ if this is specified, the output is human-readable text format instead of DER. (Optional) π-randfiles,-writerandfile β see "Random State Options" inopenssl(1)for details π²
π¦ Timestamp Response generation π¦
ok so a timestamp response (TimeStampResp) is literally a response status plus the timestamp token itself (ContentInfo), assuming the token generation went off without a hitch. the -reply command creates a timestamp response or timestamp token based on a request, and prints 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). it's giving very specific energy and we respect it π
-configconfigfile β the configuration file to use. Optional; for a description of the default value, 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 the 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 bestie: the TSA signing certificate must have exactly one extended key usage assigned to it:timeStamping. and that extended key usage must also be critical, otherwise the certificate is going to be refused π no cap. 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β signing digest to use. overrides thesigner_digestconfig file option. (Mandatory unless specified in the config file) β οΈ-chaincerts_file.pem β the collection of certificates in PEM format that will all be 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. important: the-replycommand does not build a certificate chain automatically, so like, do it yourself bestie π (Optional)-tspolicyobject_id β the default policy to use for the response, unless the client explicitly requires a particular TSA policy. the OID can be specified either 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 will be 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 you want to extract the timestamp token from a response. and 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 indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional) π-outresponse.tsr β the response gets 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). this option is deprecated π© (use the shiny new stuff, queen)-providername β see "Provider Options" inopenssl(1),provider(7), andproperty(7)π-provider-pathpath β same deal, see those same references above β¨-provparam[name:]key=value β yep, also in "Provider Options" inopenssl(1),provider(7), andproperty(7)π-propquerypropq β mmhm, "Provider Options" inopenssl(1),provider(7), andproperty(7)π§
π Timestamp Response verification π
the -verify command is for checking whether a timestamp response or timestamp token is valid and matches a particular timestamp request or data file. and listen β the -verify command does not use the configuration file. none. zero. not a crumb π
-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 may be needed when building the certificate chain for the TSA's signing certificate. these do not 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 details. 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 πͺπ¨
π§ CONFIGURATION FILE OPTIONS π§
Okay bestie, so <pink>the -query and -reply commands</pink> lowkey live off a config file. Wanna know the syntax? Go read config(5) β it explains the whole thing. π The -query command only touches the symbolic OID names section, and honestly it can vibe without it. But -reply? Nah, that one needs the config file to function, periodt.
And here's the rule to remember: whenever there's a command line switch that does the same thing as a variable, the switch always overrides whatever the config file says. Every time. No exceptions. π
tsa section, default_tsa
This is the main character section β¨ β it names another section that holds all the options for the -reply command. You can override this default section with the -section command line switch. (Optional)
oid_file
Points to a file full of additional OBJECT IDENTIFIERS. Every line should be: the numerical form of the object identifier, then whitespace, then the short name, then whitespace, then the long name. (Optional)
oid_section
Names a section in the config file that has extra object identifiers in it. Each line should be the short name of the object identifier, then =, then the numerical form. Heads up: when you use this option, the short and long names are the same. (Optional)
RANDFILE
At startup, the file you specify 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 holding the hexadecimal serial number of the last timestamp response created. It gets incremented by 1 for each response. If the file doesn't exist when you're generating a response, a new file gets created with serial number 1. (Mandatory)
crypto_device
Specifies the OpenSSL engine that will be set as the default for all available algorithms. The default value is built-in, and you can name any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM). (Optional)
signer_cert
The TSA signing certificate, in PEM format. Same energy as the -signer command line option. (Optional)
certs
A file containing a set of PEM encoded certificates that need to be included in the response. Identical to the -chain command line option. (Optional)
signer_key
The private key of the TSA, in PEM format. Exactly what -inkey does on the command line. (Optional)
signer_digest
The 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
A comma separated list of policies that are also acceptable by the TSA β 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 time source of the TSA, expressed in seconds, milliseconds and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of the components is missing, zero is assumed for that field. (Optional)
clock_precision_digits
Specifies the maximum number of digits that represent the fraction of seconds that need to be included in the time field. The 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 option is yes, the 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 created by the TSA always contain the certificate identifier of the signing certificate in a signed attribute (see RFC 2634, Enhanced Security Services). If this variable is set to no, only this signing certificate identifier is included in the SigningCertificate signed attribute. If it's set to yes and the certs variable or the -chain option is specified, then the certificate identifiers of the chain will also be included β and here's the tea, the -chain option overrides the certs variable. Default is no. (Optional)
ess_cert_id_alg
Specifies the hash function used to calculate the TSA's public key certificate identifier. Default is sha256. (Optional)
π EXAMPLES π
Every single example below assumes OPENSSL_CONF is set to a proper configuration file β like, the example config openssl/apps/openssl.cnf will do the job just fine. π
π¦ Timestamp Request
To create a timestamp request for design1.txt with SHA-256 digest, without nonce and policy, and without requiring 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 the tsa_policy1 name 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 certificate of the CA, 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 peek at the 'test' directory for more examples π.
π BUGS π
- No support for timestamps over SMTP, though it's honestly quite easy to implement an automatic e-mail based TSA with
procmail(1)andperl(1). HTTP server support is provided in the form of 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. That's 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 though β it 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. The 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 the whole page, bestie!! πβ¨π this icon was brought to you by OpenSSL 3.5.9, dated 2026-09-29, officially titled OPENSSL-TS(1ossl) β go forth and timestamp responsibly π¦π
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms