Using the PKCS #12 Tool (pk12util)
Newsgroup: mozilla.dev.tech.cryptoThe PKCS #12 utility makes sharing of certificates among Enterprise server 3.x and any server (Netscape products or non-Netscape products) that supports PKCS#12 possible. The tool allows you to import certificates and keys from pkcs #12 files into NSS or export them and also list certificates and keys in such files.
Availability
See the release notes for the platforms this tool is available on.Synopsis
pk12util-i p12File [-h tokenname] [-v] [common-options]
or
pk12util
-o p12File -n certname [-c keyCipher]
[-C certCipher] [-m | --key_len keyLen] [-n | --cert_key_len certKeyLen] [common-options]
or
pk12util
-l p12File [-h tokenname] [-r] [common-options]
where
[common-options] =
[-d dir] [-P dbprefix]
[-k slotPasswordFile | -K slotPassword] [-w p12filePasswordFile | -W p12filePassword]
Syntax
To run the PKCS #12 Tool, type ther commandpk12util
option [
arguments]
where option and arguments are
combinations of the options and arguments listed in the following
section. Three of the options, -i, -o, and -l, should be considered commands
of the pk12util invocation. Each command takes several options. Options may take zero or
more arguments. To see a usage string, issue the pkcs12util command without any
options.
Options and Arguments
Options specify an action. Option arguments modify an action. The options and arguments for thepk12util
command are defined as follows:Options | |
Import a certificate and private key from from the p12file into the database. | |
Export certificate and private key, specified by the -n option, from the database to the p12 file. | |
List certificate and private key from from the | |
Specify the prefix used on the | |
Specify the text file containing the pkcs 12 file's password | |
Specify the desired length of the symmetric key to be used to encrypt the private key | |
Password Based Encryption
PKCS #12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. Password based encryption is used to protect private keys on export to a PKCS #12 file and also the entire package when allowed. If no algorithm is specified, the tool defaults to using "PKCS12 V2 PBE With SHA1 And 3KEY Triple DES-cbc" for private key encryption. For historical export control reasons "PKCS12 V2 PBE With SHA1 And 40 Bit RC4" is the default for the overall package encryption when not in FIPS mode and no package encryption when in FIPS mode. The private key is always protected with strong encryption by default. A list of ciphers follows.
- symmetric CBC ciphers for PKCS #5 V2:
- "DES_CBC"
- "RC2-CBC"
- "RC5-CBCPad"
- "DES-EDE3-CBC"
--- default for key encryption - "AES-128-CBC"
- "AES-192-CBC"
- "AES-256-CBC"
- "CAMELLIA-128-CBC"
- "CAMELLIA-192-CBC"
- "CAMELLIA-256-CBC"
- PKCS #12 PBE Ciphers:
- "PKCS #12 PBE With Sha1 and 128 Bit RC4"
- "PKCS #12 PBE With Sha1 and 40 Bit RC4"
- "PKCS #12 PBE With Sha1 and Triple DES CBC"
- "PKCS #12 PBE With Sha1 and 128 Bit RC2 CBC"
- "PKCS #12 PBE With Sha1 and 40 Bit RC2 CBC"
- "PKCS12 V2 PBE With SHA1 And 128 Bit RC4"
- "PKCS12 V2 PBE With SHA1 And 40 Bit RC4"
--- default for PFX encryption in non-fips mode, no encryption on fips mode - "PKCS12 V2 PBE With SHA1 And 3KEY Triple DES-cbc"
- "PKCS12 V2 PBE With SHA1 And 2KEY Triple DES-cbc"
- "PKCS12 V2 PBE With SHA1 And 128 Bit RC2 CBC"
- "PKCS12 V2 PBE With SHA1 And 40 Bit RC2 CBC"
- PKCS #5 PBE Ciphers:
- "PKCS #5 Password Based Encryption with MD2 and DES CBC"
- "PKCS #5 Password Based Encryption with MD5 and DES CBC"
- "PKCS #5 Password Based Encryption with SHA1 and DES CBC"
It should be noted that the the crypto provider may be the softtoken module or an external hardware module. It may be the case that the cryptographic module does not support the requested algorithm and a best fit will be selected, likely to be the default. If no suitable replacement for the desired algorithm can be found a "no security module can perform the requested operation" will appear on the error message.