From fed8576103bd3d0b6c19bda948be7678dafbc173 Mon Sep 17 00:00:00 2001 From: jmc Date: Tue, 23 Aug 2016 18:54:04 +0000 Subject: [PATCH] shorten pkcs12; --- usr.bin/openssl/openssl.1 | 229 +++++++------------------------------- 1 file changed, 42 insertions(+), 187 deletions(-) diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1 index c50dc37f687..fa5d9d641b3 100644 --- a/usr.bin/openssl/openssl.1 +++ b/usr.bin/openssl/openssl.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: openssl.1,v 1.58 2016/08/22 13:39:52 jmc Exp $ +.\" $OpenBSD: openssl.1,v 1.59 2016/08/23 18:54:04 jmc Exp $ .\" ==================================================================== .\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. .\" @@ -112,7 +112,7 @@ .\" .\" OPENSSL .\" -.Dd $Mdocdate: August 22 2016 $ +.Dd $Mdocdate: August 23 2016 $ .Dt OPENSSL 1 .Os .Sh NAME @@ -2657,17 +2657,10 @@ is the encryption algorithm to use; valid values include des, des3, and rc2. It is recommended that des3 is used. .El -.\" -.\" PKCS12 -.\" .Sh PKCS12 .nr nS 1 .Nm "openssl pkcs12" -.Bk -words -.Oo -.Fl aes128 | aes192 | aes256 | -.Fl des | des3 -.Oc +.Op Fl aes128 | aes192 | aes256 | des | des3 .Op Fl cacerts .Op Fl CAfile Ar file .Op Fl caname Ar name @@ -2700,7 +2693,6 @@ It is recommended that des3 is used. .Op Fl passin Ar arg .Op Fl passout Ar arg .Op Fl twopass -.Ek .nr nS 0 .Pp The @@ -2708,24 +2700,16 @@ The command allows PKCS#12 files .Pq sometimes referred to as PFX files to be created and parsed. -PKCS#12 files are used by several programs including Netscape, MSIE -and MS Outlook. -.Pp -There are a lot of options; the meaning of some depends on whether a -PKCS#12 file is being created or parsed. By default, a PKCS#12 file is parsed; a PKCS#12 file can be created by using the .Fl export -option -.Pq see below . -.Sh PKCS12 PARSING OPTIONS +option. +.Pp +The options for parsing a PKCS12 file are as follows: .Bl -tag -width "XXXX" -.It Xo -.Fl aes128 | aes192 | aes256 | -.Fl des | des3 -.Xc -Use AES, DES, or triple DES, respectively, -to encrypt private keys before outputting. +.It Fl aes128 | aes192 | aes256 | des | des3 +Encrypt private keys +using AES, DES, or triple DES, respectively. The default is triple DES. .It Fl cacerts Only output CA certificates @@ -2734,29 +2718,25 @@ Only output CA certificates Only output client certificates .Pq not CA certificates . .It Fl in Ar file -This specifies the -.Ar file -of the PKCS#12 file to be parsed. -Standard input is used by default. +The input file to read from, +or standard input if not specified. .It Fl info Output additional information about the PKCS#12 file structure, algorithms used, and iteration counts. .It Fl nocerts -No certificates at all will be output. +Do not output certificates. .It Fl nodes -Don't encrypt the private keys at all. +Do not encrypt private keys. .It Fl nokeys -No private keys will be output. +Do not output private keys. .It Fl nomacver -Don't attempt to verify the integrity MAC before reading the file. +Do not attempt to verify the integrity MAC before reading the file. .It Fl noout -This option inhibits output of the keys and certificates to the output file +Do not output the keys and certificates to the output file version of the PKCS#12 file. .It Fl out Ar file -The -.Ar file -to write certificates and private keys to, standard output by default. -They are all written in PEM format. +The output file to write to, +or standard output if not specified. .It Fl passin Ar arg The key password source. .It Fl passout Ar arg @@ -2766,32 +2746,29 @@ Prompt for separate integrity and encryption passwords: most software always assumes these are the same so this option will render such PKCS#12 files unreadable. .El -.Sh PKCS12 FILE CREATION OPTIONS +.Pp +The options for PKCS12 file creation are as follows: .Bl -tag -width "XXXX" .It Fl CAfile Ar file CA storage as a file. .It Fl CApath Ar directory CA storage as a directory. -This directory must be a standard certificate directory: +The directory must be a standard certificate directory: that is, a hash of each subject name (using -.Cm x509 -hash ) +.Nm x509 Fl hash ) should be linked to each certificate. .It Fl caname Ar name -This specifies the +Specify the .Qq friendly name for other certificates. -This option may be used multiple times to specify names for all certificates +May be used multiple times to specify names for all certificates in the order they appear. -Netscape ignores friendly names on other certificates, -whereas MSIE displays them. .It Fl certfile Ar file A file to read additional certificates from. .It Fl certpbe Ar alg , Fl keypbe Ar alg -These options allow the algorithm used to encrypt the private key and +Specify the algorithm used to encrypt the private key and certificates to be selected. -Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used (see the -.Sx PKCS12 NOTES -section for more information). +Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used. If a cipher name (as output by the .Cm list-cipher-algorithms @@ -2799,8 +2776,7 @@ command) is specified then it is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only use PKCS#12 algorithms. .It Fl chain -If this option is present, an attempt is made to include the entire -certificate chain of the user certificate. +Include the entire certificate chain of the user certificate. The standard CA store is used for this search. If the search fails, it is considered a fatal error. .It Fl CSP Ar name @@ -2815,23 +2791,20 @@ software. By default, the private key is encrypted using triple DES and the certificate using 40-bit RC2. .It Fl export -This option specifies that a PKCS#12 file will be created rather than -parsed. +Create a PKCS#12 file (rather than parsing one). .It Fl in Ar file -The -.Ar file -to read certificates and private keys from, standard input by default. -They must all be in PEM format. +The input file to read from, +or standard input if not specified, +in PEM format. The order doesn't matter but one private key and its corresponding certificate should be present. If additional certificates are present, they will also be included in the PKCS#12 file. .It Fl inkey Ar file -File to read private key from. +File to read a private key from. If not present, a private key must be present in the input file. .It Fl keyex | keysig -Specifies that the private key is to be used for key exchange or just signing. -This option is only interpreted by MSIE and similar MS software. +Specify whether the private key is to be used for key exchange or just signing. Normally, .Qq export grade software will only allow 512-bit RSA keys to be @@ -2841,24 +2814,23 @@ The option marks the key for signing only. Signing only keys can be used for S/MIME signing, authenticode .Pq ActiveX control signing -and SSL client authentication; -however, due to a bug only MSIE 5.0 and later support -the use of signing only keys for SSL client authentication. +and SSL client authentication. .It Fl macalg Ar alg Specify the MAC digest algorithm. -If not included then SHA1 is used. +The default is SHA1. .It Fl maciter -This option is included for compatibility with previous versions; it used -to be needed to use MAC iterations counts but they are now used by default. +Included for compatability only: +it used to be needed to use MAC iterations counts +but they are now used by default. .It Fl name Ar name -This specifies the +Specify the .Qq friendly name for the certificate and private key. This name is typically displayed in list boxes by software importing the file. .It Fl nomac Don't attempt to provide the MAC integrity. .It Fl nomaciter , noiter -These options affect the iteration counts on the MAC and key algorithms. +Affect the iteration counts on the MAC and key algorithms. Unless you wish to produce files compatible with MSIE 4.0, you should leave these options alone. .Pp @@ -2877,130 +2849,13 @@ MSIE 4.0 doesn't support MAC iteration counts, so it needs the .Fl nomaciter option. .It Fl out Ar file -This specifies -.Ar file -to write the PKCS#12 file to. -Standard output is used by default. +The output file to write to, +or standard output if not specified. .It Fl passin Ar arg The key password source. .It Fl passout Ar arg The output file password source. .El -.Sh PKCS12 NOTES -Although there are a large number of options, -most of them are very rarely used. -For PKCS#12 file parsing, only -.Fl in -and -.Fl out -need to be used for PKCS#12 file creation. -.Fl export -and -.Fl name -are also used. -.Pp -If none of the -.Fl clcerts , cacerts , -or -.Fl nocerts -options are present, then all certificates will be output in the order -they appear in the input PKCS#12 files. -There is no guarantee that the first certificate present is -the one corresponding to the private key. -Certain software which requires a private key and certificate and assumes -the first certificate in the file is the one corresponding to the private key: -this may not always be the case. -Using the -.Fl clcerts -option will solve this problem by only outputting the certificate -corresponding to the private key. -If the CA certificates are required, they can be output to a separate -file using the -.Fl nokeys -and -.Fl cacerts -options to just output CA certificates. -.Pp -The -.Fl keypbe -and -.Fl certpbe -algorithms allow the precise encryption algorithms for private keys -and certificates to be specified. -Normally, the defaults are fine but occasionally software can't handle -triple DES encrypted private keys; -then the option -.Fl keypbe Ar PBE-SHA1-RC2-40 -can be used to reduce the private key encryption to 40-bit RC2. -A complete description of all algorithms is contained in the -.Sx PKCS8 -section above. -.Sh PKCS12 EXAMPLES -Parse a PKCS#12 file and output it to a file: -.Pp -.Dl $ openssl pkcs12 -in file.p12 -out file.pem -.Pp -Output only client certificates to a file: -.Pp -.Dl $ openssl pkcs12 -in file.p12 -clcerts -out file.pem -.Pp -Don't encrypt the private key: -.Pp -.Dl $ openssl pkcs12 -in file.p12 -out file.pem -nodes -.Pp -Print some info about a PKCS#12 file: -.Pp -.Dl $ openssl pkcs12 -in file.p12 -info -noout -.Pp -Create a PKCS#12 file: -.Bd -literal -offset indent -$ openssl pkcs12 -export -in file.pem -out file.p12 \e - -name "My Certificate" -.Ed -.Pp -Include some extra certificates: -.Bd -literal -offset indent -$ openssl pkcs12 -export -in file.pem -out file.p12 \e - -name "My Certificate" -certfile othercerts.pem -.Ed -.Sh PKCS12 BUGS -Some would argue that the PKCS#12 standard is one big bug :\-) -.Pp -Versions of -.Nm OpenSSL -before 0.9.6a had a bug in the PKCS#12 key generation routines. -Under rare circumstances this could produce a PKCS#12 file encrypted -with an invalid key. -As a result some PKCS#12 files which triggered this bug -from other implementations -.Pq MSIE or Netscape -could not be decrypted by -.Nm OpenSSL -and similarly -.Nm OpenSSL -could produce PKCS#12 files which could not be decrypted by other -implementations. -The chances of producing such a file are relatively small: less than 1 in 256. -.Pp -A side effect of fixing this bug is that any old invalidly encrypted PKCS#12 -files can no longer be parsed by the fixed version. -Under such circumstances the -.Nm pkcs12 -utility will report that the MAC is OK but fail with a decryption -error when extracting private keys. -.Pp -This problem can be resolved by extracting the private keys and certificates -from the PKCS#12 file using an older version of -.Nm OpenSSL -and recreating -the PKCS#12 file from the keys and certificates using a newer version of -.Nm OpenSSL . -For example: -.Bd -literal -offset indent -$ old-openssl -in bad.p12 -out keycerts.pem -$ openssl -in keycerts.pem -export -name "My PKCS#12 file" \e - -out fixed.p12 -.Ed .\" .\" PKEY .\" -- 2.20.1