A .cer file typically contains only the public certificate, not the private key. If the private key was part of a .pfx or .pem bundle, use:

bash

openssl pkcs12 -in certificate.pfx -nocerts -out private.key

⚠️ You cannot extract a private key from a .cer if it wasn’t bundled with it.