Oops. The pkcs8 man page wasn't finished: this is an updated version
[openssl.git] / doc / man / pkcs8.pod
1 =pod
2
3 =head1 NAME
4
5 pkcs8 - PKCS#8 format private key conversion tool
6
7 =head1 SYNOPSIS
8
9 B<openssl> B<pkcs8>
10 [B<-topk8>]
11 [B<-inform PEM|DER>]
12 [B<-outform PEM|DER>]
13 [B<-in filename>]
14 [B<-out filename>]
15 [B<-noiter>]
16 [B<-nocrypt>]
17 [B<-nooct>]
18 [B<-v2 alg>]
19
20 =head1 DESCRIPTION
21
22 The B<pkcs8> command processes private keys in PKCS#8 format. It can handle
23 both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo
24 format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
25
26 =head1 COMMAND OPTIONS
27
28 =over 4
29
30 =item B<-topk8>
31
32 Normally a PKCS#8 private key is expected on input and a traditional format
33 private key will be written. With the B<-topk8> option the situation is
34 reversed: it reads a traditional format private key and writes a PKCS#8
35 format key.
36
37 =item B<-inform DER|PEM>
38
39 This specifies the input format. If a PKCS#8 format key is expected on input
40 then either a B<DER> or B<PEM> encoded version of a PKCS#8 key will be
41 expected. Otherwise the B<DER> or B<PEM> format of the traditional format
42 private key is used.
43
44 =item B<-outform DER|PEM>
45
46 This specifies the output format, the options have the same meaning as the 
47 B<-inform> option.
48
49 =item B<-in filename>
50
51 This specifies the input filename to read a key from or standard input if this
52 option is not specified. If the key is encrypted a pass phrase will be
53 prompted for.
54
55 =item B<-out filename>
56
57 This specifies the output filename to write a key to or standard output by
58 default. If any encryption options are set then a pass phrase will be
59 prompted for. The output filename should B<not> be the same as the input
60 filename.
61
62 =item B<-nocrypt>
63
64 PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo
65 structures using an appropriate password based encryption algorithm. With
66 this option an unencrypted PrivateKeyInfo structure is expected or output.
67 This option does not encrypt private keys at all and should only be used
68 when absolutely necessary. Certain software such as some versions of Java
69 code signing software used unencrypted private keys.
70
71 =item B<-nooct>
72
73 This option generates private keys in a broken format that some software
74 uses. Specifically the private key should be enclosed in a OCTET STRING
75 but some software just includes the structure itself without the
76 surrounding OCTET STRING.
77
78 =item B<-v2 alg>
79
80 This option enables the use of PKCS#5 v2.0 algorithms. Normally PKCS#8
81 private keys are encrypted with the password based encryption algorithm
82 called B<pbeWithMD5AndDES-CBC> this uses 56 bit DES encryption but it
83 was the strongest encryption algorithm supported in PKCS#5 v1.5. Using 
84 the B<-v2> option PKCS#5 v2.0 algorithms are used which can use any
85 encryption algorithm such as 168 bit triple DES or 128 bit RC2 however
86 not many implementations support PKCS#5 v2.0 yet. If you are just using
87 private keys with OpenSSL then this doesn't matter.
88
89 The B<alg> argument is the encryption algorithm to use, valid values include
90 B<des>, B<des3> and B<rc2>. It is recommended that B<des3> is used.
91
92 =back
93
94 =head1 NOTES
95
96 Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration
97 counts are more secure that those encrypted using the traditional
98 SSLeay compatible formats. So if additional security is considered
99 important the keys should be converted.
100
101 The default encryption is only 56 bits because this is the encryption
102 that most current implementations of PKCS#8 will support.
103
104 Some software may use PKCS#12 password based encryption algorithms
105 with PKCS#8 format private keys: these are handled automatically
106 but there is no option to produce them.
107
108 It is possible to write out DER encoded encrypted private keys in
109 PKCS#8 format because the encryption details are included at an ASN1
110 level whereas the traditional format includes them at a PEM level.
111
112 =head1 EXAMPLES
113
114 Convert a private from traditional to PKCS#5 v2.0 format using triple
115 DES:
116
117  openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem
118
119 Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm
120 (DES):
121
122  openssl pkcs8 -in key.pem -topk8 -out enckey.pem
123
124 Read a DER unencrypted PKCS#8 format private key:
125
126  openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem
127
128 Convert a private key from any PKCS#8 format to traditional format:
129
130  openssl pkcs8 -in pk8.pem -out key.pem
131
132 =head1 STANDARDS
133
134 Test vectors from this implementation were posted to the pkcs-tng mailing
135 list using triple DES, DES and RC2 with high iteration counts, several
136 people confirmed that they could decrypt the private keys produced and
137 Therefore it can be assumed that the PKCS#5 v2.0 implementation is
138 reasonably accurate at least as far as these algorithms are concerned.
139
140 =head1 BUGS
141
142 It isn't possible to produce keys encrypted using PKCS#5 v1.5 algorithms
143 other than B<pbeWithMD5AndDES-CBC> using this utility.
144
145 There should be an option that prints out the encryption algorithm
146 in use and other details such as the iteration count.
147
148 PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private
149 key format for OpenSSL: for compatability several of the utilities use
150 the old format at present.
151
152 =head1 SEE ALSO
153
154 dsa(1), rsa(1), genrsa(1), gendsa(1)
155
156 =cut