• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

openssl pkcs12 legacy

June 5, 2023 by Mister PKI 1 Comment

With OpenSSL v3.x, newer cryptographic algorithms are used that may not be supported in older versions of Java, Windows, etc and will require the openssl pkcs12 legacy option.

The -legacy option is useful and even required when creating a pkcs12 keystore for use in older operating systems and Java versions. This article will primarily focus on the operating system example, and we will defer to keytool specific options when generating keystores to be used in older java versions in another article.

The legacy option loads the legacy provider in the system installed OpenSSL. The default algorithm for certificate encryption is either RC2_CBC or 3DES_CBC. The default algorithm for private key encryption is 3DES_CBC.

If the legacy option is not provided, then the default algorithm for certificate and private keys is AES_256_CBC with PBKDF2 for key derivation.

If you have generated a pkcs12 keystore (or pfx when working in Windows) and cannot import the certificate into your Windows certificate store because of an invalid password, it is likely because the version of Windows server or desktop you are using does not support the newer versions. Obviously you should first verify you are using the correct password, but if you are certain you are then it’s likely because the keystore was generated with OpenSSL 3. As of this writing from our experience, Windows Server 2019 or greater is required to use a keystore generated by OpenSSL v3.x.

openssl pkcs12 legacy examples

To print info about a pkcs12 keystore in legacy mode:

openssl pkcs12 -in example.p12 -info -noout -legacy

To create a pkcs12 keystore from an existing certificate and private key in legacy mode:

openssl pkcs12 -export -in cert.pem -inkey key.pem -out example.p12 -legacy

Conclusion

By using the legacy option in the openssl pkcs12 utility you can generate a keystore that can be imported into older versions of Windows certificate stores as well as older software that does not support newer cryptographic algorithms. Let us know in the comments if you have any questions or would like to see more examples of the legacy option in OpenSSL.

If working with older versions of Java, see our article on creating keystores with legacy cryptography in Java.

java,  openssl

Reader Interactions

Comments

  1. Michele Masè says

    November 5, 2024 at 2:43 pm

    #generic legacy sha1
    openssl pkcs12 -export -in cert.pem -inkey key.pem -out example.p12 -legacy
    #verbose legacy sha1 (windows2012 and others)
    openssl pkcs12 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -in cert.pem -inkey key.pem -out example.p12 -legacy
    #verbose legacy rc2 40 (windows2008 and others)
    openssl pkcs12 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-RC2-40 -export -in cert.pem -inkey key.pem -out example.p12 -legacy

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.