Private keys are created and saved by default in a PKCS#8 encrypted format, protected by a password.
The default algorithm is "pbeWithSHAAnd3-KeyTripleDES-CBC" from PKCS#12.
To increase security use one of the stronger PBES2 encryption schemes from PKCS#5 v2 using the key derivation function PBKDF2:
des-EDE3-CBCaes128-CBCaes192-CBCaes256-CBC[Changed in v11.0] The above option values are a simplified alternative to PKI_PBE_PBES2+PKI_BC_AES128, etc.
The default pseudorandom function (PRF) for PBKDF2 is hmacWithSHA1.
To use a stronger HMAC function from the SHA-2 family in the PRF for PBKDF2, add one of the following options
hmacWithSHA224hmacWithSHA256hmacWithSHA384hmacWithSHA512For legacy applications, you can still use the old, less secure, PBES1 schemes using DES from PKCS#5 v1.5. These are definitely not recommended for new applications. Not available for ECC private keys.
[Changed in v11.0] note that the values for these flags have changed.
pbeWithMD5AndDES-CBC (legacy, not recommended)pbeWithMD2AndDES-CBC (legacy, not recommended)pbeWithSHA1AndDES-CBC (legacy, not recommended)Remember that the security of all these schemes is limited by the strength of the password used. Other applications may not support all the alternatives provided here.