]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/pkcs8.1
This commit was generated by cvs2svn to compensate for changes in r107606,
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / pkcs8.1
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Tue Jul 30 09:20:51 2002
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "PKCS8 1"
141 .TH PKCS8 1 "0.9.6e" "2000-04-13" "OpenSSL"
142 .UC
143 .SH "NAME"
144 pkcs8 \- PKCS#8 format private key conversion tool
145 .SH "SYNOPSIS"
146 .IX Header "SYNOPSIS"
147 \&\fBopenssl\fR \fBpkcs8\fR
148 [\fB\-topk8\fR]
149 [\fB\-inform PEM|DER\fR]
150 [\fB\-outform PEM|DER\fR]
151 [\fB\-in filename\fR]
152 [\fB\-passin arg\fR]
153 [\fB\-out filename\fR]
154 [\fB\-passout arg\fR]
155 [\fB\-noiter\fR]
156 [\fB\-nocrypt\fR]
157 [\fB\-nooct\fR]
158 [\fB\-embed\fR]
159 [\fB\-nsdb\fR]
160 [\fB\-v2 alg\fR]
161 [\fB\-v1 alg\fR]
162 .SH "DESCRIPTION"
163 .IX Header "DESCRIPTION"
164 The \fBpkcs8\fR command processes private keys in PKCS#8 format. It can handle
165 both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo
166 format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
167 .SH "COMMAND OPTIONS"
168 .IX Header "COMMAND OPTIONS"
169 .Ip "\fB\-topk8\fR" 4
170 .IX Item "-topk8"
171 Normally a PKCS#8 private key is expected on input and a traditional format
172 private key will be written. With the \fB\-topk8\fR option the situation is
173 reversed: it reads a traditional format private key and writes a PKCS#8
174 format key.
175 .Ip "\fB\-inform DER|PEM\fR" 4
176 .IX Item "-inform DER|PEM"
177 This specifies the input format. If a PKCS#8 format key is expected on input
178 then either a \fB\s-1DER\s0\fR or \fB\s-1PEM\s0\fR encoded version of a PKCS#8 key will be
179 expected. Otherwise the \fB\s-1DER\s0\fR or \fB\s-1PEM\s0\fR format of the traditional format
180 private key is used.
181 .Ip "\fB\-outform DER|PEM\fR" 4
182 .IX Item "-outform DER|PEM"
183 This specifies the output format, the options have the same meaning as the 
184 \&\fB\-inform\fR option.
185 .Ip "\fB\-in filename\fR" 4
186 .IX Item "-in filename"
187 This specifies the input filename to read a key from or standard input if this
188 option is not specified. If the key is encrypted a pass phrase will be
189 prompted for.
190 .Ip "\fB\-passin arg\fR" 4
191 .IX Item "-passin arg"
192 the input file password source. For more information about the format of \fBarg\fR
193 see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in openssl(1).
194 .Ip "\fB\-out filename\fR" 4
195 .IX Item "-out filename"
196 This specifies the output filename to write a key to or standard output by
197 default. If any encryption options are set then a pass phrase will be
198 prompted for. The output filename should \fBnot\fR be the same as the input
199 filename.
200 .Ip "\fB\-passout arg\fR" 4
201 .IX Item "-passout arg"
202 the output file password source. For more information about the format of \fBarg\fR
203 see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in openssl(1).
204 .Ip "\fB\-nocrypt\fR" 4
205 .IX Item "-nocrypt"
206 PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo
207 structures using an appropriate password based encryption algorithm. With
208 this option an unencrypted PrivateKeyInfo structure is expected or output.
209 This option does not encrypt private keys at all and should only be used
210 when absolutely necessary. Certain software such as some versions of Java
211 code signing software used unencrypted private keys.
212 .Ip "\fB\-nooct\fR" 4
213 .IX Item "-nooct"
214 This option generates \s-1RSA\s0 private keys in a broken format that some software
215 uses. Specifically the private key should be enclosed in a \s-1OCTET\s0 \s-1STRING\s0
216 but some software just includes the structure itself without the
217 surrounding \s-1OCTET\s0 \s-1STRING\s0.
218 .Ip "\fB\-embed\fR" 4
219 .IX Item "-embed"
220 This option generates \s-1DSA\s0 keys in a broken format. The \s-1DSA\s0 parameters are
221 embedded inside the PrivateKey structure. In this form the \s-1OCTET\s0 \s-1STRING\s0
222 contains an \s-1ASN1\s0 \s-1SEQUENCE\s0 consisting of two structures: a \s-1SEQUENCE\s0 containing
223 the parameters and an \s-1ASN1\s0 \s-1INTEGER\s0 containing the private key.
224 .Ip "\fB\-nsdb\fR" 4
225 .IX Item "-nsdb"
226 This option generates \s-1DSA\s0 keys in a broken format compatible with Netscape
227 private key databases. The PrivateKey contains a \s-1SEQUENCE\s0 consisting of
228 the public and private keys respectively.
229 .Ip "\fB\-v2 alg\fR" 4
230 .IX Item "-v2 alg"
231 This option enables the use of PKCS#5 v2.0 algorithms. Normally PKCS#8
232 private keys are encrypted with the password based encryption algorithm
233 called \fBpbeWithMD5AndDES-CBC\fR this uses 56 bit \s-1DES\s0 encryption but it
234 was the strongest encryption algorithm supported in PKCS#5 v1.5. Using 
235 the \fB\-v2\fR option PKCS#5 v2.0 algorithms are used which can use any
236 encryption algorithm such as 168 bit triple \s-1DES\s0 or 128 bit \s-1RC2\s0 however
237 not many implementations support PKCS#5 v2.0 yet. If you are just using
238 private keys with OpenSSL then this doesn't matter.
239 .Sp
240 The \fBalg\fR argument is the encryption algorithm to use, valid values include
241 \&\fBdes\fR, \fBdes3\fR and \fBrc2\fR. It is recommended that \fBdes3\fR is used.
242 .Ip "\fB\-v1 alg\fR" 4
243 .IX Item "-v1 alg"
244 This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. A complete
245 list of possible algorithms is included below.
246 .SH "NOTES"
247 .IX Header "NOTES"
248 The encrypted form of a \s-1PEM\s0 encode PKCS#8 files uses the following
249 headers and footers:
250 .PP
251 .Vb 2
252 \& -----BEGIN ENCRYPTED PRIVATE KEY-----
253 \& -----END ENCRYPTED PRIVATE KEY-----
254 .Ve
255 The unencrypted form uses:
256 .PP
257 .Vb 2
258 \& -----BEGIN PRIVATE KEY-----
259 \& -----END PRIVATE KEY-----
260 .Ve
261 Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration
262 counts are more secure that those encrypted using the traditional
263 SSLeay compatible formats. So if additional security is considered
264 important the keys should be converted.
265 .PP
266 The default encryption is only 56 bits because this is the encryption
267 that most current implementations of PKCS#8 will support.
268 .PP
269 Some software may use PKCS#12 password based encryption algorithms
270 with PKCS#8 format private keys: these are handled automatically
271 but there is no option to produce them.
272 .PP
273 It is possible to write out \s-1DER\s0 encoded encrypted private keys in
274 PKCS#8 format because the encryption details are included at an \s-1ASN1\s0
275 level whereas the traditional format includes them at a \s-1PEM\s0 level.
276 .SH "PKCS#5 v1.5 and PKCS#12 algorithms."
277 .IX Header "PKCS#5 v1.5 and PKCS#12 algorithms."
278 Various algorithms can be used with the \fB\-v1\fR command line option,
279 including PKCS#5 v1.5 and PKCS#12. These are described in more detail
280 below.
281 .Ip "\fB\s-1PBE-MD2\-DES\s0 \s-1PBE-MD5\-DES\s0\fR" 4
282 .IX Item "PBE-MD2-DES PBE-MD5-DES"
283 These algorithms were included in the original PKCS#5 v1.5 specification.
284 They only offer 56 bits of protection since they both use \s-1DES\s0.
285 .Ip "\fB\s-1PBE-SHA1\-RC2\-64\s0 \s-1PBE-MD2\-RC2\-64\s0 \s-1PBE-MD5\-RC2\-64\s0 \s-1PBE-SHA1\-DES\s0\fR" 4
286 .IX Item "PBE-SHA1-RC2-64 PBE-MD2-RC2-64 PBE-MD5-RC2-64 PBE-SHA1-DES"
287 These algorithms are not mentioned in the original PKCS#5 v1.5 specification
288 but they use the same key derivation algorithm and are supported by some
289 software. They are mentioned in PKCS#5 v2.0. They use either 64 bit \s-1RC2\s0 or
290 56 bit \s-1DES\s0.
291 .Ip "\fB\s-1PBE-SHA1\-RC4\-128\s0 \s-1PBE-SHA1\-RC4\-40\s0 \s-1PBE-SHA1\-3DES\s0 \s-1PBE-SHA1\-2DES\s0 \s-1PBE-SHA1\-RC2\-128\s0 \s-1PBE-SHA1\-RC2\-40\s0\fR" 4
292 .IX Item "PBE-SHA1-RC4-128 PBE-SHA1-RC4-40 PBE-SHA1-3DES PBE-SHA1-2DES PBE-SHA1-RC2-128 PBE-SHA1-RC2-40"
293 These algorithms use the PKCS#12 password based encryption algorithm and
294 allow strong encryption algorithms like triple \s-1DES\s0 or 128 bit \s-1RC2\s0 to be used.
295 .SH "EXAMPLES"
296 .IX Header "EXAMPLES"
297 Convert a private from traditional to PKCS#5 v2.0 format using triple
298 \&\s-1DES:\s0
299 .PP
300 .Vb 1
301 \& openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem
302 .Ve
303 Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm
304 (\s-1DES\s0):
305 .PP
306 .Vb 1
307 \& openssl pkcs8 -in key.pem -topk8 -out enckey.pem
308 .Ve
309 Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm
310 (3DES):
311 .PP
312 .Vb 1
313 \& openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES
314 .Ve
315 Read a \s-1DER\s0 unencrypted PKCS#8 format private key:
316 .PP
317 .Vb 1
318 \& openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem
319 .Ve
320 Convert a private key from any PKCS#8 format to traditional format:
321 .PP
322 .Vb 1
323 \& openssl pkcs8 -in pk8.pem -out key.pem
324 .Ve
325 .SH "STANDARDS"
326 .IX Header "STANDARDS"
327 Test vectors from this PKCS#5 v2.0 implementation were posted to the
328 pkcs-tng mailing list using triple \s-1DES\s0, \s-1DES\s0 and \s-1RC2\s0 with high iteration
329 counts, several people confirmed that they could decrypt the private
330 keys produced and Therefore it can be assumed that the PKCS#5 v2.0
331 implementation is reasonably accurate at least as far as these
332 algorithms are concerned.
333 .PP
334 The format of PKCS#8 \s-1DSA\s0 (and other) private keys is not well documented:
335 it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default \s-1DSA\s0
336 PKCS#8 private key format complies with this standard.
337 .SH "BUGS"
338 .IX Header "BUGS"
339 There should be an option that prints out the encryption algorithm
340 in use and other details such as the iteration count.
341 .PP
342 PKCS#8 using triple \s-1DES\s0 and PKCS#5 v2.0 should be the default private
343 key format for OpenSSL: for compatibility several of the utilities use
344 the old format at present.
345 .SH "SEE ALSO"
346 .IX Header "SEE ALSO"
347 dsa(1), rsa(1), genrsa(1),
348 gendsa(1)