Integrate phpseclib into Laravel 5

妖精的绣舞 提交于 2019-12-04 14:23:10

PHPSec does use composer, you should be able to just composer require "phpseclib/phpseclib=~0.3.10" and have it available (autoloaded).

$rsa = new \Crypt_RSA();
madbob

Reworking this other answer and getting a look into the vendor/phpseclib/ folder, I've managed to get it working with this syntax:

use phpseclib\Crypt\RSA;
...
...
$rsa = new RSA();
$rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_OPENSSH);
extract($rsa->createKey());
echo "$publickey\r\n\r\n$privatekey";

At least, it works on phpseclib version ^2.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!