1TS(1)                               OpenSSL                              TS(1)
2
3
4

NAME

6       ts - Time Stamping Authority tool (client/server)
7

SYNOPSIS

9       openssl ts -query [-rand file:file...]  [-config configfile] [-data
10       file_to_hash] [-digest digest_bytes]
11       [-md2|-md4|-md5|-sha|-sha1|-mdc2|-ripemd160|...]  [-policy object_id]
12       [-no_nonce] [-cert] [-in request.tsq] [-out request.tsq] [-text]
13
14       openssl ts -reply [-config configfile] [-section tsa_section]
15       [-queryfile request.tsq] [-passin password_src] [-signer tsa_cert.pem]
16       [-inkey private.pem] [-chain certs_file.pem] [-policy object_id] [-in
17       response.tsr] [-token_in] [-out response.tsr] [-token_out] [-text]
18       [-engine id]
19
20       openssl ts -verify [-data file_to_hash] [-digest digest_bytes]
21       [-queryfile request.tsq] [-in response.tsr] [-token_in] [-CApath
22       trusted_cert_path] [-CAfile trusted_certs.pem] [-untrusted
23       cert_file.pem]
24

DESCRIPTION

26       The ts command is a basic Time Stamping Authority (TSA) client and
27       server application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
28       A TSA can be part of a PKI deployment and its role is to provide long
29       term proof of the existence of a certain datum before a particular
30       time. Here is a brief description of the protocol:
31
32       1.  The TSA client computes a one-way hash value for a data file and
33           sends the hash to the TSA.
34
35       2.  The TSA attaches the current date and time to the received hash
36           value, signs them and sends the time stamp token back to the
37           client. By creating this token the TSA certifies the existence of
38           the original data file at the time of response generation.
39
40       3.  The TSA client receives the time stamp token and verifies the
41           signature on it. It also checks if the token contains the same hash
42           value that it had sent to the TSA.
43
44       There is one DER encoded protocol data unit defined for transporting a
45       time stamp request to the TSA and one for sending the time stamp
46       response back to the client. The ts command has three main functions:
47       creating a time stamp request based on a data file, creating a time
48       stamp response based on a request, verifying if a response corresponds
49       to a particular request or a data file.
50
51       There is no support for sending the requests/responses automatically
52       over HTTP or TCP yet as suggested in RFC 3161. The users must send the
53       requests either by ftp or e-mail.
54

OPTIONS

56   Time Stamp Request generation
57       The -query switch can be used for creating and printing a time stamp
58       request with the following options:
59
60       -rand file:file...
61           The files containing random data for seeding the random number
62           generator. Multiple files can be specified, the separator is ; for
63           MS-Windows, , for VMS and : for all other platforms. (Optional)
64
65       -config configfile
66           The configuration file to use, this option overrides the
67           OPENSSL_CONF environment variable. Only the OID section of the
68           config file is used with the -query command. (Optional)
69
70       -data file_to_hash
71           The data file for which the time stamp request needs to be created.
72           stdin is the default if neither the -data nor the -digest parameter
73           is specified. (Optional)
74
75       -digest digest_bytes
76           It is possible to specify the message imprint explicitly without
77           the data file. The imprint must be specified in a hexadecimal
78           format, two characters per byte, the bytes optionally separated by
79           colons (e.g. 1A:F6:01:... or 1AF601...). The number of bytes must
80           match the message digest algorithm in use. (Optional)
81
82       -md2|-md4|-md5|-sha|-sha1|-mdc2|-ripemd160|...
83           The message digest to apply to the data file, it supports all the
84           message digest algorithms that are supported by the openssl dgst
85           command.  The default is SHA-1. (Optional)
86
87       -policy object_id
88           The policy that the client expects the TSA to use for creating the
89           time stamp token. Either the dotted OID notation or OID names
90           defined in the config file can be used. If no policy is requested
91           the TSA will use its own default policy. (Optional)
92
93       -no_nonce
94           No nonce is specified in the request if this option is given.
95           Otherwise a 64 bit long pseudo-random none is included in the
96           request. It is recommended to use nonce to protect against replay-
97           attacks. (Optional)
98
99       -cert
100           The TSA is expected to include its signing certificate in the
101           response. (Optional)
102
103       -in request.tsq
104           This option specifies a previously created time stamp request in
105           DER format that will be printed into the output file. Useful when
106           you need to examine the content of a request in human-readable
107
108           format. (Optional)
109
110       -out request.tsq
111           Name of the output file to which the request will be written.
112           Default is stdout. (Optional)
113
114       -text
115           If this option is specified the output is human-readable text
116           format instead of DER. (Optional)
117
118   Time Stamp Response generation
119       A time stamp response (TimeStampResp) consists of a response status and
120       the time stamp token itself (ContentInfo), if the token generation was
121       successful. The -reply command is for creating a time stamp response or
122       time stamp token based on a request and printing the response/token in
123       human-readable format. If -token_out is not specified the output is
124       always a time stamp response (TimeStampResp), otherwise it is a time
125       stamp token (ContentInfo).
126
127       -config configfile
128           The configuration file to use, this option overrides the
129           OPENSSL_CONF environment variable. See CONFIGURATION FILE OPTIONS
130           for configurable variables. (Optional)
131
132       -section tsa_section
133           The name of the config file section conatining the settings for the
134           response generation. If not specified the default TSA section is
135           used, see CONFIGURATION FILE OPTIONS for details. (Optional)
136
137       -queryfile request.tsq
138           The name of the file containing a DER encoded time stamp request.
139           (Optional)
140
141       -passin password_src
142           Specifies the password source for the private key of the TSA. See
143           PASS PHRASE ARGUMENTS in openssl(1). (Optional)
144
145       -signer tsa_cert.pem
146           The signer certificate of the TSA in PEM format. The TSA signing
147           certificate must have exactly one extended key usage assigned to
148           it: timeStamping. The extended key usage must also be critical,
149           otherwise the certificate is going to be refused. Overrides the
150           signer_cert variable of the config file. (Optional)
151
152       -inkey private.pem
153           The signer private key of the TSA in PEM format. Overrides the
154           signer_key config file option. (Optional)
155
156       -chain certs_file.pem
157           The collection of certificates in PEM format that will all be
158           included in the response in addition to the signer certificate if
159           the -cert option was used for the request. This file is supposed to
160           contain the certificate chain for the signer certificate from its
161           issuer upwards. The -reply command does not build a certificate
162           chain automatically. (Optional)
163
164       -policy object_id
165           The default policy to use for the response unless the client
166           explicitly requires a particular TSA policy. The OID can be
167           specified either in dotted notation or with its name. Overrides the
168           default_policy config file option. (Optional)
169
170       -in response.tsr
171           Specifies a previously created time stamp response or time stamp
172           token (if -token_in is also specified) in DER format that will be
173           written to the output file. This option does not require a request,
174           it is useful e.g. when you need to examine the content of a
175           response or token or you want to extract the time stamp token from
176           a response. If the input is a token and the output is a time stamp
177           response a default 'granted' status info is added to the token.
178           (Optional)
179
180       -token_in
181           This flag can be used together with the -in option and indicates
182           that the input is a DER encoded time stamp token (ContentInfo)
183           instead of a time stamp response (TimeStampResp). (Optional)
184
185       -out response.tsr
186           The response is written to this file. The format and content of the
187           file depends on other options (see -text, -token_out). The default
188           is stdout. (Optional)
189
190       -token_out
191           The output is a time stamp token (ContentInfo) instead of time
192           stamp response (TimeStampResp). (Optional)
193
194       -text
195           If this option is specified the output is human-readable text
196           format instead of DER. (Optional)
197
198       -engine id
199           Specifying an engine (by its unique id string) will cause ts to
200           attempt to obtain a functional reference to the specified engine,
201           thus initialising it if needed. The engine will then be set as the
202           default for all available algorithms. Default is builtin.
203           (Optional)
204
205   Time Stamp Response verification
206       The -verify command is for verifying if a time stamp response or time
207       stamp token is valid and matches a particular time stamp request or
208       data file. The -verify command does not use the configuration file.
209
210       -data file_to_hash
211           The response or token must be verified against file_to_hash. The
212           file is hashed with the message digest algorithm specified in the
213           token.  The -digest and -queryfile options must not be specified
214           with this one.  (Optional)
215
216       -digest digest_bytes
217           The response or token must be verified against the message digest
218           specified with this option. The number of bytes must match the
219           message digest algorithm specified in the token. The -data and
220           -queryfile options must not be specified with this one. (Optional)
221
222       -queryfile request.tsq
223           The original time stamp request in DER format. The -data and
224           -digest options must not be specified with this one. (Optional)
225
226       -in response.tsr
227           The time stamp response that needs to be verified in DER format.
228           (Mandatory)
229
230       -token_in
231           This flag can be used together with the -in option and indicates
232           that the input is a DER encoded time stamp token (ContentInfo)
233           instead of a time stamp response (TimeStampResp). (Optional)
234
235       -CApath trusted_cert_path
236           The name of the directory containing the trused CA certificates of
237           the client. See the similar option of verify(1) for additional
238           details. Either this option or -CAfile must be specified.
239           (Optional)
240
241       -CAfile trusted_certs.pem
242           The name of the file containing a set of trusted self-signed CA
243           certificates in PEM format. See the similar option of verify(1) for
244           additional details. Either this option or -CApath must be
245           specified.  (Optional)
246
247       -untrusted cert_file.pem
248           Set of additional untrusted certificates in PEM format which may be
249           needed when building the certificate chain for the TSA's signing
250           certificate. This file must contain the TSA signing certificate and
251           all intermediate CA certificates unless the response includes them.
252           (Optional)
253

CONFIGURATION FILE OPTIONS

255       The -query and -reply commands make use of a configuration file defined
256       by the OPENSSL_CONF environment variable. See config(5) for a general
257       description of the syntax of the config file. The -query command uses
258       only the symbolic OID names section and it can work without it.
259       However, the -reply command needs the config file for its operation.
260
261       When there is a command line switch equivalent of a variable the switch
262       always overrides the settings in the config file.
263
264       tsa section, default_tsa
265           This is the main section and it specifies the name of another
266           section that contains all the options for the -reply command. This
267           default section can be overriden with the -section command line
268           switch. (Optional)
269
270       oid_file
271           See ca(1) for description. (Optional)
272
273       oid_section
274           See ca(1) for description. (Optional)
275
276       RANDFILE
277           See ca(1) for description. (Optional)
278
279       serial
280           The name of the file containing the hexadecimal serial number of
281           the last time stamp response created. This number is incremented by
282           1 for each response. If the file does not exist at the time of
283           response generation a new file is created with serial number 1.
284           (Mandatory)
285
286       crypto_device
287           Specifies the OpenSSL engine that will be set as the default for
288           all available algorithms. The default value is builtin, you can
289           specify any other engines supported by OpenSSL (e.g. use chil for
290           the NCipher HSM).  (Optional)
291
292       signer_cert
293           TSA signing certificate in PEM format. The same as the -signer
294           command line option. (Optional)
295
296       certs
297           A file containing a set of PEM encoded certificates that need to be
298           included in the response. The same as the -chain command line
299           option. (Optional)
300
301       signer_key
302           The private key of the TSA in PEM format. The same as the -inkey
303           command line option. (Optional)
304
305       default_policy
306           The default policy to use when the request does not mandate any
307           policy. The same as the -policy command line option. (Optional)
308
309       other_policies
310           Comma separated list of policies that are also acceptable by the
311           TSA and used only if the request explicitly specifies one of them.
312           (Optional)
313
314       digests
315           The list of message digest algorithms that the TSA accepts. At
316           least one algorithm must be specified. (Mandatory)
317
318       accuracy
319           The accuracy of the time source of the TSA in seconds, milliseconds
320           and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any
321           of the components is missing zero is assumed for that field.
322           (Optional)
323
324       clock_precision_digits
325           Specifies the maximum number of digits, which represent the
326           fraction of seconds, that  need to be included in the time field.
327           The trailing zeroes must be removed from the time, so there might
328           actually be fewer digits, or no fraction of seconds at all.
329           Supported only on UNIX platforms.  The maximum value is 6, default
330           is 0.  (Optional)
331
332       ordering
333           If this option is yes the responses generated by this TSA can
334           always be ordered, even if the time difference between two
335           responses is less than the sum of their accuracies. Default is no.
336           (Optional)
337
338       tsa_name
339           Set this option to yes if the subject name of the TSA must be
340           included in the TSA name field of the response. Default is no.
341           (Optional)
342
343       ess_cert_id_chain
344           The SignedData objects created by the TSA always contain the
345           certificate identifier of the signing certificate in a signed
346           attribute (see RFC 2634, Enhanced Security Services). If this
347           option is set to yes and either the certs variable or the -chain
348           option is specified then the certificate identifiers of the chain
349           will also be included in the SigningCertificate signed attribute.
350           If this variable is set to no, only the signing certificate
351           identifier is included. Default is no. (Optional)
352

ENVIRONMENT VARIABLES

354       OPENSSL_CONF contains the path of the configuration file and can be
355       overriden by the -config command line option.
356

EXAMPLES

358       All the examples below presume that OPENSSL_CONF is set to a proper
359       configuration file, e.g. the example configuration file
360       openssl/apps/openssl.cnf will do.
361
362   Time Stamp Request
363       To create a time stamp request for design1.txt with SHA-1 without nonce
364       and policy and no certificate is required in the response:
365
366         openssl ts -query -data design1.txt -no_nonce \
367               -out design1.tsq
368
369       To create a similar time stamp request with specifying the message
370       imprint explicitly:
371
372         openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
373                -no_nonce -out design1.tsq
374
375       To print the content of the previous request in human readable format:
376
377         openssl ts -query -in design1.tsq -text
378
379       To create a time stamp request which includes the MD-5 digest of
380       design2.txt, requests the signer certificate and nonce, specifies a
381       policy id (assuming the tsa_policy1 name is defined in the OID section
382       of the config file):
383
384         openssl ts -query -data design2.txt -md5 \
385               -policy tsa_policy1 -cert -out design2.tsq
386
387   Time Stamp Response
388       Before generating a response a signing certificate must be created for
389       the TSA that contains the timeStamping critical extended key usage
390       extension without any other key usage extensions. You can add the
391       'extendedKeyUsage = critical,timeStamping' line to the user certificate
392       section of the config file to generate a proper certificate. See
393       req(1), ca(1), x509(1) for instructions. The examples below assume that
394       cacert.pem contains the certificate of the CA, tsacert.pem is the
395       signing certificate issued by cacert.pem and tsakey.pem is the private
396       key of the TSA.
397
398       To create a time stamp response for a request:
399
400         openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \
401               -signer tsacert.pem -out design1.tsr
402
403       If you want to use the settings in the config file you could just
404       write:
405
406         openssl ts -reply -queryfile design1.tsq -out design1.tsr
407
408       To print a time stamp reply to stdout in human readable format:
409
410         openssl ts -reply -in design1.tsr -text
411
412       To create a time stamp token instead of time stamp response:
413
414         openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out
415
416       To print a time stamp token to stdout in human readable format:
417
418         openssl ts -reply -in design1_token.der -token_in -text -token_out
419
420       To extract the time stamp token from a response:
421
422         openssl ts -reply -in design1.tsr -out design1_token.der -token_out
423
424       To add 'granted' status info to a time stamp token thereby creating a
425       valid response:
426
427         openssl ts -reply -in design1_token.der -token_in -out design1.tsr
428
429   Time Stamp Verification
430       To verify a time stamp reply against a request:
431
432         openssl ts -verify -queryfile design1.tsq -in design1.tsr \
433               -CAfile cacert.pem -untrusted tsacert.pem
434
435       To verify a time stamp reply that includes the certificate chain:
436
437         openssl ts -verify -queryfile design2.tsq -in design2.tsr \
438               -CAfile cacert.pem
439
440       To verify a time stamp token against the original data file:
441         openssl ts -verify -data design2.txt -in design2.tsr \      -CAfile
442       cacert.pem
443
444       To verify a time stamp token against a message imprint:
445         openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
446             -in design2.tsr -CAfile cacert.pem
447
448       You could also look at the 'test' directory for more examples.
449

BUGS

451       If you find any bugs or you have suggestions please write to Zoltan
452       Glozik <zglozik@opentsa.org>. Known issues:
453
454       ·   No support for time stamps over SMTP, though it is quite easy to
455           implement an automatic e-mail based TSA with procmail(1) and
456           perl(1). HTTP server support is provided in the form of a separate
457           apache module. HTTP client support is provided by tsget(1). Pure
458           TCP/IP protocol is not supported.
459
460       ·   The file containing the last serial number of the TSA is not locked
461           when being read or written. This is a problem if more than one
462           instance of openssl(1) is trying to create a time stamp response at
463           the same time. This is not an issue when using the apache server
464           module, it does proper locking.
465
466       ·   Look for the FIXME word in the source files.
467
468       ·   The source code should really be reviewed by somebody else, too.
469
470       ·   More testing is needed, I have done only some basic tests (see
471           test/testtsa).
472

AUTHOR

474       Zoltan Glozik <zglozik@opentsa.org>, OpenTSA project
475       (http://www.opentsa.org)
476

SEE ALSO

478       tsget(1), openssl(1), req(1), x509(1), ca(1), genrsa(1), config(5)
479
480
481
4821.0.0e                            2009-04-10                             TS(1)
Impressum