Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //CREATE DO KEYPAIR
- // Create the keypair
- $config = array(
- "digest_alg" => "sha512",
- "private_key_bits" => 4096,
- "private_key_type" => OPENSSL_KEYTYPE_RSA,
- );
- // Create the private and public key
- $res = openssl_pkey_new($config);
- // Extract the private key from $res to $privKey
- openssl_pkey_export($res, $privKey);
- $pubKey = openssl_pkey_get_details($res);
- echo $pubKey["key"];
- include('Crypt/RSA.php');
- $rsa = new Crypt_RSA();
- $rsa->loadKey($res);
- $privatekey = $rsa->getPrivateKey();
- $publickey = $rsa->getPublicKey();
- echo $publickey;
- $kp_uri = "https://api.digitalocean.com/ssh_keys/new/";
- $kp_post = "client_id=$clientID&api_key=$apiKey&name=$keyPairName&ssh_pub_key=$pubkey";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement