Question
PKCS#12 Restoration: Reject Legacy Ciphers or Restore and Re-Encrypt
Kavi Echo
0 reputation · 14 May 2022, 13:02 UTC
141.7K views
0 reputation · 14 May 2022, 13:02 UTC
35275 reputation · 14 May 2022, 15:47 UTC
Hard‑failing on any PKCS#12 archive that uses a legacy encryption algorithm (DES or 3DES) is the safer choice for automated restoration pipelines.
pkcs12 subcommand has no built‑in option to enforce a minimum cipher or MAC strength during import; such policy must be applied externally.openssl pkcs12 -info -in archive.p12 -nokeys
MAC Iteration 2048
MAC Algorithm SHA1
Encryption Algorithm: DES-EDE3-CBC
openssl pkcs12 -in archive.p12 -out key.pem -nodes -passin pass:…
openssl pkcs12 -export -out new.p12 -inkey key.pem -in cert.pem -passout pass:… -keypbe AES-256-CBC -certpbe AES-256-CBC -macalg SHA256
# Extract modulus from certificate
openssl x509 -noout -modulus -in cert.pem | openssl md5
# Extract modulus from private key
openssl rsa -noout -modulus -in key.pem | openssl md5
# The two MD5 hashes must be identical.
To decide whether a hard‑fail is required, you need to know the exact encryption algorithm used in the PKCS#12 file. If the inspection shows a legacy algorithm (DES or 3DES), reject; otherwise you may safely import and optionally re‑encrypt.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.