1PKEYUTL(1)                          OpenSSL                         PKEYUTL(1)
2
3
4

NAME

6       pkeyutl - public key algorithm utility
7

SYNOPSIS

9       openssl pkeyutl [-in file] [-out file] [-sigfile file] [-inkey file]
10       [-keyform PEM|DER] [-passin arg] [-peerkey file] [-peerform PEM|DER]
11       [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt]
12       [-decrypt] [-derive] [-pkeyopt opt:value] [-hexdump] [-asn1parse]
13       [-engine id]
14

DESCRIPTION

16       The pkeyutl command can be used to perform public key operations using
17       any supported algorithm.
18

COMMAND OPTIONS

20       -in filename
21           This specifies the input filename to read data from or standard
22           input if this option is not specified.
23
24       -out filename
25           specifies the output filename to write to or standard output by
26           default.
27
28       -inkey file
29           the input key file, by default it should be a private key.
30
31       -keyform PEM|DER
32           the key format PEM, DER or ENGINE.
33
34       -passin arg
35           the input key password source. For more information about the
36           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
37
38       -peerkey file
39           the peer key file, used by key derivation (agreement) operations.
40
41       -peerform PEM|DER
42           the peer key format PEM, DER or ENGINE.
43
44       -engine id
45           specifying an engine (by its unique id string) will cause pkeyutl
46           to attempt to obtain a functional reference to the specified
47           engine, thus initialising it if needed. The engine will then be set
48           as the default for all available algorithms.
49
50       -pubin
51           the input file is a public key.
52
53       -certin
54           the input is a certificate containing a public key.
55
56       -rev
57           reverse the order of the input buffer. This is useful for some
58           libraries (such as CryptoAPI) which represent the buffer in little
59           endian format.
60
61       -sign
62           sign the input data and output the signed result. This requires a
63           private key.
64
65       -verify
66           verify the input data against the signature file and indicate if
67           the verification succeeded or failed.
68
69       -verifyrecover
70           verify the input data and output the recovered data.
71
72       -encrypt
73           encrypt the input data using a public key.
74
75       -decrypt
76           decrypt the input data using a private key.
77
78       -derive
79           derive a shared secret using the peer key.
80
81       -hexdump
82           hex dump the output data.
83
84       -asn1parse
85           asn1parse the output data, this is useful when combined with the
86           -verifyrecover option when an ASN1 structure is signed.
87

NOTES

89       The operations and options supported vary according to the key
90       algorithm and its implementation. The OpenSSL operations and options
91       are indicated below.
92
93       Unless otherwise mentioned all algorithms support the digest:alg option
94       which specifies the digest in use for sign, verify and verifyrecover
95       operations.  The value alg should represent a digest name as used in
96       the EVP_get_digestbyname() function for example sha1.
97

RSA ALGORITHM

99       The RSA algorithm supports encrypt, decrypt, sign, verify and
100       verifyrecover operations in general. Some padding modes only support
101       some of these operations however.
102
103       -rsa_padding_mode:mode
104           This sets the RSA padding mode. Acceptable values for mode are
105           pkcs1 for PKCS#1 padding, sslv23 for SSLv23 padding, none for no
106           padding, oaep for OAEP mode, x931 for X9.31 mode and pss for PSS.
107
108           In PKCS#1 padding if the message digest is not set then the
109           supplied data is signed or verified directly instead of using a
110           DigestInfo structure. If a digest is set then the a DigestInfo
111           structure is used and its the length must correspond to the digest
112           type.
113
114           For oeap mode only encryption and decryption is supported.
115
116           For x931 if the digest type is set it is used to format the block
117           data otherwise the first byte is used to specify the X9.31 digest
118           ID. Sign, verify and verifyrecover are can be performed in this
119           mode.
120
121           For pss mode only sign and verify are supported and the digest type
122           must be specified.
123
124       rsa_pss_saltlen:len
125           For pss mode only this option specifies the salt length. Two
126           special values are supported: -1 sets the salt length to the digest
127           length. When signing -2 sets the salt length to the maximum
128           permissible value. When verifying -2 causes the salt length to be
129           automatically determined based on the PSS block structure.
130

DSA ALGORITHM

132       The DSA algorithm supports signing and verification operations only.
133       Currently there are no additional options other than digest. Only the
134       SHA1 digest can be used and this digest is assumed by default.
135

DH ALGORITHM

137       The DH algorithm only supports the derivation operation and no
138       additional options.
139

EC ALGORITHM

141       The EC algorithm supports sign, verify and derive operations. The sign
142       and verify operations use ECDSA and derive uses ECDH. Currently there
143       are no additional options other than digest. Only the SHA1 digest can
144       be used and this digest is assumed by default.
145

EXAMPLES

147       Sign some data using a private key:
148
149        openssl pkeyutl -sign -in file -inkey key.pem -out sig
150
151       Recover the signed data (e.g. if an RSA key is used):
152
153        openssl pkeyutl -verifyrecover -in sig -inkey key.pem
154
155       Verify the signature (e.g. a DSA key):
156
157        openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem
158
159       Sign data using a message digest value (this is currently only valid
160       for RSA):
161
162        openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256
163
164       Derive a shared secret value:
165
166        openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret
167

SEE ALSO

169       genpkey(1), pkey(1), rsautl(1) dgst(1), rsa(1), genrsa(1)
170
171
172
1731.0.1e                            2013-02-11                        PKEYUTL(1)
Impressum