tsget.pod 6.3 KB

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