summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjmc <>2010-10-12 18:36:03 +0000
committerjmc <>2010-10-12 18:36:03 +0000
commitece3cf542b143293343f3e71053e2eb7c6b40b87 (patch)
tree2b366d54863bbe41491881b7facac04be761727f /src
parentcf1172f0df0a72a9576ab5827e8002cb01a905f9 (diff)
downloadopenbsd-ece3cf542b143293343f3e71053e2eb7c6b40b87.tar.gz
openbsd-ece3cf542b143293343f3e71053e2eb7c6b40b87.tar.bz2
openbsd-ece3cf542b143293343f3e71053e2eb7c6b40b87.zip
document "openssl pkeyutl";
Diffstat (limited to 'src')
-rw-r--r--src/usr.sbin/openssl/openssl.1214
1 files changed, 212 insertions, 2 deletions
diff --git a/src/usr.sbin/openssl/openssl.1 b/src/usr.sbin/openssl/openssl.1
index 73cbf23686..ce075f1300 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.74 2010/10/09 18:22:46 jmc Exp $ 1.\" $OpenBSD: openssl.1,v 1.75 2010/10/12 18:36:03 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 9 2010 $ 115.Dd $Mdocdate: October 12 2010 $
116.Dt OPENSSL 1 116.Dt OPENSSL 1
117.Os 117.Os
118.Sh NAME 118.Sh NAME
@@ -318,6 +318,8 @@ PKCS#8 data management.
318PKCS#12 data management. 318PKCS#12 data management.
319.It Cm pkey 319.It Cm pkey
320Public and private key management. 320Public and private key management.
321.It Cm pkeyutl
322Public key algorithm cryptographic operation utility.
321.It Cm rand 323.It Cm rand
322Generate pseudo-random bytes. 324Generate pseudo-random bytes.
323.It Cm req 325.It Cm req
@@ -5144,6 +5146,214 @@ To just output the public part of a private key:
5144$ openssl pkey -in key.pem -pubout -out pubkey.pem 5146$ openssl pkey -in key.pem -pubout -out pubkey.pem
5145.Ed 5147.Ed
5146.\" 5148.\"
5149.\" PKEYUTL
5150.\"
5151.Sh PKEYUTL
5152.Cm openssl pkeyutl
5153.Bk -words
5154.Op Fl asn1parse
5155.Op Fl certin
5156.Op Fl decrypt
5157.Op Fl derive
5158.Op Fl encrypt
5159.Op Fl hexdump
5160.Op Fl pubin
5161.Op Fl rev
5162.Op Fl sign
5163.Op Fl verify
5164.Op Fl verifyrecover
5165.Op Fl engine Ar id
5166.Op Fl in Ar file
5167.Op Fl inkey Ar file
5168.Op Fl keyform Ar DER | PEM
5169.Op Fl out Ar file
5170.Op Fl passin Ar arg
5171.Op Fl peerform Ar DER | PEM
5172.Op Fl peerkey Ar file
5173.Op Fl pkeyopt Ar opt : Ns Ar value
5174.Op Fl sigfile Ar file
5175.Ek
5176.Pp
5177The
5178.Nm pkeyutl
5179command can be used to perform public key operations using
5180any supported algorithm.
5181.Pp
5182The options are as follows:
5183.Bl -tag -width Ds
5184.It Fl asn1parse
5185ASN1parse the output data.
5186This is useful when combined with the
5187.Fl verifyrecover
5188option when an ASN1 structure is signed.
5189.It Fl certin
5190The input is a certificate containing a public key.
5191.It Fl decrypt
5192Decrypt the input data using a private key.
5193.It Fl derive
5194Derive a shared secret using the peer key.
5195.It Fl encrypt
5196Encrypt the input data using a public key.
5197.It Fl engine Ar id
5198Specifying an engine (by its unique
5199.Ar id
5200string) will cause
5201.Nm pkeyutl
5202to attempt to obtain a functional reference to the specified engine,
5203thus initialising it if needed.
5204The engine will then be set as the default
5205for all available algorithms.
5206.It Fl hexdump
5207Hex dump the output data.
5208.It Fl in Ar file
5209Specify the input filename to read data from,
5210or standard input if this option is not specified.
5211.It Fl inkey Ar file
5212The input key file.
5213By default it should be a private key.
5214.It Fl keyform Ar DER | PEM
5215The key format DER, PEM, or ENGINE.
5216.It Fl out Ar file
5217Specify the output filename to write to,
5218or standard output by default.
5219.It Fl passin Ar arg
5220The input key password source.
5221For more information about the format of
5222.Ar arg
5223see the
5224.Sx PASS PHRASE ARGUMENTS
5225section above.
5226.It Fl peerform Ar DER | PEM
5227The peer key format DER, PEM, or ENGINE.
5228.It Fl peerkey Ar file
5229The peer key file, used by key derivation (agreement) operations.
5230.It Fl pkeyopt Ar opt : Ns Ar value
5231Public key options.
5232.It Fl pubin
5233The input file is a public key.
5234.It Fl rev
5235Reverse the order of the input buffer.
5236This is useful for some libraries (such as CryptoAPI)
5237which represent the buffer in little endian format.
5238.It Fl sigfile Ar file
5239Signature file (verify operation only).
5240.It Fl sign
5241Sign the input data and output the signed result.
5242This requires a private key.
5243.It Fl verify
5244Verify the input data against the signature file and indicate if the
5245verification succeeded or failed.
5246.It Fl verifyrecover
5247Verify the input data and output the recovered data.
5248.El
5249.Sh PKEYUTL NOTES
5250The operations and options supported vary according to the key algorithm
5251and its implementation.
5252The
5253.Nm OpenSSL
5254operations and options are indicated below.
5255.Pp
5256Unless otherwise mentioned all algorithms support the
5257.Ar digest : Ns Ar alg
5258option which specifies the digest in use
5259for sign, verify, and verifyrecover operations.
5260The value
5261.Ar alg
5262should represent a digest name as used in the
5263.Fn EVP_get_digestbyname
5264function, for example
5265.Cm sha1 .
5266.Ss RSA algorithm
5267The RSA algorithm supports the
5268encrypt, decrypt, sign, verify, and verifyrecover operations in general.
5269Some padding modes only support some of these
5270operations however.
5271.Bl -tag -width Ds
5272.It rsa_padding_mode : Ns Ar mode
5273This sets the RSA padding mode.
5274Acceptable values for
5275.Ar mode
5276are
5277.Cm pkcs1
5278for PKCS#1 padding;
5279.Cm sslv23
5280for SSLv23 padding;
5281.Cm none
5282for no padding;
5283.Cm oaep
5284for OAEP mode;
5285.Cm x931
5286for X9.31 mode;
5287and
5288.Cm pss
5289for PSS.
5290.Pp
5291In PKCS#1 padding if the message digest is not set then the supplied data is
5292signed or verified directly instead of using a DigestInfo structure.
5293If a digest is set then a DigestInfo
5294structure is used and its length
5295must correspond to the digest type.
5296.Pp
5297For oeap mode only encryption and decryption is supported.
5298.Pp
5299For x931 if the digest type is set it is used to format the block data;
5300otherwise the first byte is used to specify the X9.31 digest ID.
5301Sign, verify, and verifyrecover can be performed in this mode.
5302.Pp
5303For pss mode only sign and verify are supported and the digest type must be
5304specified.
5305.It rsa_pss_saltlen : Ns Ar len
5306For pss
5307mode only this option specifies the salt length.
5308Two special values are supported:
5309-1 sets the salt length to the digest length.
5310When signing -2 sets the salt length to the maximum permissible value.
5311When verifying -2 causes the salt length to be automatically determined
5312based on the PSS block structure.
5313.El
5314.Ss DSA algorithm
5315The DSA algorithm supports the sign and verify operations.
5316Currently there are no additional options other than
5317.Ar digest .
5318Only the SHA1 digest can be used and this digest is assumed by default.
5319.Ss DH algorithm
5320The DH algorithm supports the derive operation
5321and no additional options.
5322.Ss EC algorithm
5323The EC algorithm supports the sign, verify, and derive operations.
5324The sign and verify operations use ECDSA and derive uses ECDH.
5325Currently there are no additional options other than
5326.Ar digest .
5327Only the SHA1 digest can be used and this digest is assumed by default.
5328.Sh PKEYUTL EXAMPLES
5329Sign some data using a private key:
5330.Bd -literal -offset indent
5331$ openssl pkeyutl -sign -in file -inkey key.pem -out sig
5332.Ed
5333.Pp
5334Recover the signed data (e.g. if an RSA key is used):
5335.Bd -literal -offset indent
5336$ openssl pkeyutl -verifyrecover -in sig -inkey key.pem
5337.Ed
5338.Pp
5339Verify the signature (e.g. a DSA key):
5340.Bd -literal -offset indent
5341$ openssl pkeyutl -verify -in file -sigfile sig \e
5342 -inkey key.pem
5343.Ed
5344.Pp
5345Sign data using a message digest value (this is currently only valid for RSA):
5346.Bd -literal -offset indent
5347$ openssl pkeyutl -sign -in file -inkey key.pem \e
5348 -out sig -pkeyopt digest:sha256
5349.Ed
5350.Pp
5351Derive a shared secret value:
5352.Bd -literal -offset indent
5353$ openssl pkeyutl -derive -inkey key.pem \e
5354 -peerkey pubkey.pem -out secret
5355.Ed
5356.\"
5147.\" RAND 5357.\" RAND
5148.\" 5358.\"
5149.Sh RAND 5359.Sh RAND