Update files for OpenSSL-1.0.0f import.
[dragonfly.git] / secure / usr.bin / openssl / man / pkeyutl.1
CommitLineData
e3261593 1.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.19)
01185282
PA
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sp \" Vertical space (when we can't use .PP)
6.if t .sp .5v
7.if n .sp
8..
9.de Vb \" Begin verbatim text
10.ft CW
11.nf
12.ne \\$1
13..
14.de Ve \" End verbatim text
15.ft R
16.fi
17..
18.\" Set up some character translations and predefined strings. \*(-- will
19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20.\" double quote, and \*(R" will give a right double quote. \*(C+ will
21.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23.\" nothing in troff, for use with C<>.
24.tr \(*W-
25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26.ie n \{\
27. ds -- \(*W-
28. ds PI pi
29. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
31. ds L" ""
32. ds R" ""
33. ds C` ""
34. ds C' ""
35'br\}
36.el\{\
37. ds -- \|\(em\|
38. ds PI \(*p
39. ds L" ``
40. ds R" ''
41'br\}
42.\"
43.\" Escape single quotes in literal strings from groff's Unicode transform.
44.ie \n(.g .ds Aq \(aq
45.el .ds Aq '
46.\"
47.\" If the F register is turned on, we'll generate index entries on stderr for
48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49.\" entries marked with X<> in POD. Of course, you'll have to process the
50.\" output yourself in some meaningful fashion.
51.ie \nF \{\
52. de IX
53. tm Index:\\$1\t\\n%\t"\\$2"
54..
55. nr % 0
56. rr F
57.\}
58.el \{\
59. de IX
60..
61.\}
62.\"
63.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64.\" Fear. Run. Save yourself. No user-serviceable parts.
65. \" fudge factors for nroff and troff
66.if n \{\
67. ds #H 0
68. ds #V .8m
69. ds #F .3m
70. ds #[ \f1
71. ds #] \fP
72.\}
73.if t \{\
74. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75. ds #V .6m
76. ds #F 0
77. ds #[ \&
78. ds #] \&
79.\}
80. \" simple accents for nroff and troff
81.if n \{\
82. ds ' \&
83. ds ` \&
84. ds ^ \&
85. ds , \&
86. ds ~ ~
87. ds /
88.\}
89.if t \{\
90. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96.\}
97. \" troff and (daisy-wheel) nroff accents
98.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105.ds ae a\h'-(\w'a'u*4/10)'e
106.ds Ae A\h'-(\w'A'u*4/10)'E
107. \" corrections for vroff
108.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110. \" for low resolution devices (crt and lpr)
111.if \n(.H>23 .if \n(.V>19 \
112\{\
113. ds : e
114. ds 8 ss
115. ds o a
116. ds d- d\h'-1'\(ga
117. ds D- D\h'-1'\(hy
118. ds th \o'bp'
119. ds Th \o'LP'
120. ds ae ae
121. ds Ae AE
122.\}
123.rm #[ #] #H #V #F C
124.\" ========================================================================
125.\"
126.IX Title "PKEYUTL 1"
e3261593 127.TH PKEYUTL 1 "2012-01-04" "1.0.0f" "OpenSSL"
01185282
PA
128.\" For nroff, turn off justification. Always turn off hyphenation; it makes
129.\" way too many mistakes in technical documents.
130.if n .ad l
131.nh
132.SH "NAME"
133pkeyutl \- public key algorithm utility
134.SH "SYNOPSIS"
135.IX Header "SYNOPSIS"
136\&\fBopenssl\fR \fBpkeyutl\fR
137[\fB\-in file\fR]
138[\fB\-out file\fR]
139[\fB\-sigfile file\fR]
140[\fB\-inkey file\fR]
141[\fB\-keyform PEM|DER\fR]
142[\fB\-passin arg\fR]
143[\fB\-peerkey file\fR]
144[\fB\-peerform PEM|DER\fR]
145[\fB\-pubin\fR]
146[\fB\-certin\fR]
147[\fB\-rev\fR]
148[\fB\-sign\fR]
149[\fB\-verify\fR]
150[\fB\-verifyrecover\fR]
151[\fB\-encrypt\fR]
152[\fB\-decrypt\fR]
153[\fB\-derive\fR]
154[\fB\-pkeyopt opt:value\fR]
155[\fB\-hexdump\fR]
156[\fB\-asn1parse\fR]
157[\fB\-engine id\fR]
158.SH "DESCRIPTION"
159.IX Header "DESCRIPTION"
160The \fBpkeyutl\fR command can be used to perform public key operations using
161any supported algorithm.
162.SH "COMMAND OPTIONS"
163.IX Header "COMMAND OPTIONS"
164.IP "\fB\-in filename\fR" 4
165.IX Item "-in filename"
166This specifies the input filename to read data from or standard input
167if this option is not specified.
168.IP "\fB\-out filename\fR" 4
169.IX Item "-out filename"
170specifies the output filename to write to or standard output by
171default.
172.IP "\fB\-inkey file\fR" 4
173.IX Item "-inkey file"
174the input key file, by default it should be a private key.
175.IP "\fB\-keyform PEM|DER\fR" 4
176.IX Item "-keyform PEM|DER"
177the key format \s-1PEM\s0, \s-1DER\s0 or \s-1ENGINE\s0.
178.IP "\fB\-passin arg\fR" 4
179.IX Item "-passin arg"
180the input key password source. For more information about the format of \fBarg\fR
181see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
182.IP "\fB\-peerkey file\fR" 4
183.IX Item "-peerkey file"
184the peer key file, used by key derivation (agreement) operations.
185.IP "\fB\-peerform PEM|DER\fR" 4
186.IX Item "-peerform PEM|DER"
187the peer key format \s-1PEM\s0, \s-1DER\s0 or \s-1ENGINE\s0.
188.IP "\fB\-engine id\fR" 4
189.IX Item "-engine id"
190specifying an engine (by its unique \fBid\fR string) will cause \fBpkeyutl\fR
191to attempt to obtain a functional reference to the specified engine,
192thus initialising it if needed. The engine will then be set as the default
193for all available algorithms.
194.IP "\fB\-pubin\fR" 4
195.IX Item "-pubin"
196the input file is a public key.
197.IP "\fB\-certin\fR" 4
198.IX Item "-certin"
199the input is a certificate containing a public key.
200.IP "\fB\-rev\fR" 4
201.IX Item "-rev"
202reverse the order of the input buffer. This is useful for some libraries
203(such as CryptoAPI) which represent the buffer in little endian format.
204.IP "\fB\-sign\fR" 4
205.IX Item "-sign"
206sign the input data and output the signed result. This requires
207a private key.
208.IP "\fB\-verify\fR" 4
209.IX Item "-verify"
210verify the input data against the signature file and indicate if the
211verification succeeded or failed.
212.IP "\fB\-verifyrecover\fR" 4
213.IX Item "-verifyrecover"
214verify the input data and output the recovered data.
215.IP "\fB\-encrypt\fR" 4
216.IX Item "-encrypt"
217encrypt the input data using a public key.
218.IP "\fB\-decrypt\fR" 4
219.IX Item "-decrypt"
220decrypt the input data using a private key.
221.IP "\fB\-derive\fR" 4
222.IX Item "-derive"
223derive a shared secret using the peer key.
224.IP "\fB\-hexdump\fR" 4
225.IX Item "-hexdump"
226hex dump the output data.
227.IP "\fB\-asn1parse\fR" 4
228.IX Item "-asn1parse"
229asn1parse the output data, this is useful when combined with the
230\&\fB\-verifyrecover\fR option when an \s-1ASN1\s0 structure is signed.
231.SH "NOTES"
232.IX Header "NOTES"
233The operations and options supported vary according to the key algorithm
234and its implementation. The OpenSSL operations and options are indicated below.
235.PP
236Unless otherwise mentioned all algorithms support the \fBdigest:alg\fR option
237which specifies the digest in use for sign, verify and verifyrecover operations.
238The value \fBalg\fR should represent a digest name as used in the
239\&\fIEVP_get_digestbyname()\fR function for example \fBsha1\fR.
240.SH "RSA ALGORITHM"
241.IX Header "RSA ALGORITHM"
242The \s-1RSA\s0 algorithm supports encrypt, decrypt, sign, verify and verifyrecover
243operations in general. Some padding modes only support some of these
244operations however.
245.IP "\-\fBrsa_padding_mode:mode\fR" 4
246.IX Item "-rsa_padding_mode:mode"
247This sets the \s-1RSA\s0 padding mode. Acceptable values for \fBmode\fR are \fBpkcs1\fR for
248PKCS#1 padding, \fBsslv23\fR for SSLv23 padding, \fBnone\fR for no padding, \fBoaep\fR
249for \fB\s-1OAEP\s0\fR mode, \fBx931\fR for X9.31 mode and \fBpss\fR for \s-1PSS\s0.
250.Sp
251In PKCS#1 padding if the message digest is not set then the supplied data is
252signed or verified directly instead of using a \fBDigestInfo\fR structure. If a
253digest is set then the a \fBDigestInfo\fR structure is used and its the length
254must correspond to the digest type.
255.Sp
256For \fBoeap\fR mode only encryption and decryption is supported.
257.Sp
258For \fBx931\fR if the digest type is set it is used to format the block data
259otherwise the first byte is used to specify the X9.31 digest \s-1ID\s0. Sign,
260verify and verifyrecover are can be performed in this mode.
261.Sp
262For \fBpss\fR mode only sign and verify are supported and the digest type must be
263specified.
264.IP "\fBrsa_pss_saltlen:len\fR" 4
265.IX Item "rsa_pss_saltlen:len"
266For \fBpss\fR mode only this option specifies the salt length. Two special values
267are supported: \-1 sets the salt length to the digest length. When signing \-2
268sets the salt length to the maximum permissible value. When verifying \-2 causes
269the salt length to be automatically determined based on the \fB\s-1PSS\s0\fR block
270structure.
271.SH "DSA ALGORITHM"
272.IX Header "DSA ALGORITHM"
273The \s-1DSA\s0 algorithm supports signing and verification operations only. Currently
274there are no additional options other than \fBdigest\fR. Only the \s-1SHA1\s0
275digest can be used and this digest is assumed by default.
276.SH "DH ALGORITHM"
277.IX Header "DH ALGORITHM"
278The \s-1DH\s0 algorithm only supports the derivation operation and no additional
279options.
280.SH "EC ALGORITHM"
281.IX Header "EC ALGORITHM"
282The \s-1EC\s0 algorithm supports sign, verify and derive operations. The sign and
283verify operations use \s-1ECDSA\s0 and derive uses \s-1ECDH\s0. Currently there are no
284additional options other than \fBdigest\fR. Only the \s-1SHA1\s0 digest can be used and
285this digest is assumed by default.
286.SH "EXAMPLES"
287.IX Header "EXAMPLES"
288Sign some data using a private key:
289.PP
290.Vb 1
291\& openssl pkeyutl \-sign \-in file \-inkey key.pem \-out sig
292.Ve
293.PP
294Recover the signed data (e.g. if an \s-1RSA\s0 key is used):
295.PP
296.Vb 1
297\& openssl pkeyutl \-verifyrecover \-in sig \-inkey key.pem
298.Ve
299.PP
300Verify the signature (e.g. a \s-1DSA\s0 key):
301.PP
302.Vb 1
303\& openssl pkeyutl \-verify \-in file \-sigfile sig \-inkey key.pem
304.Ve
305.PP
306Sign data using a message digest value (this is currently only valid for \s-1RSA\s0):
307.PP
308.Vb 1
309\& openssl pkeyutl \-sign \-in file \-inkey key.pem \-out sig \-pkeyopt digest:sha256
310.Ve
311.PP
312Derive a shared secret value:
313.PP
314.Vb 1
315\& openssl pkeyutl \-derive \-inkey key.pem \-peerkey pubkey.pem \-out secret
316.Ve
317.SH "SEE ALSO"
318.IX Header "SEE ALSO"
319\&\fIgenpkey\fR\|(1), \fIpkey\fR\|(1), \fIrsautl\fR\|(1)
320\&\fIdgst\fR\|(1), \fIrsa\fR\|(1), \fIgenrsa\fR\|(1)