Ssl pkcs12

ssl_p12_to_pem

Convert a PKCS#12 (.p12 / .pfx) bundle to PEM. Extracts private key, certificate, and any chain certificates unencrypted (-nodes). openssl will prompt for the import password interactively.

Arguments

  • $1 (string): Input .p12 / .pfx file
  • $2 (string): Output PEM file (default: input basename with .pem extension)

Exit codes

  • 0: Success
  • 1: No input, empty file, or openssl error

ssl_pem_to_p12

Bundle a private key, certificate, and CA chain into a PKCS#12 (.p12) file. openssl will prompt for an export password interactively.

Arguments

  • $1 (string): Private key file
  • $2 (string): Certificate file
  • $3 (string): CA chain file
  • $4 (string): Output .p12 file

Exit codes

  • 0: Success
  • 1: Missing arguments, empty input files, or openssl error