Created
September 26, 2019 09:12
-
-
Save AndreiTelteu/4b4b6843bbd15d50d3b0e91f98c18188 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
<?php | |
// install composer require phpseclib/phpseclib:~2.0 | |
// https://github.com/phpseclib/phpseclib | |
$rsa = new \phpseclib\Crypt\RSA(); | |
$rsa->setPassword($password); | |
$rsa->setPrivateKeyFormat(\phpseclib\Crypt\RSA::PUBLIC_FORMAT_OPENSSH); | |
$rsa->setPublicKeyFormat(\phpseclib\Crypt\RSA::PUBLIC_FORMAT_OPENSSH); | |
$rsa->setComment('robot@laravel.com'); | |
$keys = $rsa->createKey(4096); | |
$publicKey = $keys['publickey']; | |
$privateKey = $keys['privatekey']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment