Catch for RSA

This commit is contained in:
James Cole 2021-03-20 18:42:38 +01:00
parent b1023cdfda
commit e577db4635
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
2 changed files with 17 additions and 5 deletions

View File

@ -35,7 +35,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Laravel\Passport\Passport;
use Log;
use phpseclib\Crypt\RSA;
/**
* Class InstallController
@ -134,8 +133,15 @@ class InstallController extends Controller
*/
public function keys(): void
{
$rsa = new RSA();
$keys = $rsa->createKey(4096);
// switch on PHP version.
if (7 === PHP_MAJOR_VERSION) {
$rsa = new \phpseclib\Crypt\RSA;
$keys = $rsa->createKey(4096);
}
if (8 === PHP_MAJOR_VERSION) {
$keys = \phpseclib3\Crypt\RSA::createKeys(4096);
}
[$publicKey, $privateKey] = [
Passport::keyPath('oauth-public.key'),

View File

@ -30,7 +30,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User;
use Laravel\Passport\Passport;
use Log;
use phpseclib3\Crypt\RSA;
/**
* Trait CreateStuff
@ -104,7 +103,14 @@ trait CreateStuff
*/
protected function createOAuthKeys(): void // create stuff
{
$keys = RSA::createKey(4096);
// switch on PHP version.
if (7 === PHP_MAJOR_VERSION) {
$rsa = new \phpseclib\Crypt\RSA;
$keys = $rsa->createKey(4096);
}
if (8 === PHP_MAJOR_VERSION) {
$keys = \phpseclib3\Crypt\RSA::createKeys(4096);
}
[$publicKey, $privateKey] = [
Passport::keyPath('oauth-public.key'),