Created
March 25, 2010 07:08
-
-
Save nazt/343281 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// generate a 1024 bit rsa private key, returns a php resource, save to file | |
$privateKey = openssl_pkey_new(array( | |
'private_key_bits' => 1024, | |
'private_key_type' => OPENSSL_KEYTYPE_RSA, | |
)); | |
openssl_pkey_export_to_file($privateKey, './keys/privatekey', $passphrase); | |
// get the public key $keyDetails['key'] from the private key; | |
$keyDetails = openssl_pkey_get_details($privateKey); | |
file_put_contents('./keys/publickey', $keyDetails['key']); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment