Skip to content

Instantly share code, notes, and snippets.

@coelho
Created March 31, 2014 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coelho/9887580 to your computer and use it in GitHub Desktop.
Save coelho/9887580 to your computer and use it in GitHub Desktop.
Generate key pairs for Votifier
<?php
$keyPair = openssl_pkey_new(array('private_key_bits' => 2048));
// Private key
openssl_pkey_export($keyPair, $privateKey);
// Public key
$publicKey = openssl_pkey_get_details($keyPair);
$publicKey = $publicKey["key"];
file_put_contents("private.config.php", "<?php\r\n\r\n\$config[\"privateKey\"] = \"" . $privateKey . "\";");
file_put_contents("public.key", $publicKey);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment