Format/name changes
This commit is contained in:
parent
90346f61ba
commit
9d9489494e
|
@ -73,7 +73,8 @@ class Crypto
|
|||
public static function meToPem($m, $e)
|
||||
{
|
||||
$rsa = new RSA();
|
||||
$rsa->loadKey([
|
||||
$rsa->loadKey(
|
||||
[
|
||||
'e' => new BigInteger($e, 256),
|
||||
'n' => new BigInteger($m, 256)
|
||||
]);
|
||||
|
@ -89,10 +90,10 @@ class Crypto
|
|||
*/
|
||||
public static function rsaToPem(string $key)
|
||||
{
|
||||
$publicKey = new RSA();
|
||||
$publicKey->setPublicKey($key);
|
||||
$rsa = new RSA();
|
||||
$rsa->setPublicKey($key);
|
||||
|
||||
return $publicKey->getPublicKey(RSA::PUBLIC_FORMAT_PKCS8);
|
||||
return $rsa->getPublicKey(RSA::PUBLIC_FORMAT_PKCS8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,12 +107,12 @@ class Crypto
|
|||
*/
|
||||
public static function pemToMe(string $key, &$modulus, &$exponent)
|
||||
{
|
||||
$publicKey = new RSA();
|
||||
$publicKey->loadKey($key);
|
||||
$publicKey->setPublicKey();
|
||||
$rsa = new RSA();
|
||||
$rsa->loadKey($key);
|
||||
$rsa->setPublicKey();
|
||||
|
||||
$modulus = $publicKey->modulus->toBytes();
|
||||
$exponent = $publicKey->exponent->toBytes();
|
||||
$modulus = $rsa->modulus->toBytes();
|
||||
$exponent = $rsa->exponent->toBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,7 +90,8 @@ class CryptoTest extends TestCase
|
|||
Crypto::pemToMe($key, $m, $e);
|
||||
|
||||
$expectedRSA = new RSA();
|
||||
$expectedRSA->loadKey([
|
||||
$expectedRSA->loadKey(
|
||||
[
|
||||
'e' => new BigInteger($e, 256),
|
||||
'n' => new BigInteger($m, 256)
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue