1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos tsget - Time Stamping HTTP/HTTPS client 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos B<tsget> 10 1.1 christos B<-h> I<server_url> 11 1.1 christos [B<-e> I<extension>] 12 1.1 christos [B<-o> I<output>] 13 1.1 christos [B<-v>] 14 1.1 christos [B<-d>] 15 1.1 christos [B<-k> I<private_key.pem>] 16 1.1 christos [B<-p> I<key_password>] 17 1.1 christos [B<-c> I<client_cert.pem>] 18 1.1 christos [B<-C> I<CA_certs.pem>] 19 1.1 christos [B<-P> I<CA_path>] 20 1.1 christos [B<-r> I<files>] 21 1.1 christos [B<-g> I<EGD_socket>] 22 1.1 christos [I<request> ...] 23 1.1 christos 24 1.1 christos =head1 DESCRIPTION 25 1.1 christos 26 1.1 christos This command can be used for sending a timestamp request, as specified 27 1.1 christos in RFC 3161, to a timestamp server over HTTP or HTTPS and storing the 28 1.1 christos timestamp response in a file. It cannot be used for creating the requests 29 1.1 christos and verifying responses, you have to use L<openssl-ts(1)> to do that. This 30 1.1 christos command can send several requests to the server without closing the TCP 31 1.1 christos connection if more than one requests are specified on the command line. 32 1.1 christos 33 1.1 christos This command sends the following HTTP request for each timestamp request: 34 1.1 christos 35 1.1 christos POST url HTTP/1.1 36 1.1 christos User-Agent: OpenTSA tsget.pl/<version> 37 1.1 christos Host: <host>:<port> 38 1.1 christos Pragma: no-cache 39 1.1 christos Content-Type: application/timestamp-query 40 1.1 christos Accept: application/timestamp-reply 41 1.1 christos Content-Length: length of body 42 1.1 christos 43 1.1 christos ...binary request specified by the user... 44 1.1 christos 45 1.1 christos It expects a response of type application/timestamp-reply, which is 46 1.1 christos written to a file without any interpretation. 47 1.1 christos 48 1.1 christos =head1 OPTIONS 49 1.1 christos 50 1.1 christos =over 4 51 1.1 christos 52 1.1 christos =item B<-h> I<server_url> 53 1.1 christos 54 1.1 christos The URL of the HTTP/HTTPS server listening for timestamp requests. 55 1.1 christos 56 1.1 christos =item B<-e> I<extension> 57 1.1 christos 58 1.1 christos If the B<-o> option is not given this argument specifies the extension of the 59 1.1 christos output files. The base name of the output file will be the same as those of 60 1.1 christos the input files. Default extension is F<.tsr>. (Optional) 61 1.1 christos 62 1.1 christos =item B<-o> I<output> 63 1.1 christos 64 1.1 christos This option can be specified only when just one request is sent to the 65 1.1 christos server. The timestamp response will be written to the given output file. '-' 66 1.1 christos means standard output. In case of multiple timestamp requests or the absence 67 1.1 christos of this argument the names of the output files will be derived from the names 68 1.1 christos of the input files and the default or specified extension argument. (Optional) 69 1.1 christos 70 1.1 christos =item B<-v> 71 1.1 christos 72 1.1 christos The name of the currently processed request is printed on standard 73 1.1 christos error. (Optional) 74 1.1 christos 75 1.1 christos =item B<-d> 76 1.1 christos 77 1.1 christos =for comment perlpodstyle(1) says to refer to modules without section 78 1.1 christos 79 1.1 christos Switches on verbose mode for the underlying perl module L<WWW::Curl::Easy>. 80 1.1 christos You can see detailed debug messages for the connection. (Optional) 81 1.1 christos 82 1.1 christos =item B<-k> I<private_key.pem> 83 1.1 christos 84 1.1 christos (HTTPS) In case of certificate-based client authentication over HTTPS 85 1.1 christos I<private_key.pem> must contain the private key of the user. The private key 86 1.1 christos file can optionally be protected by a passphrase. The B<-c> option must also 87 1.1 christos be specified. (Optional) 88 1.1 christos 89 1.1 christos =item B<-p> I<key_password> 90 1.1 christos 91 1.1 christos (HTTPS) Specifies the passphrase for the private key specified by the B<-k> 92 1.1 christos argument. If this option is omitted and the key is passphrase protected, 93 1.1 christos it will be prompted for. (Optional) 94 1.1 christos 95 1.1 christos =item B<-c> I<client_cert.pem> 96 1.1 christos 97 1.1 christos (HTTPS) In case of certificate-based client authentication over HTTPS 98 1.1 christos I<client_cert.pem> must contain the X.509 certificate of the user. The B<-k> 99 1.1 christos option must also be specified. If this option is not specified no 100 1.1 christos certificate-based client authentication will take place. (Optional) 101 1.1 christos 102 1.1 christos =item B<-C> I<CA_certs.pem> 103 1.1 christos 104 1.1 christos (HTTPS) The trusted CA certificate store. The certificate chain of the peer's 105 1.1 christos certificate must include one of the CA certificates specified in this file. 106 1.1 christos Either option B<-C> or option B<-P> must be given in case of HTTPS. (Optional) 107 1.1 christos 108 1.1 christos =item B<-P> I<CA_path> 109 1.1 christos 110 1.1 christos (HTTPS) The path containing the trusted CA certificates to verify the peer's 111 1.1 christos certificate. The directory must be prepared with L<openssl-rehash(1)>. Either 112 1.1 christos option B<-C> or option B<-P> must be given in case of HTTPS. (Optional) 113 1.1 christos 114 1.1 christos =item B<-r> I<files> 115 1.1 christos 116 1.1 christos See L<openssl(1)/Random State Options> for more information. 117 1.1 christos 118 1.1 christos =item B<-g> I<EGD_socket> 119 1.1 christos 120 1.1 christos The name of an EGD socket to get random data from. (Optional) 121 1.1 christos 122 1.1 christos =item I<request> ... 123 1.1 christos 124 1.1 christos List of files containing RFC 3161 DER-encoded timestamp requests. If no 125 1.1 christos requests are specified only one request will be sent to the server and it will 126 1.1 christos be read from the standard input. 127 1.1 christos (Optional) 128 1.1 christos 129 1.1 christos =back 130 1.1 christos 131 1.1 christos =head1 ENVIRONMENT VARIABLES 132 1.1 christos 133 1.1 christos The B<TSGET> environment variable can optionally contain default 134 1.1 christos arguments. The content of this variable is added to the list of command line 135 1.1 christos arguments. 136 1.1 christos 137 1.1 christos =head1 EXAMPLES 138 1.1 christos 139 1.1 christos The examples below presume that F<file1.tsq> and F<file2.tsq> contain valid 140 1.1 christos timestamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests 141 1.1 christos and at port 8443 for HTTPS requests, the TSA service is available at the /tsa 142 1.1 christos absolute path. 143 1.1 christos 144 1.1 christos Get a timestamp response for F<file1.tsq> over HTTP, output is written to 145 1.1 christos F<file1.tsr>: 146 1.1 christos 147 1.1 christos tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq 148 1.1 christos 149 1.1 christos Get a timestamp response for F<file1.tsq> and F<file2.tsq> over HTTP showing 150 1.1 christos progress, output is written to F<file1.reply> and F<file2.reply> respectively: 151 1.1 christos 152 1.1 christos tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \ 153 1.1 christos file1.tsq file2.tsq 154 1.1 christos 155 1.1 christos Create a timestamp request, write it to F<file3.tsq>, send it to the server and 156 1.1 christos write the response to F<file3.tsr>: 157 1.1 christos 158 1.1 christos openssl ts -query -data file3.txt -cert | tee file3.tsq \ 159 1.1 christos | tsget -h http://tsa.opentsa.org:8080/tsa \ 160 1.1 christos -o file3.tsr 161 1.1 christos 162 1.1 christos Get a timestamp response for F<file1.tsq> over HTTPS without client 163 1.1 christos authentication: 164 1.1 christos 165 1.1 christos tsget -h https://tsa.opentsa.org:8443/tsa \ 166 1.1 christos -C cacerts.pem file1.tsq 167 1.1 christos 168 1.1 christos Get a timestamp response for F<file1.tsq> over HTTPS with certificate-based 169 1.1 christos client authentication (it will ask for the passphrase if F<client_key.pem> is 170 1.1 christos protected): 171 1.1 christos 172 1.1 christos tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \ 173 1.1 christos -k client_key.pem -c client_cert.pem file1.tsq 174 1.1 christos 175 1.1 christos You can shorten the previous command line if you make use of the B<TSGET> 176 1.1 christos environment variable. The following commands do the same as the previous 177 1.1 christos example: 178 1.1 christos 179 1.1 christos TSGET='-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \ 180 1.1 christos -k client_key.pem -c client_cert.pem' 181 1.1 christos export TSGET 182 1.1 christos tsget file1.tsq 183 1.1 christos 184 1.1 christos =head1 SEE ALSO 185 1.1 christos 186 1.1 christos =for openssl foreign manual WWW::Curl::Easy 187 1.1 christos 188 1.1 christos L<openssl(1)>, 189 1.1 christos L<openssl-ts(1)>, 190 1.1 christos L<WWW::Curl::Easy>, 191 1.1 christos L<https://www.rfc-editor.org/rfc/rfc3161.html> 192 1.1 christos 193 1.1 christos =head1 COPYRIGHT 194 1.1 christos 195 1.1 christos Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. 196 1.1 christos 197 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 198 1.1 christos this file except in compliance with the License. You can obtain a copy 199 1.1 christos in the file LICENSE in the source distribution or at 200 1.1 christos L<https://www.openssl.org/source/license.html>. 201 1.1 christos 202 1.1 christos =cut 203