]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man1/ts.pod
chacha/asm/chacha-x86_64.pl: add dedicated path for 128-byte inputs.
[thirdparty/openssl.git] / doc / man1 / ts.pod
CommitLineData
c7235be6
UM
1=pod
2
3=head1 NAME
4
3f2181e6 5openssl-ts,
c7235be6
UM
6ts - Time Stamping Authority tool (client/server)
7
8=head1 SYNOPSIS
9
10B<openssl> B<ts>
11B<-query>
3ee1eac2
RS
12[B<-rand file...>]
13[B<-writerand file>]
c7235be6
UM
14[B<-config> configfile]
15[B<-data> file_to_hash]
16[B<-digest> digest_bytes]
e75138ab 17[B<-I<digest>>]
08538fc0 18[B<-tspolicy> object_id]
c7235be6
UM
19[B<-no_nonce>]
20[B<-cert>]
21[B<-in> request.tsq]
22[B<-out> request.tsq]
23[B<-text>]
24
25B<openssl> B<ts>
26B<-reply>
27[B<-config> configfile]
28[B<-section> tsa_section]
29[B<-queryfile> request.tsq]
30[B<-passin> password_src]
31[B<-signer> tsa_cert.pem]
48b53522 32[B<-inkey> file_or_id]
e75138ab 33[B<-I<digest>>]
c7235be6 34[B<-chain> certs_file.pem]
08538fc0 35[B<-tspolicy> object_id]
c7235be6
UM
36[B<-in> response.tsr]
37[B<-token_in>]
38[B<-out> response.tsr]
39[B<-token_out>]
40[B<-text>]
41[B<-engine> id]
42
43B<openssl> B<ts>
44B<-verify>
45[B<-data> file_to_hash]
46[B<-digest> digest_bytes]
47[B<-queryfile> request.tsq]
48[B<-in> response.tsr]
49[B<-token_in>]
50[B<-CApath> trusted_cert_path]
51[B<-CAfile> trusted_certs.pem]
52[B<-untrusted> cert_file.pem]
08538fc0 53[I<verify options>]
54
55I<verify options:>
56[-attime timestamp]
57[-check_ss_sig]
58[-crl_check]
59[-crl_check_all]
60[-explicit_policy]
61[-extended_crl]
62[-ignore_critical]
63[-inhibit_any]
64[-inhibit_map]
65[-issuer_checks]
66[-no_alt_chains]
67[-no_check_time]
68[-partial_chain]
69[-policy arg]
70[-policy_check]
71[-policy_print]
72[-purpose purpose]
73[-suiteB_128]
74[-suiteB_128_only]
75[-suiteB_192]
76[-trusted_first]
77[-use_deltas]
fbb82a60 78[-auth_level num]
08538fc0 79[-verify_depth num]
80[-verify_email email]
81[-verify_hostname hostname]
82[-verify_ip ip]
83[-verify_name name]
84[-x509_strict]
c7235be6
UM
85
86=head1 DESCRIPTION
87
88The B<ts> command is a basic Time Stamping Authority (TSA) client and server
89application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A
90TSA can be part of a PKI deployment and its role is to provide long
91term proof of the existence of a certain datum before a particular
92time. Here is a brief description of the protocol:
93
94=over 4
95
96=item 1.
97
98The TSA client computes a one-way hash value for a data file and sends
99the hash to the TSA.
100
101=item 2.
102
103The TSA attaches the current date and time to the received hash value,
104signs them and sends the time stamp token back to the client. By
105creating this token the TSA certifies the existence of the original
106data file at the time of response generation.
107
108=item 3.
109
110The TSA client receives the time stamp token and verifies the
111signature on it. It also checks if the token contains the same hash
112value that it had sent to the TSA.
113
114=back
115
116There is one DER encoded protocol data unit defined for transporting a time
117stamp request to the TSA and one for sending the time stamp response
118back to the client. The B<ts> command has three main functions:
119creating a time stamp request based on a data file,
120creating a time stamp response based on a request, verifying if a
121response corresponds to a particular request or a data file.
122
123There is no support for sending the requests/responses automatically
124over HTTP or TCP yet as suggested in RFC 3161. The users must send the
125requests either by ftp or e-mail.
126
127=head1 OPTIONS
128
129=head2 Time Stamp Request generation
130
131The B<-query> switch can be used for creating and printing a time stamp
132request with the following options:
133
134=over 4
135
3ee1eac2 136=item B<-rand file...>
c7235be6 137
3ee1eac2
RS
138A file or files containing random data used to seed the random number
139generator.
140Multiple files can be specified separated by an OS-dependent character.
141The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
142all others.
143
144=item [B<-writerand file>]
145
146Writes random data to the specified I<file> upon exit.
147This can be used with a subsequent B<-rand> flag.
c7235be6
UM
148
149=item B<-config> configfile
150
e9681f83
RS
151The configuration file to use.
152Optional; for a description of the default value,
153see L<openssl(1)/COMMAND SUMMARY>.
c7235be6
UM
154
155=item B<-data> file_to_hash
156
157The data file for which the time stamp request needs to be
158created. stdin is the default if neither the B<-data> nor the B<-digest>
159parameter is specified. (Optional)
160
161=item B<-digest> digest_bytes
162
163It is possible to specify the message imprint explicitly without the data
164file. The imprint must be specified in a hexadecimal format, two characters
165per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or
4c583c36 1661AF601...). The number of bytes must match the message digest algorithm
c7235be6
UM
167in use. (Optional)
168
e75138ab 169=item B<-I<digest>>
c7235be6 170
c03726ca
RS
171The message digest to apply to the data file.
172Any digest supported by the OpenSSL B<dgst> command can be used.
11503177 173The default is SHA-1. (Optional)
c7235be6 174
08538fc0 175=item B<-tspolicy> object_id
c7235be6
UM
176
177The policy that the client expects the TSA to use for creating the
178time stamp token. Either the dotted OID notation or OID names defined
179in the config file can be used. If no policy is requested the TSA will
180use its own default policy. (Optional)
181
182=item B<-no_nonce>
183
184No nonce is specified in the request if this option is
185given. Otherwise a 64 bit long pseudo-random none is
186included in the request. It is recommended to use nonce to
187protect against replay-attacks. (Optional)
188
189=item B<-cert>
190
191The TSA is expected to include its signing certificate in the
192response. (Optional)
193
194=item B<-in> request.tsq
195
196This option specifies a previously created time stamp request in DER
197format that will be printed into the output file. Useful when you need
198to examine the content of a request in human-readable
c7235be6
UM
199format. (Optional)
200
201=item B<-out> request.tsq
202
203Name of the output file to which the request will be written. Default
204is stdout. (Optional)
205
206=item B<-text>
207
208If this option is specified the output is human-readable text format
209instead of DER. (Optional)
210
211=back
212
213=head2 Time Stamp Response generation
214
215A time stamp response (TimeStampResp) consists of a response status
216and the time stamp token itself (ContentInfo), if the token generation was
217successful. The B<-reply> command is for creating a time stamp
218response or time stamp token based on a request and printing the
219response/token in human-readable format. If B<-token_out> is not
220specified the output is always a time stamp response (TimeStampResp),
221otherwise it is a time stamp token (ContentInfo).
222
223=over 4
224
225=item B<-config> configfile
226
e9681f83
RS
227The configuration file to use.
228Optional; for a description of the default value,
229see L<openssl(1)/COMMAND SUMMARY>.
230See B<CONFIGURATION FILE OPTIONS> for configurable variables.
c7235be6
UM
231
232=item B<-section> tsa_section
233
4c583c36 234The name of the config file section containing the settings for the
c7235be6
UM
235response generation. If not specified the default TSA section is
236used, see B<CONFIGURATION FILE OPTIONS> for details. (Optional)
237
238=item B<-queryfile> request.tsq
239
240The name of the file containing a DER encoded time stamp request. (Optional)
241
242=item B<-passin> password_src
243
244Specifies the password source for the private key of the TSA. See
9b86974e 245B<PASS PHRASE ARGUMENTS> in L<openssl(1)>. (Optional)
c7235be6
UM
246
247=item B<-signer> tsa_cert.pem
248
249The signer certificate of the TSA in PEM format. The TSA signing
250certificate must have exactly one extended key usage assigned to it:
251timeStamping. The extended key usage must also be critical, otherwise
252the certificate is going to be refused. Overrides the B<signer_cert>
253variable of the config file. (Optional)
254
48b53522 255=item B<-inkey> file_or_id
c7235be6
UM
256
257The signer private key of the TSA in PEM format. Overrides the
258B<signer_key> config file option. (Optional)
48b53522
RS
259If no engine is used, the argument is taken as a file; if an engine is
260specified, the argument is given to the engine as a key identifier.
c7235be6 261
e75138ab 262=item B<-I<digest>>
e20b4727
DSH
263
264Signing digest to use. Overrides the B<signer_digest> config file
265option. (Optional)
266
c7235be6
UM
267=item B<-chain> certs_file.pem
268
269The collection of certificates in PEM format that will all
270be included in the response in addition to the signer certificate if
271the B<-cert> option was used for the request. This file is supposed to
272contain the certificate chain for the signer certificate from its
273issuer upwards. The B<-reply> command does not build a certificate
274chain automatically. (Optional)
275
08538fc0 276=item B<-tspolicy> object_id
c7235be6
UM
277
278The default policy to use for the response unless the client
279explicitly requires a particular TSA policy. The OID can be specified
280either in dotted notation or with its name. Overrides the
281B<default_policy> config file option. (Optional)
282
283=item B<-in> response.tsr
284
285Specifies a previously created time stamp response or time stamp token
286(if B<-token_in> is also specified) in DER format that will be written
287to the output file. This option does not require a request, it is
288useful e.g. when you need to examine the content of a response or
289token or you want to extract the time stamp token from a response. If
290the input is a token and the output is a time stamp response a default
291'granted' status info is added to the token. (Optional)
292
293=item B<-token_in>
294
295This flag can be used together with the B<-in> option and indicates
296that the input is a DER encoded time stamp token (ContentInfo) instead
297of a time stamp response (TimeStampResp). (Optional)
298
299=item B<-out> response.tsr
300
301The response is written to this file. The format and content of the
302file depends on other options (see B<-text>, B<-token_out>). The default is
303stdout. (Optional)
304
305=item B<-token_out>
306
307The output is a time stamp token (ContentInfo) instead of time stamp
308response (TimeStampResp). (Optional)
309
310=item B<-text>
311
312If this option is specified the output is human-readable text format
313instead of DER. (Optional)
314
315=item B<-engine> id
316
e5fa864f 317Specifying an engine (by its unique B<id> string) will cause B<ts>
c7235be6
UM
318to attempt to obtain a functional reference to the specified engine,
319thus initialising it if needed. The engine will then be set as the default
320for all available algorithms. Default is builtin. (Optional)
321
322=back
323
324=head2 Time Stamp Response verification
325
326The B<-verify> command is for verifying if a time stamp response or time
327stamp token is valid and matches a particular time stamp request or
328data file. The B<-verify> command does not use the configuration file.
329
330=over 4
331
332=item B<-data> file_to_hash
333
334The response or token must be verified against file_to_hash. The file
4c583c36 335is hashed with the message digest algorithm specified in the token.
c7235be6
UM
336The B<-digest> and B<-queryfile> options must not be specified with this one.
337(Optional)
338
339=item B<-digest> digest_bytes
340
341The response or token must be verified against the message digest specified
342with this option. The number of bytes must match the message digest algorithm
343specified in the token. The B<-data> and B<-queryfile> options must not be
344specified with this one. (Optional)
345
346=item B<-queryfile> request.tsq
347
348The original time stamp request in DER format. The B<-data> and B<-digest>
349options must not be specified with this one. (Optional)
350
351=item B<-in> response.tsr
352
353The time stamp response that needs to be verified in DER format. (Mandatory)
354
355=item B<-token_in>
356
357This flag can be used together with the B<-in> option and indicates
358that the input is a DER encoded time stamp token (ContentInfo) instead
359of a time stamp response (TimeStampResp). (Optional)
360
361=item B<-CApath> trusted_cert_path
362
4c583c36 363The name of the directory containing the trusted CA certificates of the
9b86974e 364client. See the similar option of L<verify(1)> for additional
c7235be6
UM
365details. Either this option or B<-CAfile> must be specified. (Optional)
366
367
368=item B<-CAfile> trusted_certs.pem
369
4c583c36
AM
370The name of the file containing a set of trusted self-signed CA
371certificates in PEM format. See the similar option of
9b86974e 372L<verify(1)> for additional details. Either this option
c7235be6
UM
373or B<-CApath> must be specified.
374(Optional)
375
376=item B<-untrusted> cert_file.pem
377
378Set of additional untrusted certificates in PEM format which may be
379needed when building the certificate chain for the TSA's signing
380certificate. This file must contain the TSA signing certificate and
381all intermediate CA certificates unless the response includes them.
382(Optional)
383
08538fc0 384=item I<verify options>
385
fbb82a60
VD
386The options B<-attime timestamp>, B<-check_ss_sig>, B<-crl_check>,
387B<-crl_check_all>, B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>,
388B<-inhibit_any>, B<-inhibit_map>, B<-issuer_checks>, B<-no_alt_chains>,
389B<-no_check_time>, B<-partial_chain>, B<-policy>, B<-policy_check>,
390B<-policy_print>, B<-purpose>, B<-suiteB_128>, B<-suiteB_128_only>,
391B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>, B<-auth_level>,
392B<-verify_depth>, B<-verify_email>, B<-verify_hostname>, B<-verify_ip>,
393B<-verify_name>, and B<-x509_strict> can be used to control timestamp
394verification. See L<verify(1)>.
08538fc0 395
c7235be6
UM
396=back
397
398=head1 CONFIGURATION FILE OPTIONS
399
e9681f83
RS
400The B<-query> and B<-reply> commands make use of a configuration file.
401See L<config(5)>
c7235be6
UM
402for a general description of the syntax of the config file. The
403B<-query> command uses only the symbolic OID names section
404and it can work without it. However, the B<-reply> command needs the
405config file for its operation.
406
407When there is a command line switch equivalent of a variable the
408switch always overrides the settings in the config file.
409
410=over 4
411
4c583c36 412=item B<tsa> section, B<default_tsa>
c7235be6
UM
413
414This is the main section and it specifies the name of another section
415that contains all the options for the B<-reply> command. This default
2b4ffc65 416section can be overridden with the B<-section> command line switch. (Optional)
c7235be6
UM
417
418=item B<oid_file>
419
9b86974e 420See L<ca(1)> for description. (Optional)
c7235be6
UM
421
422=item B<oid_section>
423
9b86974e 424See L<ca(1)> for description. (Optional)
c7235be6
UM
425
426=item B<RANDFILE>
427
9b86974e 428See L<ca(1)> for description. (Optional)
c7235be6
UM
429
430=item B<serial>
431
432The name of the file containing the hexadecimal serial number of the
433last time stamp response created. This number is incremented by 1 for
28f7e60d 434each response. If the file does not exist at the time of response
c7235be6
UM
435generation a new file is created with serial number 1. (Mandatory)
436
437=item B<crypto_device>
438
4c583c36
AM
439Specifies the OpenSSL engine that will be set as the default for
440all available algorithms. The default value is builtin, you can specify
c7235be6
UM
441any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM).
442(Optional)
443
444=item B<signer_cert>
445
446TSA signing certificate in PEM format. The same as the B<-signer>
447command line option. (Optional)
448
449=item B<certs>
450
451A file containing a set of PEM encoded certificates that need to be
452included in the response. The same as the B<-chain> command line
453option. (Optional)
454
455=item B<signer_key>
456
457The private key of the TSA in PEM format. The same as the B<-inkey>
458command line option. (Optional)
459
e20b4727
DSH
460=item B<signer_digest>
461
462Signing digest to use. The same as the
e75138ab 463B<-I<digest>> command line option. (Optional)
e20b4727 464
c7235be6
UM
465=item B<default_policy>
466
467The default policy to use when the request does not mandate any
08538fc0 468policy. The same as the B<-tspolicy> command line option. (Optional)
c7235be6
UM
469
470=item B<other_policies>
471
472Comma separated list of policies that are also acceptable by the TSA
473and used only if the request explicitly specifies one of them. (Optional)
474
475=item B<digests>
476
477The list of message digest algorithms that the TSA accepts. At least
478one algorithm must be specified. (Mandatory)
479
480=item B<accuracy>
481
482The accuracy of the time source of the TSA in seconds, milliseconds
483and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of
484the components is missing zero is assumed for that field. (Optional)
485
486=item B<clock_precision_digits>
487
4c583c36 488Specifies the maximum number of digits, which represent the fraction of
c7235be6
UM
489seconds, that need to be included in the time field. The trailing zeroes
490must be removed from the time, so there might actually be fewer digits,
491or no fraction of seconds at all. Supported only on UNIX platforms.
492The maximum value is 6, default is 0.
493(Optional)
494
495=item B<ordering>
496
497If this option is yes the responses generated by this TSA can always
498be ordered, even if the time difference between two responses is less
499than the sum of their accuracies. Default is no. (Optional)
500
501=item B<tsa_name>
502
503Set this option to yes if the subject name of the TSA must be included in
504the TSA name field of the response. Default is no. (Optional)
505
506=item B<ess_cert_id_chain>
507
508The SignedData objects created by the TSA always contain the
509certificate identifier of the signing certificate in a signed
510attribute (see RFC 2634, Enhanced Security Services). If this option
511is set to yes and either the B<certs> variable or the B<-chain> option
512is specified then the certificate identifiers of the chain will also
513be included in the SigningCertificate signed attribute. If this
514variable is set to no, only the signing certificate identifier is
515included. Default is no. (Optional)
516
f0ef20bf
MK
517=item B<ess_cert_id_alg>
518
519This option specifies the hash function to be used to calculate the TSA's
520public key certificate identifier. Default is sha1. (Optional)
521
c7235be6
UM
522=back
523
c7235be6
UM
524=head1 EXAMPLES
525
526All the examples below presume that B<OPENSSL_CONF> is set to a proper
4c583c36 527configuration file, e.g. the example configuration file
c7235be6
UM
528openssl/apps/openssl.cnf will do.
529
530=head2 Time Stamp Request
531
4c583c36 532To create a time stamp request for design1.txt with SHA-1
c7235be6
UM
533without nonce and policy and no certificate is required in the response:
534
535 openssl ts -query -data design1.txt -no_nonce \
1bc74519 536 -out design1.tsq
c7235be6
UM
537
538To create a similar time stamp request with specifying the message imprint
539explicitly:
540
541 openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
1bc74519 542 -no_nonce -out design1.tsq
c7235be6
UM
543
544To print the content of the previous request in human readable format:
545
546 openssl ts -query -in design1.tsq -text
547
4c583c36 548To create a time stamp request which includes the MD-5 digest
c7235be6
UM
549of design2.txt, requests the signer certificate and nonce,
550specifies a policy id (assuming the tsa_policy1 name is defined in the
551OID section of the config file):
552
553 openssl ts -query -data design2.txt -md5 \
1bc74519 554 -tspolicy tsa_policy1 -cert -out design2.tsq
c7235be6
UM
555
556=head2 Time Stamp Response
557
558Before generating a response a signing certificate must be created for
559the TSA that contains the B<timeStamping> critical extended key usage extension
560without any other key usage extensions. You can add the
561'extendedKeyUsage = critical,timeStamping' line to the user certificate section
9b86974e
RS
562of the config file to generate a proper certificate. See L<req(1)>,
563L<ca(1)>, L<x509(1)> for instructions. The examples
c7235be6
UM
564below assume that cacert.pem contains the certificate of the CA,
565tsacert.pem is the signing certificate issued by cacert.pem and
566tsakey.pem is the private key of the TSA.
567
568To create a time stamp response for a request:
569
570 openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \
1bc74519 571 -signer tsacert.pem -out design1.tsr
c7235be6
UM
572
573If you want to use the settings in the config file you could just write:
574
575 openssl ts -reply -queryfile design1.tsq -out design1.tsr
576
577To print a time stamp reply to stdout in human readable format:
578
579 openssl ts -reply -in design1.tsr -text
580
581To create a time stamp token instead of time stamp response:
582
583 openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out
584
585To print a time stamp token to stdout in human readable format:
586
587 openssl ts -reply -in design1_token.der -token_in -text -token_out
588
589To extract the time stamp token from a response:
590
591 openssl ts -reply -in design1.tsr -out design1_token.der -token_out
592
593To add 'granted' status info to a time stamp token thereby creating a
594valid response:
595
596 openssl ts -reply -in design1_token.der -token_in -out design1.tsr
597
598=head2 Time Stamp Verification
599
600To verify a time stamp reply against a request:
601
602 openssl ts -verify -queryfile design1.tsq -in design1.tsr \
1bc74519 603 -CAfile cacert.pem -untrusted tsacert.pem
c7235be6
UM
604
605To verify a time stamp reply that includes the certificate chain:
606
607 openssl ts -verify -queryfile design2.tsq -in design2.tsr \
1bc74519 608 -CAfile cacert.pem
c7235be6
UM
609
610To verify a time stamp token against the original data file:
611 openssl ts -verify -data design2.txt -in design2.tsr \
1bc74519 612 -CAfile cacert.pem
c7235be6
UM
613
614To verify a time stamp token against a message imprint:
615 openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
1bc74519 616 -in design2.tsr -CAfile cacert.pem
c7235be6
UM
617
618You could also look at the 'test' directory for more examples.
619
620=head1 BUGS
621
b275f3b6
RL
622=for comment foreign manuals: procmail(1), perl(1)
623
2f61bc2e
RS
624=over 2
625
626=item *
c7235be6 627
2f61bc2e 628No support for time stamps over SMTP, though it is quite easy
9b86974e
RS
629to implement an automatic e-mail based TSA with L<procmail(1)>
630and L<perl(1)>. HTTP server support is provided in the form of
c7235be6 631a separate apache module. HTTP client support is provided by
9b86974e 632L<tsget(1)>. Pure TCP/IP protocol is not supported.
c7235be6 633
2f61bc2e
RS
634=item *
635
636The file containing the last serial number of the TSA is not
c7235be6 637locked when being read or written. This is a problem if more than one
9b86974e 638instance of L<openssl(1)> is trying to create a time stamp
c7235be6
UM
639response at the same time. This is not an issue when using the apache
640server module, it does proper locking.
641
2f61bc2e
RS
642=item *
643
644Look for the FIXME word in the source files.
645
646=item *
647
648The source code should really be reviewed by somebody else, too.
c7235be6 649
2f61bc2e 650=item *
c7235be6 651
2f61bc2e 652More testing is needed, I have done only some basic tests (see
c7235be6
UM
653test/testtsa).
654
655=back
656
c7235be6
UM
657=head1 SEE ALSO
658
9b86974e
RS
659L<tsget(1)>, L<openssl(1)>, L<req(1)>,
660L<x509(1)>, L<ca(1)>, L<genrsa(1)>,
661L<config(5)>
c7235be6 662
e2f92610
RS
663=head1 COPYRIGHT
664
c4de074e 665Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
e2f92610
RS
666
667Licensed under the OpenSSL license (the "License"). You may not use
668this file except in compliance with the License. You can obtain a copy
669in the file LICENSE in the source distribution or at
670L<https://www.openssl.org/source/license.html>.
671
672=cut