summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjmc <>2010-10-15 18:17:10 +0000
committerjmc <>2010-10-15 18:17:10 +0000
commit497e295047a93876a573d3833770ea89a9373008 (patch)
tree2950020735783a7d77e16b0979879f7825b99d6c /src
parentc4d2db97ae5975be802941c7adca968e953dd53c (diff)
downloadopenbsd-497e295047a93876a573d3833770ea89a9373008.tar.gz
openbsd-497e295047a93876a573d3833770ea89a9373008.tar.bz2
openbsd-497e295047a93876a573d3833770ea89a9373008.zip
document "openssl ts";
Diffstat (limited to 'src')
-rw-r--r--src/usr.sbin/openssl/openssl.1633
1 files changed, 629 insertions, 4 deletions
diff --git a/src/usr.sbin/openssl/openssl.1 b/src/usr.sbin/openssl/openssl.1
index 015adda638..9934bb6a10 100644
--- a/src/usr.sbin/openssl/openssl.1
+++ b/src/usr.sbin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.79 2010/10/14 20:41:28 jmc Exp $ 1.\" $OpenBSD: openssl.1,v 1.80 2010/10/15 18:17:10 jmc Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -112,7 +112,7 @@
112.\" 112.\"
113.\" OPENSSL 113.\" OPENSSL
114.\" 114.\"
115.Dd $Mdocdate: October 14 2010 $ 115.Dd $Mdocdate: October 15 2010 $
116.Dt OPENSSL 1 116.Dt OPENSSL 1
117.Os 117.Os
118.Sh NAME 118.Sh NAME
@@ -365,6 +365,8 @@ S/MIME mail processing.
365Algorithm speed measurement. 365Algorithm speed measurement.
366.It Cm spkac 366.It Cm spkac
367SPKAC printing and generating utility. 367SPKAC printing and generating utility.
368.It Cm ts
369Time stamping authority tool (client/server).
368.It Cm verify 370.It Cm verify
369X.509 certificate verification. 371X.509 certificate verification.
370.It Cm version 372.It Cm version
@@ -5193,8 +5195,12 @@ Print out text version of parameters:
5193$ openssl pkeyparam -in param.pem -text 5195$ openssl pkeyparam -in param.pem -text
5194.Ed 5196.Ed
5195.Sh PKEYPARAM NOTES 5197.Sh PKEYPARAM NOTES
5196There are no B<-inform> or B<-outform> options for this command because only 5198There are no
5197PEM format is supported because the key type is determined by the PEM headers. 5199.Fl inform
5200or
5201.Fl outform
5202options for this command because only PEM format is supported
5203because the key type is determined by the PEM headers.
5198.\" 5204.\"
5199.\" PKEYUTL 5205.\" PKEYUTL
5200.\" 5206.\"
@@ -8266,6 +8272,625 @@ Run
8266benchmarks in parallel. 8272benchmarks in parallel.
8267.El 8273.El
8268.\" 8274.\"
8275.\" TS
8276.\"
8277.Sh TS
8278.nr nS 1
8279.Nm "openssl ts"
8280.Bk -words
8281.Fl query
8282.Op Fl md4 | md5 | ripemd160 | sha | sha1
8283.Op Fl cert
8284.Op Fl no_nonce
8285.Op Fl text
8286.Op Fl config Ar configfile
8287.Op Fl data Ar file_to_hash
8288.Op Fl digest Ar digest_bytes
8289.Op Fl in Ar request.tsq
8290.Op Fl out Ar request.tsq
8291.Op Fl policy Ar object_id
8292.Op Fl rand Ar file : Ns Ar file
8293.Ek
8294.nr nS 0
8295.Pp
8296.nr nS 1
8297.Nm "openssl ts"
8298.Bk -words
8299.Fl reply
8300.Op Fl text
8301.Op Fl token_in
8302.Op Fl token_out
8303.Op Fl chain Ar certs_file.pem
8304.Op Fl config Ar configfile
8305.Op Fl engine Ar id
8306.Op Fl in Ar response.tsr
8307.Op Fl inkey Ar private.pem
8308.Op Fl out Ar response.tsr
8309.Op Fl passin Ar password_src
8310.Op Fl policy Ar object_id
8311.Op Fl queryfile Ar request.tsq
8312.Op Fl section Ar tsa_section
8313.Op Fl signer Ar tsa_cert.pem
8314.Ek
8315.nr nS 0
8316.Pp
8317.nr nS 1
8318.Nm "openssl ts"
8319.Bk -words
8320.Fl verify
8321.Op Fl token_in
8322.Op Fl CAfile Ar trusted_certs.pem
8323.Op Fl CApath Ar trusted_cert_path
8324.Op Fl data Ar file_to_hash
8325.Op Fl digest Ar digest_bytes
8326.Op Fl in Ar response.tsr
8327.Op Fl queryfile Ar request.tsq
8328.Op Fl untrusted Ar cert_file.pem
8329.Ek
8330.nr nS 0
8331.Pp
8332The
8333.Nm ts
8334command is a basic Time Stamping Authority (TSA) client and server
8335application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
8336A TSA can be part of a PKI deployment and its role is to provide long
8337term proof of the existence of a certain datum before a particular time.
8338Here is a brief description of the protocol:
8339.Bl -enum
8340.It
8341The TSA client computes a one-way hash value for a data file and sends
8342the hash to the TSA.
8343.It
8344The TSA attaches the current date and time to the received hash value,
8345signs them and sends the time stamp token back to the client.
8346By creating this token the TSA certifies the existence of the original
8347data file at the time of response generation.
8348.It
8349The TSA client receives the time stamp token and verifies the
8350signature on it.
8351It also checks if the token contains the same hash
8352value that it had sent to the TSA.
8353.El
8354.Pp
8355There is one DER encoded protocol data unit defined for transporting a time
8356stamp request to the TSA and one for sending the time stamp response
8357back to the client.
8358The
8359.Nm ts
8360command has three main functions:
8361creating a time stamp request based on a data file;
8362creating a time stamp response based on a request;
8363and verifying if a response corresponds
8364to a particular request or a data file.
8365.Pp
8366There is no support for sending the requests/responses automatically
8367over HTTP or TCP yet as suggested in RFC 3161.
8368Users must send the requests either by FTP or email.
8369.Pp
8370The
8371.Fl query
8372switch can be used for creating and printing a time stamp
8373request with the following options:
8374.Bl -tag -width Ds
8375.It Fl cert
8376The TSA is expected to include its signing certificate in the
8377response.
8378.It Fl config Ar configfile
8379The configuration file to use.
8380This option overrides the
8381.Ev OPENSSL_CONF
8382environment variable.
8383Only the OID section of the config file is used with the
8384.Fl query
8385command.
8386.It Fl data Ar file_to_hash
8387The data file for which the time stamp request needs to be created.
8388stdin is the default if neither the
8389.Fl data
8390nor the
8391.Fl digest
8392option is specified.
8393.It Fl digest Ar digest_bytes
8394It is possible to specify the message imprint explicitly without the data
8395file.
8396The imprint must be specified in a hexadecimal format,
8397two characters per byte,
8398the bytes optionally separated by colons (e.g. 1A:F6:01:... or 1AF601...).
8399The number of bytes must match the message digest algorithm in use.
8400.It Fl in Ar request.tsq
8401This option specifies a previously created time stamp request in DER
8402format that will be printed into the output file.
8403Useful when you need to examine the content of a request in human-readable
8404format.
8405.It Fl md4|md5|ripemd160|sha|sha1
8406The message digest to apply to the data file.
8407It supports all the message digest algorithms that are supported by the
8408.Nm dgst
8409command.
8410The default is SHA-1.
8411.It Fl no_nonce
8412No nonce is specified in the request if this option is given.
8413Otherwise a 64-bit long pseudo-random none is
8414included in the request.
8415It is recommended to use nonce to protect against replay-attacks.
8416.It Fl out Ar request.tsq
8417Name of the output file to which the request will be written.
8418The default is stdout.
8419.It Fl policy Ar object_id
8420The policy that the client expects the TSA to use for creating the
8421time stamp token.
8422Either the dotted OID notation or OID names defined
8423in the config file can be used.
8424If no policy is requested the TSA will
8425use its own default policy.
8426.It Fl rand Ar file : Ns Ar file
8427The files containing random data for seeding the random number generator.
8428Multiple files can be specified.
8429The separator is
8430.Sq \&;
8431for MS-Windows;
8432.Sq \&,
8433for VMS; and
8434.Sq \&:
8435for all other platforms.
8436.It Fl text
8437If this option is specified the output is in human-readable text format
8438instead of DER.
8439.El
8440.Pp
8441A time stamp response (TimeStampResp) consists of a response status
8442and the time stamp token itself (ContentInfo),
8443if the token generation was successful.
8444The
8445.Fl reply
8446command is for creating a time stamp
8447response or time stamp token based on a request and printing the
8448response/token in human-readable format.
8449If
8450.Fl token_out
8451is not specified the output is always a time stamp response (TimeStampResp),
8452otherwise it is a time stamp token (ContentInfo).
8453.Bl -tag -width Ds
8454.It Fl chain Ar certs_file.pem
8455The collection of certificates, in PEM format,
8456that will be included in the response
8457in addition to the signer certificate if the
8458.Fl cert
8459option was used for the request.
8460This file is supposed to contain the certificate chain
8461for the signer certificate from its issuer upwards.
8462The
8463.Fl reply
8464command does not build a certificate chain automatically.
8465.It Fl config Ar configfile
8466The configuration file to use.
8467This option overrides the
8468.Ev OPENSSL_CONF
8469environment variable.
8470See
8471.Sx TS CONFIGURATION FILE OPTIONS
8472for configurable variables.
8473.It Fl engine Ar id
8474Specifying an engine (by its unique
8475.Ar id
8476string) will cause
8477.Nm ts
8478to attempt to obtain a functional reference to the specified engine,
8479thus initialising it if needed.
8480The engine will then be set as the default
8481for all available algorithms.
8482.It Fl in Ar response.tsr
8483Specifies a previously created time stamp response or time stamp token, if
8484.Fl token_in
8485is also specified,
8486in DER format that will be written to the output file.
8487This option does not require a request;
8488it is useful, for example,
8489when you need to examine the content of a response or token
8490or you want to extract the time stamp token from a response.
8491If the input is a token and the output is a time stamp response a default
8492.Dq granted
8493status info is added to the token.
8494.It Fl inkey Ar private.pem
8495The signer private key of the TSA in PEM format.
8496Overrides the
8497.Cm signer_key
8498config file option.
8499.It Fl out Ar response.tsr
8500The response is written to this file.
8501The format and content of the file depends on other options (see
8502.Fl text
8503and
8504.Fl token_out ) .
8505The default is stdout.
8506.It Fl passin Ar password_src
8507Specifies the password source for the private key of the TSA.
8508See the
8509.Sx PASS PHRASE ARGUMENTS
8510section above.
8511.It Fl policy Ar object_id
8512The default policy to use for the response unless the client
8513explicitly requires a particular TSA policy.
8514The OID can be specified either in dotted notation or with its name.
8515Overrides the
8516.Cm default_policy
8517config file option.
8518.It Fl queryfile Ar request.tsq
8519The name of the file containing a DER-encoded time stamp request.
8520.It Fl section Ar tsa_section
8521The name of the config file section containing the settings for the
8522response generation.
8523If not specified the default TSA section is used; see
8524.Sx TS CONFIGURATION FILE OPTIONS
8525for details.
8526.It Fl signer Ar tsa_cert.pem
8527The signer certificate of the TSA in PEM format.
8528The TSA signing certificate must have exactly one extended key usage
8529assigned to it: timeStamping.
8530The extended key usage must also be critical,
8531otherwise the certificate is going to be refused.
8532Overrides the
8533.Cm signer_cert
8534variable of the config file.
8535.It Fl text
8536If this option is specified the output is human-readable text format
8537instead of DER.
8538.It Fl token_in
8539This flag can be used together with the
8540.Fl in
8541option and indicates that the input is a DER encoded time stamp token
8542(ContentInfo) instead of a time stamp response (TimeStampResp).
8543.It Fl token_out
8544The output is a time stamp token (ContentInfo) instead of time stamp
8545response (TimeStampResp).
8546.El
8547.Pp
8548The
8549.Fl verify
8550command is for verifying if a time stamp response or time stamp token
8551is valid and matches a particular time stamp request or data file.
8552The
8553.Fl verify
8554command does not use the configuration file.
8555.Bl -tag -width Ds
8556.It Fl CAfile Ar trusted_certs.pem
8557The name of the file containing a set of trusted self-signed CA
8558certificates in PEM format.
8559See the similar option of
8560.Nm verify
8561for additional details.
8562Either this option or
8563.Fl CApath
8564must be specified.
8565.It Fl CApath Ar trusted_cert_path
8566The name of the directory containing the trused CA certificates of the
8567client.
8568See the similar option of
8569.Nm verify
8570for additional details.
8571Either this option or
8572.Fl CAfile
8573must be specified.
8574.It Fl data Ar file_to_hash
8575The response or token must be verified against
8576.Ar file_to_hash .
8577The file is hashed with the message digest algorithm specified in the token.
8578The
8579.Fl digest
8580and
8581.Fl queryfile
8582options must not be specified with this one.
8583.It Fl digest Ar digest_bytes
8584The response or token must be verified against the message digest specified
8585with this option.
8586The number of bytes must match the message digest algorithm
8587specified in the token.
8588The
8589.Fl data
8590and
8591.Fl queryfile
8592options must not be specified with this one.
8593.It Fl in Ar response.tsr
8594The time stamp response that needs to be verified, in DER format.
8595This option in mandatory.
8596.It Fl queryfile Ar request.tsq
8597The original time stamp request, in DER format.
8598The
8599.Fl data
8600and
8601.Fl digest
8602options must not be specified with this one.
8603.It Fl token_in
8604This flag can be used together with the
8605.Fl in
8606option and indicates that the input is a DER-encoded time stamp token
8607(ContentInfo) instead of a time stamp response (TimeStampResp).
8608.It Fl untrusted Ar cert_file.pem
8609Set of additional untrusted certificates in PEM format which may be
8610needed when building the certificate chain for the TSA's signing
8611certificate.
8612This file must contain the TSA signing certificate and
8613all intermediate CA certificates unless the response includes them.
8614.El
8615.Sh TS CONFIGURATION FILE OPTIONS
8616The
8617.Fl query
8618and
8619.Fl reply
8620options make use of a configuration file defined by the
8621.Ev OPENSSL_CONF
8622environment variable.
8623The
8624.Fl query
8625option uses only the symbolic OID names section
8626and it can work without it.
8627However, the
8628.Fl reply
8629option needs the config file for its operation.
8630.Pp
8631When there is a command line switch equivalent of a variable the
8632switch always overrides the settings in the config file.
8633.Bl -tag -width Ds
8634.It Cm tsa Ar section , Cm default_tsa
8635This is the main section and it specifies the name of another section
8636that contains all the options for the
8637.Fl reply
8638option.
8639This default section can be overriden with the
8640.Fl section
8641command line switch.
8642.It Cm oid_file
8643See
8644.Nm ca
8645for a description.
8646.It Cm oid_section
8647See
8648.Nm ca
8649for a description.
8650.It Cm RANDFILE
8651See
8652.Nm ca
8653for a description.
8654.It Cm serial
8655The name of the file containing the hexadecimal serial number of the
8656last time stamp response created.
8657This number is incremented by 1 for each response.
8658If the file does not exist at the time of response
8659generation a new file is created with serial number 1.
8660This parameter is mandatory.
8661.It Cm crypto_device
8662Specifies the
8663.Nm OpenSSL
8664engine that will be set as the default for
8665all available algorithms.
8666.It Cm signer_cert
8667TSA signing certificate, in PEM format.
8668The same as the
8669.Fl signer
8670command line option.
8671.It Cm certs
8672A file containing a set of PEM-encoded certificates that need to be
8673included in the response.
8674The same as the
8675.Fl chain
8676command line option.
8677.It Cm signer_key
8678The private key of the TSA, in PEM format.
8679The same as the
8680.Fl inkey
8681command line option.
8682.It Cm default_policy
8683The default policy to use when the request does not mandate any policy.
8684The same as the
8685.Fl policy
8686command line option.
8687.It Cm other_policies
8688Comma separated list of policies that are also acceptable by the TSA
8689and used only if the request explicitly specifies one of them.
8690.It Cm digests
8691The list of message digest algorithms that the TSA accepts.
8692At least one algorithm must be specified.
8693This parameter is mandatory.
8694.It Cm accuracy
8695The accuracy of the time source of the TSA in seconds, milliseconds
8696and microseconds.
8697For example, secs:1, millisecs:500, microsecs:100.
8698If any of the components is missing,
8699zero is assumed for that field.
8700.It Cm clock_precision_digits
8701Specifies the maximum number of digits, which represent the fraction of
8702seconds, that need to be included in the time field.
8703The trailing zeroes must be removed from the time,
8704so there might actually be fewer digits,
8705or no fraction of seconds at all.
8706The maximum value is 6;
8707the default is 0.
8708.It Cm ordering
8709If this option is yes,
8710the responses generated by this TSA can always be ordered,
8711even if the time difference between two responses is less
8712than the sum of their accuracies.
8713The default is no.
8714.It Cm tsa_name
8715Set this option to yes if the subject name of the TSA must be included in
8716the TSA name field of the response.
8717The default is no.
8718.It Cm ess_cert_id_chain
8719The SignedData objects created by the TSA always contain the
8720certificate identifier of the signing certificate in a signed
8721attribute (see RFC 2634, Enhanced Security Services).
8722If this option is set to yes and either the
8723.Cm certs
8724variable or the
8725.Fl chain
8726option is specified then the certificate identifiers of the chain will also
8727be included in the SigningCertificate signed attribute.
8728If this variable is set to no,
8729only the signing certificate identifier is included.
8730The default is no.
8731.El
8732.Sh TS ENVIRONMENT VARIABLES
8733.Ev OPENSSL_CONF
8734contains the path of the configuration file and can be
8735overriden by the
8736.Fl config
8737command line option.
8738.Sh TS EXAMPLES
8739All the examples below presume that
8740.Ev OPENSSL_CONF
8741is set to a proper configuration file,
8742e.g. the example configuration file
8743.Pa openssl/apps/openssl.cnf
8744will do.
8745.Pp
8746To create a time stamp request for design1.txt with SHA-1
8747without nonce and policy and no certificate is required in the response:
8748.Bd -literal -offset indent
8749$ openssl ts -query -data design1.txt -no_nonce \e
8750 -out design1.tsq
8751.Ed
8752.Pp
8753To create a similar time stamp request but specifying the message imprint
8754explicitly:
8755.Bd -literal -offset indent
8756$ openssl ts -query \e
8757 -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \e
8758 -no_nonce -out design1.tsq
8759.Ed
8760.Pp
8761To print the content of the previous request in human readable format:
8762.Bd -literal -offset indent
8763$ openssl ts -query -in design1.tsq -text
8764.Ed
8765.Pp
8766To create a time stamp request which includes the MD5 digest
8767of design2.txt, requests the signer certificate and nonce,
8768specifies a policy ID
8769(assuming the tsa_policy1 name is defined in the
8770OID section of the config file):
8771.Bd -literal -offset indent
8772$ openssl ts -query -data design2.txt -md5 \e
8773 -policy tsa_policy1 -cert -out design2.tsq
8774.Ed
8775.Pp
8776Before generating a response,
8777a signing certificate must be created for the TSA that contains the
8778.Cm timeStamping
8779critical extended key usage extension
8780without any other key usage extensions.
8781You can add the
8782.Dq extendedKeyUsage = critical,timeStamping
8783line to the user certificate section
8784of the config file to generate a proper certificate.
8785See the
8786.Nm req ,
8787.Nm ca ,
8788and
8789.Nm x509
8790commands for instructions.
8791The examples below assume that cacert.pem contains the certificate of the CA,
8792tsacert.pem is the signing certificate issued by cacert.pem and
8793tsakey.pem is the private key of the TSA.
8794.Pp
8795To create a time stamp response for a request:
8796.Bd -literal -offset indent
8797$ openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \e
8798 -signer tsacert.pem -out design1.tsr
8799.Ed
8800.Pp
8801If you want to use the settings in the config file you could just write:
8802.Bd -literal -offset indent
8803$ openssl ts -reply -queryfile design1.tsq -out design1.tsr
8804.Ed
8805.Pp
8806To print a time stamp reply to stdout in human readable format:
8807.Bd -literal -offset indent
8808$ openssl ts -reply -in design1.tsr -text
8809.Ed
8810.Pp
8811To create a time stamp token instead of time stamp response:
8812.Bd -literal -offset indent
8813$ openssl ts -reply -queryfile design1.tsq \e
8814 -out design1_token.der -token_out
8815.Ed
8816.Pp
8817To print a time stamp token to stdout in human readable format:
8818.Bd -literal -offset indent
8819$ openssl ts -reply -in design1_token.der -token_in \e
8820 -text -token_out
8821.Ed
8822.Pp
8823To extract the time stamp token from a response:
8824.Bd -literal -offset indent
8825$ openssl ts -reply -in design1.tsr -out design1_token.der \e
8826 -token_out
8827.Ed
8828.Pp
8829To add
8830.Dq granted
8831status info to a time stamp token thereby creating a valid response:
8832.Bd -literal -offset indent
8833$ openssl ts -reply -in design1_token.der \e
8834 -token_in -out design1.tsr
8835.Ed
8836.Pp
8837To verify a time stamp reply against a request:
8838.Bd -literal -offset indent
8839$ openssl ts -verify -queryfile design1.tsq -in design1.tsr \e
8840 -CAfile cacert.pem -untrusted tsacert.pem
8841.Ed
8842.Pp
8843To verify a time stamp reply that includes the certificate chain:
8844.Bd -literal -offset indent
8845$ openssl ts -verify -queryfile design2.tsq -in design2.tsr \e
8846 -CAfile cacert.pem
8847.Ed
8848.Pp
8849To verify a time stamp token against the original data file:
8850.Bd -literal -offset indent
8851$ openssl ts -verify -data design2.txt -in design2.tsr \e
8852 -CAfile cacert.pem
8853.Ed
8854.Pp
8855To verify a time stamp token against a message imprint:
8856.Bd -literal -offset indent
8857$ openssl ts -verify \e
8858 -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \e
8859 -in design2.tsr -CAfile cacert.pem
8860.Ed
8861.Sh TS BUGS
8862.Pp
8863No support for time stamps over SMTP, though it is quite easy
8864to implement an automatic email-based TSA with
8865.Xr procmail
8866and
8867.Xr perl 1 .
8868HTTP server support is provided in the form of
8869a separate
8870.Xr httpd 8
8871module.
8872Pure TCP/IP is not supported.
8873.Pp
8874The file containing the last serial number of the TSA is not
8875locked when being read or written.
8876This is a problem if more than one instance of
8877.Nm OpenSSL
8878is trying to create a time stamp
8879response at the same time.
8880This is not an issue when using the
8881.Xr httpd 8
8882server module, which does proper locking.
8883.Pp
8884Look for the FIXME word in the source files.
8885.Pp
8886The source code should really be reviewed by somebody else, too.
8887.Pp
8888More testing is needed.
8889.Sh TS AUTHORS
8890.An Zoltan Glozik Aq zglozik@opentsa.org ,
8891OpenTSA project
8892.Pq Pa http://www.opentsa.org .
8893.\"
8269.\" SPKAC 8894.\" SPKAC
8270.\" 8895.\"
8271.Sh SPKAC 8896.Sh SPKAC