{
    "content": [
        {
            "type": "text",
            "text": "# OPENSSL-TS (man)\n\n## NAME\n\nopenssl-ts - Time Stamping Authority command\n\n## DESCRIPTION\n\nThis command is a basic Time Stamping Authority (TSA) client and server application as\nspecified in RFC 3161 (Time-Stamp Protocol, TSP). A TSA can be part of a PKI deployment and\nits role is to provide long term proof of the existence of a certain datum before a\nparticular time. Here is a brief description of the protocol:\n\n## TLDR\n\n> Generate and verify timestamps.\n\n- Generate a SHA-512 timestamp request of a specific file and output to `file.tsq`:\n  `openssl ts -query -data {{path/to/file}} -sha512 -out {{path/to/file.tsq}}`\n- Check the date and metadata of a specific timestamp response file:\n  `openssl ts -reply -in {{path/to/file.tsr}} -text`\n- Verify a timestamp request file and a timestamp response file from the server with an SSL certificate file:\n  `openssl ts -verify -in {{path/to/file.tsr}} -queryfile {{path/to/file.tsq}} -partial_chain -CAfile {{path/to/cert.pem}}`\n- Create a timestamp response for request using key and signing certificate and output it to `file.tsr`:\n  `openssl ts -reply -queryfile {{path/to/file.tsq}} -inkey {{path/to/tsakey.pem}} -signer tsacert.pem -out {{path/to/file.tsr}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (1 subsections)\n- **DESCRIPTION**\n- **OPTIONS** (44 subsections)\n- **CONFIGURATION FILE OPTIONS** (17 subsections)\n- **EXAMPLES** (3 subsections)\n- **BUGS**\n- **HISTORY**\n- **SEE ALSO**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "OPENSSL-TS",
        "section": "",
        "mode": "man",
        "summary": "openssl-ts - Time Stamping Authority command",
        "synopsis": "",
        "tldr_summary": "Generate and verify timestamps.",
        "tldr_examples": [
            {
                "description": "Generate a SHA-512 timestamp request of a specific file and output to `file.tsq`",
                "command": "openssl ts -query -data {{path/to/file}} -sha512 -out {{path/to/file.tsq}}"
            },
            {
                "description": "Check the date and metadata of a specific timestamp response file",
                "command": "openssl ts -reply -in {{path/to/file.tsr}} -text"
            },
            {
                "description": "Verify a timestamp request file and a timestamp response file from the server with an SSL certificate file",
                "command": "openssl ts -verify -in {{path/to/file.tsr}} -queryfile {{path/to/file.tsq}} -partial_chain -CAfile {{path/to/cert.pem}}"
            },
            {
                "description": "Create a timestamp response for request using key and signing certificate and output it to `file.tsr`",
                "command": "openssl ts -reply -queryfile {{path/to/file.tsq}} -inkey {{path/to/tsakey.pem}} -signer tsacert.pem -out {{path/to/file.tsr}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print out a usage message."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Generate a TS query. For details see \"Timestamp Request generation\"."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Generate a TS reply. For details see \"Timestamp Response generation\"."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Verify a TS response. For details see \"Timestamp Response verification\"."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The data file for which the timestamp request needs to be created. stdin is the default if neither the -data nor the -digest parameter is specified. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "It is possible to specify the message imprint explicitly without the data file. The imprint must be specified in a hexadecimal format, two characters per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or 1AF601...). The number of bytes must match the message digest algorithm in use. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The message digest to apply to the data file. Any digest supported by the openssl-dgst(1) command can be used. The default is SHA-256. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The policy that the client expects the TSA to use for creating the timestamp token. Either the dotted OID notation or OID names defined in the config file can be used. If no policy is requested the TSA will use its own default policy. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "No nonce is specified in the request if this option is given. Otherwise a 64 bit long pseudo-random none is included in the request. It is recommended to use nonce to protect against replay-attacks. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The TSA is expected to include its signing certificate in the response. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option specifies a previously created timestamp request in DER format that will be printed into the output file. Useful when you need to examine the content of a request in human-readable format. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Name of the output file to which the request will be written. Default is stdout. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "If this option is specified the output is human-readable text format instead of DER. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Random State Options\" in openssl(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1). See \"CONFIGURATION FILE OPTIONS\" for configurable variables."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The name of the config file section containing the settings for the response generation. If not specified the default TSA section is used, see \"CONFIGURATION FILE OPTIONS\" for details. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The name of the file containing a DER encoded timestamp request. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specifies the password source for the private key of the TSA. See description in openssl(1). (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The signer certificate of the TSA in PEM format. The TSA signing certificate must have exactly one extended key usage assigned to it: timeStamping. The extended key usage must also be critical, otherwise the certificate is going to be refused. Overrides the signercert variable of the config file. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The signer private key of the TSA in PEM format. Overrides the signerkey config file option. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Signing digest to use. Overrides the signerdigest config file option. (Mandatory unless specified in the config file)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The collection of certificates in PEM format that will all be included in the response in addition to the signer certificate if the -cert option was used for the request. This file is supposed to contain the certificate chain for the signer certificate from its issuer upwards. The -reply command does not build a certificate chain automatically. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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 the defaultpolicy config file option. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specifies a previously created timestamp response or timestamp token (if -tokenin is also specified) in DER format that will be written to the output file. This option does not require a request, it is useful e.g. when you need to examine the content of a response or token or you want to 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)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The response is written to this file. The format and content of the file depends on other options (see -text, -tokenout). The default is stdout. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The output is a timestamp token (ContentInfo) instead of timestamp response (TimeStampResp). (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "If this option is specified the output is human-readable text format instead of DER. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Provider Options\" in openssl(1), provider(7), and property(7)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The response or token must be verified against filetohash. The file is hashed with the message digest algorithm specified in the token. The -digest and -queryfile options must not be specified with this one. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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 -data and -queryfile options must not be specified with this one. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The original timestamp request in DER format. The -data and -digest options must not be specified with this one. (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The timestamp response that needs to be verified in DER format. (Mandatory)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details. At least one of -CAfile, -CApath or -CAstore must be specified. -allowproxycerts, -attime, -nochecktime, -checksssig, -crlcheck, -crlcheckall,"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "-noaltchains, -partialchain, -policy, -policycheck, -policyprint, -purpose, -suiteB128, -suiteB128only, -suiteB192, -trustedfirst, -usedeltas, -authlevel, -verifydepth, -verifyemail, -verifyhostname, -verifyip, -verifyname, -x509strict -issuerchecks Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details. Any verification errors cause the command to exit."
            }
        ],
        "examples": [
            "All  the examples below presume that OPENSSLCONF is set to a proper configuration file, e.g.",
            "the example configuration file openssl/apps/openssl.cnf will do.",
            "To create a timestamp request for design1.txt with SHA-256 digest, without nonce and  policy,",
            "and without requirement for a certificate in the response:",
            "openssl ts -query -data design1.txt -nononce \\",
            "-out design1.tsq",
            "To create a similar timestamp request with specifying the message imprint explicitly:",
            "openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\",
            "-nononce -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 which includes the SHA-512 digest of design2.txt, requests the",
            "signer certificate and nonce, and specifies a policy id (assuming  the  tsapolicy1  name  is",
            "defined in the OID section of the config file):",
            "openssl ts -query -data design2.txt -sha512 \\",
            "-tspolicy tsapolicy1 -cert -out design2.tsq",
            "Before  generating a response a signing certificate must be created for the TSA 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  that  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 timestamp response:",
            "openssl ts -reply -queryfile design1.tsq -out design1token.der -tokenout",
            "To print a timestamp token to stdout in human readable format:",
            "openssl ts -reply -in design1token.der -tokenin -text -tokenout",
            "To extract the timestamp token from a response:",
            "openssl ts -reply -in design1.tsr -out design1token.der -tokenout",
            "To add 'granted' status info to a timestamp token thereby creating a valid response:",
            "openssl ts -reply -in design1token.der -tokenin -out design1.tsr",
            "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."
        ],
        "see_also": [
            {
                "name": "openssl",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl/1/json"
            },
            {
                "name": "tsget",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tsget/1/json"
            },
            {
                "name": "openssl-req",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-req/1/json"
            },
            {
                "name": "openssl-x509",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-x509/1/json"
            },
            {
                "name": "openssl-ca",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-ca/1/json"
            },
            {
                "name": "openssl-genrsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-genrsa/1/json"
            },
            {
                "name": "config",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/config/5/json"
            },
            {
                "name": "osslstore-file",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/osslstore-file/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "openssl ts -help",
                        "lines": 19
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "-query",
                        "lines": 2
                    },
                    {
                        "name": "-reply",
                        "lines": 2
                    },
                    {
                        "name": "-verify",
                        "lines": 2
                    },
                    {
                        "name": "Timestamp Request generation",
                        "lines": 3
                    },
                    {
                        "name": "-config _",
                        "lines": 3
                    },
                    {
                        "name": "-data _",
                        "lines": 3
                    },
                    {
                        "name": "-digest _",
                        "lines": 5
                    },
                    {
                        "name": "-\u001b[4mdigest",
                        "lines": 3
                    },
                    {
                        "name": "-tspolicy _",
                        "lines": 4
                    },
                    {
                        "name": "-no_nonce",
                        "lines": 4
                    },
                    {
                        "name": "-cert",
                        "lines": 2
                    },
                    {
                        "name": "-in _",
                        "lines": 4
                    },
                    {
                        "name": "-out _",
                        "lines": 3
                    },
                    {
                        "name": "-text",
                        "lines": 3
                    },
                    {
                        "name": "-rand _ -writerand _",
                        "lines": 2
                    },
                    {
                        "name": "Timestamp Response generation",
                        "lines": 6
                    },
                    {
                        "name": "-config _",
                        "lines": 4
                    },
                    {
                        "name": "-section _",
                        "lines": 4
                    },
                    {
                        "name": "-queryfile _",
                        "lines": 2
                    },
                    {
                        "name": "-passin _",
                        "lines": 3
                    },
                    {
                        "name": "-signer _",
                        "lines": 5
                    },
                    {
                        "name": "-inkey _",
                        "lines": 3
                    },
                    {
                        "name": "-\u001b[4mdigest",
                        "lines": 3
                    },
                    {
                        "name": "-chain _",
                        "lines": 6
                    },
                    {
                        "name": "-tspolicy _",
                        "lines": 4
                    },
                    {
                        "name": "-in _",
                        "lines": 7
                    },
                    {
                        "name": "-token_in",
                        "lines": 4
                    },
                    {
                        "name": "-out _",
                        "lines": 3
                    },
                    {
                        "name": "-token_out",
                        "lines": 3
                    },
                    {
                        "name": "-text",
                        "lines": 3
                    },
                    {
                        "name": "-engine _",
                        "lines": 2
                    },
                    {
                        "name": "-provider _",
                        "lines": 1
                    },
                    {
                        "name": "-provider-path _",
                        "lines": 1
                    },
                    {
                        "name": "-propquery _",
                        "lines": 2
                    },
                    {
                        "name": "Timestamp Response verification",
                        "lines": 4
                    },
                    {
                        "name": "-data _",
                        "lines": 4
                    },
                    {
                        "name": "-digest _",
                        "lines": 4
                    },
                    {
                        "name": "-queryfile _",
                        "lines": 3
                    },
                    {
                        "name": "-in _",
                        "lines": 2
                    },
                    {
                        "name": "-token_in",
                        "lines": 4
                    },
                    {
                        "name": "-untrusted _",
                        "lines": 8
                    },
                    {
                        "name": "-CAfile _ -CApath _ -CAstore _",
                        "lines": 4
                    },
                    {
                        "name": "-explicit_policy -extended_crl -ignore_critical -inhibit_any -inhibit_map",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "CONFIGURATION FILE OPTIONS",
                "lines": 13,
                "subsections": [
                    {
                        "name": "oid_file",
                        "lines": 4
                    },
                    {
                        "name": "oid_section",
                        "lines": 10
                    },
                    {
                        "name": "serial",
                        "lines": 5
                    },
                    {
                        "name": "crypto_device",
                        "lines": 4
                    },
                    {
                        "name": "signer_cert",
                        "lines": 3
                    },
                    {
                        "name": "certs",
                        "lines": 3
                    },
                    {
                        "name": "signer_key",
                        "lines": 3
                    },
                    {
                        "name": "signer_digest",
                        "lines": 3
                    },
                    {
                        "name": "default_policy",
                        "lines": 3
                    },
                    {
                        "name": "other_policies",
                        "lines": 3
                    },
                    {
                        "name": "digests",
                        "lines": 3
                    },
                    {
                        "name": "accuracy",
                        "lines": 4
                    },
                    {
                        "name": "clock_precision_digits",
                        "lines": 5
                    },
                    {
                        "name": "ordering",
                        "lines": 4
                    },
                    {
                        "name": "tsa_name",
                        "lines": 3
                    },
                    {
                        "name": "ess_cert_id_chain",
                        "lines": 8
                    },
                    {
                        "name": "ess_cert_id_alg",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "Timestamp Request",
                        "lines": 22
                    },
                    {
                        "name": "Timestamp Response",
                        "lines": 40
                    },
                    {
                        "name": "Timestamp Verification",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "BUGS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-ts - Time Stamping Authority command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "",
                "subsections": [
                    {
                        "name": "openssl ts -help",
                        "content": "openssl ts -query [-config configfile] [-data filetohash] [-digest digestbytes] [-digest]\n[-tspolicy objectid] [-nononce] [-cert] [-in request.tsq] [-out request.tsq] [-text] [-rand\nfiles] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]\n\nopenssl ts -reply [-config configfile] [-section tsasection] [-queryfile request.tsq]\n[-passin passwordsrc] [-signer tsacert.pem] [-inkey filename|uri] [-digest] [-chain\ncertsfile.pem] [-tspolicy objectid] [-in response.tsr] [-tokenin] [-out response.tsr]\n[-tokenout] [-text] [-engine id] [-provider name] [-provider-path path] [-propquery propq]\n\nopenssl ts -verify [-data filetohash] [-digest digestbytes] [-queryfile request.tsq] [-in\nresponse.tsr] [-tokenin] [-untrusted files|uris] [-CAfile file] [-CApath dir] [-CAstore uri]\n[-allowproxycerts] [-attime timestamp] [-nochecktime] [-checksssig] [-crlcheck]\n[-crlcheckall] [-explicitpolicy] [-extendedcrl] [-ignorecritical] [-inhibitany]\n[-inhibitmap] [-partialchain] [-policy arg] [-policycheck] [-policyprint] [-purpose\npurpose] [-suiteB128] [-suiteB128only] [-suiteB192] [-trustedfirst] [-noaltchains]\n[-usedeltas] [-authlevel num] [-verifydepth num] [-verifyemail email] [-verifyhostname\nhostname] [-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks] [-provider\nname] [-provider-path path] [-propquery propq]\n"
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "This command is a basic Time Stamping Authority (TSA) client and server application as\nspecified in RFC 3161 (Time-Stamp Protocol, TSP). A TSA can be part of a PKI deployment and\nits role is to provide long term proof of the existence of a certain datum before a\nparticular time. Here is a brief description of the protocol:\n\n1.  The  TSA  client  computes a one-way hash value for a data file and sends the hash to the\nTSA.\n\n2.  The TSA attaches the current date and time to the received hash  value,  signs  them  and\nsends  the  timestamp  token back to the client. By creating this token the TSA certifies\nthe existence of the original data file at the time of response generation.\n\n3.  The TSA client receives the timestamp token and verifies the signature  on  it.  It  also\nchecks if the token contains the same hash value that it had sent to the TSA.\n\nThere  is  one DER encoded protocol data unit defined for transporting a timestamp request to\nthe TSA and one for sending the timestamp response back to the client. This command has three\nmain functions: creating a timestamp request based on  a  data  file,  creating  a  timestamp\nresponse based on a request, verifying if a response corresponds to a particular request or a\ndata file.\n\nThere  is no support for sending the requests/responses automatically over HTTP or TCP yet as\nsuggested in RFC 3161. The users must send the requests either by ftp or e-mail.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n"
                    },
                    {
                        "name": "-query",
                        "content": "Generate a TS query. For details see \"Timestamp Request generation\".\n"
                    },
                    {
                        "name": "-reply",
                        "content": "Generate a TS reply. For details see \"Timestamp Response generation\".\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Verify a TS response. For details see \"Timestamp Response verification\".\n"
                    },
                    {
                        "name": "Timestamp Request generation",
                        "content": "The -query command can be used for  creating  and  printing  a  timestamp  request  with  the\nfollowing options:\n"
                    },
                    {
                        "name": "-config _",
                        "content": "The  configuration  file  to  use.  Optional; for a description of the default value, see\n\"COMMAND SUMMARY\" in openssl(1).\n"
                    },
                    {
                        "name": "-data _",
                        "content": "The data file for which the timestamp request needs to be created. stdin is  the  default\nif neither the -data nor the -digest parameter is specified. (Optional)\n"
                    },
                    {
                        "name": "-digest _",
                        "content": "It  is  possible  to  specify  the  message imprint explicitly without the data file. The\nimprint must be specified in a hexadecimal format, two characters  per  byte,  the  bytes\noptionally separated by colons (e.g. 1A:F6:01:... or 1AF601...). The number of bytes must\nmatch the message digest algorithm in use. (Optional)\n"
                    },
                    {
                        "name": "-\u001b[4mdigest",
                        "content": "The   message   digest  to  apply  to  the  data  file.   Any  digest  supported  by  the\nopenssl-dgst(1) command can be used.  The default is SHA-256. (Optional)\n"
                    },
                    {
                        "name": "-tspolicy _",
                        "content": "The policy that the client expects the TSA to  use  for  creating  the  timestamp  token.\nEither the dotted OID notation or OID names defined in the config file can be used. If no\npolicy is requested the TSA will use its own default policy. (Optional)\n"
                    },
                    {
                        "name": "-no_nonce",
                        "content": "No  nonce  is  specified  in the request if this option is given. Otherwise a 64 bit long\npseudo-random none is included in the request. It is recommended to use nonce to  protect\nagainst replay-attacks. (Optional)\n"
                    },
                    {
                        "name": "-cert",
                        "content": "The TSA is expected to include its signing certificate in the response. (Optional)\n"
                    },
                    {
                        "name": "-in _",
                        "content": "This  option  specifies a previously created timestamp request in DER format that will be\nprinted into the output file. Useful when you need to examine the content of a request in\nhuman-readable format. (Optional)\n"
                    },
                    {
                        "name": "-out _",
                        "content": "Name of the output file to  which  the  request  will  be  written.  Default  is  stdout.\n(Optional)\n"
                    },
                    {
                        "name": "-text",
                        "content": "If  this  option  is  specified  the output is human-readable text format instead of DER.\n(Optional)\n"
                    },
                    {
                        "name": "-rand _ -writerand _",
                        "content": "See \"Random State Options\" in openssl(1) for details.\n"
                    },
                    {
                        "name": "Timestamp Response generation",
                        "content": "A timestamp response (TimeStampResp) consists of a response status and  the  timestamp  token\nitself  (ContentInfo),  if  the  token  generation  was successful. The -reply command is for\ncreating a timestamp response or  timestamp  token  based  on  a  request  and  printing  the\nresponse/token  in human-readable format. If -tokenout is not specified the output is always\na timestamp response (TimeStampResp), otherwise it is a timestamp token (ContentInfo).\n"
                    },
                    {
                        "name": "-config _",
                        "content": "The configuration file to use.  Optional; for a description of  the  default  value,  see\n\"COMMAND  SUMMARY\"  in  openssl(1).   See  \"CONFIGURATION  FILE OPTIONS\" for configurable\nvariables.\n"
                    },
                    {
                        "name": "-section _",
                        "content": "The name of the config file section containing the settings for the response  generation.\nIf  not  specified  the default TSA section is used, see \"CONFIGURATION FILE OPTIONS\" for\ndetails. (Optional)\n"
                    },
                    {
                        "name": "-queryfile _",
                        "content": "The name of the file containing a DER encoded timestamp request. (Optional)\n"
                    },
                    {
                        "name": "-passin _",
                        "content": "Specifies the password source for  the  private  key  of  the  TSA.  See  description  in\nopenssl(1). (Optional)\n"
                    },
                    {
                        "name": "-signer _",
                        "content": "The  signer  certificate  of the TSA in PEM format. The TSA signing certificate must have\nexactly one extended key usage assigned to it: timeStamping. The extended key usage  must\nalso  be  critical,  otherwise  the  certificate  is  going  to be refused. Overrides the\nsignercert variable of the config file. (Optional)\n"
                    },
                    {
                        "name": "-inkey _",
                        "content": "The signer private key of the TSA in PEM format. Overrides  the  signerkey  config  file\noption. (Optional)\n"
                    },
                    {
                        "name": "-\u001b[4mdigest",
                        "content": "Signing  digest to use. Overrides the signerdigest config file option. (Mandatory unless\nspecified in the config file)\n"
                    },
                    {
                        "name": "-chain _",
                        "content": "The collection of certificates in PEM format that will all be included in the response in\naddition to the signer certificate if the -cert option was used  for  the  request.  This\nfile  is  supposed  to  contain the certificate chain for the signer certificate from its\nissuer upwards. The -reply command does not  build  a  certificate  chain  automatically.\n(Optional)\n"
                    },
                    {
                        "name": "-tspolicy _",
                        "content": "The  default  policy  to  use  for  the  response unless the client explicitly requires a\nparticular TSA policy. The OID can be specified either in dotted  notation  or  with  its\nname. Overrides the defaultpolicy config file option. (Optional)\n"
                    },
                    {
                        "name": "-in _",
                        "content": "Specifies  a  previously  created  timestamp response or timestamp token (if -tokenin is\nalso specified) in DER format that will be written to the output file. This  option  does\nnot  require  a  request,  it  is  useful  e.g. when you need to examine the content of a\nresponse or token or you want to extract the timestamp token  from  a  response.  If  the\ninput  is  a token and the output is a timestamp response a default 'granted' status info\nis added to the token. (Optional)\n"
                    },
                    {
                        "name": "-token_in",
                        "content": "This flag can be used together with the -in option and indicates that the input is a  DER\nencoded  timestamp  token  (ContentInfo) instead of a timestamp response (TimeStampResp).\n(Optional)\n"
                    },
                    {
                        "name": "-out _",
                        "content": "The response is written to this file. The format and content of the file depends on other\noptions (see -text, -tokenout). The default is stdout. (Optional)\n"
                    },
                    {
                        "name": "-token_out",
                        "content": "The  output  is  a  timestamp  token  (ContentInfo)   instead   of   timestamp   response\n(TimeStampResp). (Optional)\n"
                    },
                    {
                        "name": "-text",
                        "content": "If  this  option  is  specified  the output is human-readable text format instead of DER.\n(Optional)\n"
                    },
                    {
                        "name": "-engine _",
                        "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\n"
                    },
                    {
                        "name": "-provider _",
                        "content": ""
                    },
                    {
                        "name": "-provider-path _",
                        "content": ""
                    },
                    {
                        "name": "-propquery _",
                        "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n"
                    },
                    {
                        "name": "Timestamp Response verification",
                        "content": "The -verify command is for verifying if a timestamp response or timestamp token is valid  and\nmatches  a  particular  timestamp  request or data file. The -verify command does not use the\nconfiguration file.\n"
                    },
                    {
                        "name": "-data _",
                        "content": "The response or token must be verified against filetohash. The file is hashed with  the\nmessage digest algorithm specified in the token.  The -digest and -queryfile options must\nnot be specified with this one.  (Optional)\n"
                    },
                    {
                        "name": "-digest _",
                        "content": "The  response  or  token  must be verified against the message digest specified with this\noption. The number of bytes must match the message  digest  algorithm  specified  in  the\ntoken. The -data and -queryfile options must not be specified with this one. (Optional)\n"
                    },
                    {
                        "name": "-queryfile _",
                        "content": "The  original  timestamp request in DER format. The -data and -digest options must not be\nspecified with this one. (Optional)\n"
                    },
                    {
                        "name": "-in _",
                        "content": "The timestamp response that needs to be verified in DER format. (Mandatory)\n"
                    },
                    {
                        "name": "-token_in",
                        "content": "This flag can be used together with the -in option and indicates that the input is a  DER\nencoded  timestamp  token  (ContentInfo) instead of a timestamp response (TimeStampResp).\n(Optional)\n"
                    },
                    {
                        "name": "-untrusted _",
                        "content": "A set of additional  untrusted  certificates  which  may  be  needed  when  building  the\ncertificate  chain  for  the TSA's signing certificate.  These do not need to contain the\nTSA signing certificate and intermediate CA certificates as far as the  response  already\nincludes them.  (Optional)\n\nMultiple  sources  may  be  given,  separated by commas and/or whitespace.  Each file may\ncontain multiple certificates.\n"
                    },
                    {
                        "name": "-CAfile _ -CApath _ -CAstore _",
                        "content": "See \"Trusted Certificate Options\" in  openssl-verification-options(1)  for  details.   At\nleast one of -CAfile, -CApath or -CAstore must be specified.\n\n-allowproxycerts, -attime, -nochecktime, -checksssig, -crlcheck, -crlcheckall,"
                    },
                    {
                        "name": "-explicit_policy -extended_crl -ignore_critical -inhibit_any -inhibit_map",
                        "content": "-noaltchains, -partialchain, -policy, -policycheck, -policyprint, -purpose, -suiteB128,\n-suiteB128only, -suiteB192, -trustedfirst, -usedeltas, -authlevel, -verifydepth,\n-verifyemail, -verifyhostname, -verifyip, -verifyname, -x509strict -issuerchecks\nSet  various  options  of  certificate chain verification.  See \"Verification Options\" in\nopenssl-verification-options(1) for details.\n\nAny verification errors cause the command to exit.\n"
                    }
                ]
            },
            "CONFIGURATION FILE OPTIONS": {
                "content": "The -query and -reply commands make use of a configuration file.  See config(5) for a general\ndescription of the syntax of the config file. The -query command uses only the  symbolic  OID\nnames  section  and it can work without it. However, the -reply command needs the config file\nfor its operation.\n\nWhen there is a command line switch equivalent of a variable the switch always overrides  the\nsettings in the config file.\n\ntsa section, defaulttsa\nThis  is  the main section and it specifies the name of another section that contains all\nthe options for the -reply command. This default  section  can  be  overridden  with  the\n-section command line switch. (Optional)\n",
                "subsections": [
                    {
                        "name": "oid_file",
                        "content": "This  specifies  a  file containing additional OBJECT IDENTIFIERS.  Each line of the file\nshould consist of the numerical form of the object identifier followed by whitespace then\nthe short name followed by whitespace and finally the long name. (Optional)\n"
                    },
                    {
                        "name": "oid_section",
                        "content": "This specifies a section in the configuration file containing extra  object  identifiers.\nEach line should consist of the short name of the object identifier followed by = and the\nnumerical  form.  The  short  and  long  names  are  the  same  when this option is used.\n(Optional)\n\nRANDFILE\nAt startup the specified file is loaded into the random number generator, and at exit 256\nbytes will be written to it. (Note: Using a RANDFILE is not necessary  anymore,  see  the\n\"HISTORY\" section.\n"
                    },
                    {
                        "name": "serial",
                        "content": "The  name  of  the  file  containing  the hexadecimal serial number of the last timestamp\nresponse created. This number is incremented by 1 for each response. If the file does not\nexist at the time of response generation a new file is  created  with  serial  number  1.\n(Mandatory)\n"
                    },
                    {
                        "name": "crypto_device",
                        "content": "Specifies  the  OpenSSL  engine  that  will  be  set  as  the  default  for all available\nalgorithms. The default value is built-in, you can specify any other engines supported by\nOpenSSL (e.g. use chil for the NCipher HSM).  (Optional)\n"
                    },
                    {
                        "name": "signer_cert",
                        "content": "TSA signing certificate in PEM format. The same  as  the  -signer  command  line  option.\n(Optional)\n"
                    },
                    {
                        "name": "certs",
                        "content": "A  file  containing  a  set  of  PEM encoded certificates that need to be included in the\nresponse. The same as the -chain command line option. (Optional)\n"
                    },
                    {
                        "name": "signer_key",
                        "content": "The private key of the TSA in PEM format. The same as the  -inkey  command  line  option.\n(Optional)\n"
                    },
                    {
                        "name": "signer_digest",
                        "content": "Signing  digest  to  use.  The same as the -digest command line option. (Mandatory unless\nspecified on the command line)\n"
                    },
                    {
                        "name": "default_policy",
                        "content": "The default policy to use when the request does not mandate any policy. The same  as  the\n-tspolicy command line option. (Optional)\n"
                    },
                    {
                        "name": "other_policies",
                        "content": "Comma separated list of policies that are also acceptable by the TSA and used only if the\nrequest explicitly specifies one of them. (Optional)\n"
                    },
                    {
                        "name": "digests",
                        "content": "The  list  of message digest algorithms that the TSA accepts. At least one algorithm must\nbe specified. (Mandatory)\n"
                    },
                    {
                        "name": "accuracy",
                        "content": "The accuracy of the time source of the TSA in  seconds,  milliseconds  and  microseconds.\nE.g.  secs:1,  millisecs:500,  microsecs:100. If any of the components is missing zero is\nassumed for that field. (Optional)\n"
                    },
                    {
                        "name": "clock_precision_digits",
                        "content": "Specifies the maximum number of digits, which represent the  fraction  of  seconds,  that\nneed  to be included in the time field. The trailing zeros must be removed from the time,\nso there might actually be fewer digits, or no fraction of seconds at all. Supported only\non UNIX platforms.  The maximum value is 6, default is 0.  (Optional)\n"
                    },
                    {
                        "name": "ordering",
                        "content": "If this option is yes the responses generated by this TSA can always be ordered, even  if\nthe  time  difference  between  two  responses  is less than the sum of their accuracies.\nDefault is no. (Optional)\n"
                    },
                    {
                        "name": "tsa_name",
                        "content": "Set this option to yes if the subject name of the TSA must be included in  the  TSA  name\nfield of the response. Default is no. (Optional)\n"
                    },
                    {
                        "name": "ess_cert_id_chain",
                        "content": "The  SignedData  objects  created by the TSA always contain the certificate identifier of\nthe signing certificate in a signed attribute (see RFC 2634, Enhanced Security Services).\nIf this variable is set to no, only this signing certificate identifier  is  included  in\nthe  SigningCertificate  signed  attribute.  If this variable is set to yes and the certs\nvariable or the -chain option is specified then the certificate identifiers of the  chain\nwill  also be included, where the -chain option overrides the certs variable.  Default is\nno.  (Optional)\n"
                    },
                    {
                        "name": "ess_cert_id_alg",
                        "content": "This option specifies the hash function to be used to  calculate  the  TSA's  public  key\ncertificate identifier. Default is sha1. (Optional)\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "All  the examples below presume that OPENSSLCONF is set to a proper configuration file, e.g.\nthe example configuration file openssl/apps/openssl.cnf will do.\n",
                "subsections": [
                    {
                        "name": "Timestamp Request",
                        "content": "To create a timestamp request for design1.txt with SHA-256 digest, without nonce and  policy,\nand without requirement for a certificate in the response:\n\nopenssl ts -query -data design1.txt -nononce \\\n-out design1.tsq\n\nTo create a similar timestamp request with specifying the message imprint explicitly:\n\nopenssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\\n-nononce -out design1.tsq\n\nTo print the content of the previous request in human readable format:\n\nopenssl ts -query -in design1.tsq -text\n\nTo  create a timestamp request which includes the SHA-512 digest of design2.txt, requests the\nsigner certificate and nonce, and specifies a policy id (assuming  the  tsapolicy1  name  is\ndefined in the OID section of the config file):\n\nopenssl ts -query -data design2.txt -sha512 \\\n-tspolicy tsapolicy1 -cert -out design2.tsq\n"
                    },
                    {
                        "name": "Timestamp Response",
                        "content": "Before  generating a response a signing certificate must be created for the TSA that contains\nthe  timeStamping  critical  extended  key  usage  extension  without  any  other  key  usage\nextensions.  You  can  add  this  line  to the user certificate section of the config file to\ngenerate a proper certificate;\n\nextendedKeyUsage = critical,timeStamping\n\nSee openssl-req(1), openssl-ca(1), and openssl-x509(1) for instructions. The  examples  below\nassume  that  cacert.pem  contains  the  certificate  of  the  CA, tsacert.pem is the signing\ncertificate issued by cacert.pem and tsakey.pem is the private key of the TSA.\n\nTo create a timestamp response for a request:\n\nopenssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \\\n-signer tsacert.pem -out design1.tsr\n\nIf you want to use the settings in the config file you could just write:\n\nopenssl ts -reply -queryfile design1.tsq -out design1.tsr\n\nTo print a timestamp reply to stdout in human readable format:\n\nopenssl ts -reply -in design1.tsr -text\n\nTo create a timestamp token instead of timestamp response:\n\nopenssl ts -reply -queryfile design1.tsq -out design1token.der -tokenout\n\nTo print a timestamp token to stdout in human readable format:\n\nopenssl ts -reply -in design1token.der -tokenin -text -tokenout\n\nTo extract the timestamp token from a response:\n\nopenssl ts -reply -in design1.tsr -out design1token.der -tokenout\n\nTo add 'granted' status info to a timestamp token thereby creating a valid response:\n\nopenssl ts -reply -in design1token.der -tokenin -out design1.tsr\n"
                    },
                    {
                        "name": "Timestamp Verification",
                        "content": "To verify a timestamp reply against a request:\n\nopenssl ts -verify -queryfile design1.tsq -in design1.tsr \\\n-CAfile cacert.pem -untrusted tsacert.pem\n\nTo verify a timestamp reply that includes the certificate chain:\n\nopenssl ts -verify -queryfile design2.tsq -in design2.tsr \\\n-CAfile cacert.pem\n\nTo verify a timestamp token against the original data file:\nopenssl ts -verify -data design2.txt -in design2.tsr \\\n-CAfile cacert.pem\n\nTo verify a timestamp token against a message imprint:\nopenssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\\n-in design2.tsr -CAfile cacert.pem\n\nYou could also look at the 'test' directory for more examples.\n"
                    }
                ]
            },
            "BUGS": {
                "content": "• No support for timestamps over SMTP, though it is quite  easy  to  implement  an  automatic\ne-mail  based TSA with procmail(1) and perl(1). HTTP server support is provided in the form\nof a separate apache module. HTTP client support  is  provided  by  tsget(1).  Pure  TCP/IP\nprotocol is not supported.\n\n• The  file  containing  the  last  serial number of the TSA is not locked when being read or\nwritten. This is a problem if more than one instance of openssl(1) is trying  to  create  a\ntimestamp  response  at  the  same  time. This is not an issue when using the apache server\nmodule, it does proper locking.\n\n• Look for the FIXME word in the source files.\n\n• The source code should really be reviewed by somebody else, too.\n\n• More testing is needed, I have done only some basic tests (see test/testtsa).\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding  mechanism.\nThe  new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring\nrandomness. This option is retained mainly for compatibility reasons.\n\nThe -engine option was deprecated in OpenSSL 3.0.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "openssl(1),  tsget(1),  openssl-req(1),  openssl-x509(1),  openssl-ca(1),  openssl-genrsa(1),\nconfig(5), osslstore-file(7)\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed  under  the Apache License 2.0 (the \"License\").  You may not use this file except in\ncompliance with the License.  You can obtain a  copy  in  the  file  LICENSE  in  the  source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n3.0.13                                       2026-07-29                             OPENSSL-TS(1SSL)",
                "subsections": []
            }
        }
    }
}