Skip to content

Instantly share code, notes, and snippets.

@snoj
Last active September 2, 2016 15:49
Show Gist options
  • Save snoj/4668f45c10afbf1cda5671b3e6e94c16 to your computer and use it in GitHub Desktop.
Save snoj/4668f45c10afbf1cda5671b3e6e94c16 to your computer and use it in GitHub Desktop.
cer/key to pfx
<?php
//package up pem encoded certificate and key into a pfx (PKCS #12) file with your handy-dandy already installed php.exe.
$outpfx = "./out.pfx";
$cert = openssl_x509_read(file_get_contents("./domain.cer"));
$privatekey = file_get_contents("./domain.key");
$passphase = "somepass";
openssl_pkcs12_export_to_file($cert, $outpfx, $privatekey, $passphrase);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment