mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-27 09:08:24 +00:00
Php 7.1
This commit is contained in:
parent
e210166f43
commit
7154fd98d2
@ -1712,11 +1712,6 @@
|
||||
<ImplicitToStringCast occurrences="1">
|
||||
<code>string</code>
|
||||
</ImplicitToStringCast>
|
||||
<InvalidParamDefault occurrences="3">
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</InvalidParamDefault>
|
||||
<MissingReturnType occurrences="1">
|
||||
<code>validatePlugin</code>
|
||||
</MissingReturnType>
|
||||
@ -1934,11 +1929,9 @@
|
||||
<MixedAssignment occurrences="1">
|
||||
<code>$encryptionAlgorithm</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyFalseArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<PossiblyNullArgument occurrences="2">
|
||||
<code>$key</code>
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="6">
|
||||
<code>$matches[1]</code>
|
||||
@ -2411,10 +2404,9 @@
|
||||
<MissingParamType occurrences="1">
|
||||
<code>$message</code>
|
||||
</MissingParamType>
|
||||
<MissingReturnType occurrences="3">
|
||||
<MissingReturnType occurrences="2">
|
||||
<code>getPublicKey</code>
|
||||
<code>sign</code>
|
||||
<code>withPassword</code>
|
||||
</MissingReturnType>
|
||||
</file>
|
||||
<file src="../phpseclib/Crypt/Common/PublicKey.php">
|
||||
@ -2878,11 +2870,6 @@
|
||||
<code>$key === false</code>
|
||||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="../phpseclib/Crypt/Common/Traits/PasswordProtected.php">
|
||||
<MissingReturnType occurrences="1">
|
||||
<code>withPassword</code>
|
||||
</MissingReturnType>
|
||||
</file>
|
||||
<file src="../phpseclib/Crypt/DES.php">
|
||||
<InvalidPropertyAssignmentValue occurrences="2">
|
||||
<code>8</code>
|
||||
@ -3196,9 +3183,6 @@
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$args[0]</code>
|
||||
</InvalidArgument>
|
||||
<InvalidParamDefault occurrences="1">
|
||||
<code>string</code>
|
||||
</InvalidParamDefault>
|
||||
<MissingParamType occurrences="1">
|
||||
<code>$args</code>
|
||||
</MissingParamType>
|
||||
@ -3277,6 +3261,9 @@
|
||||
<MixedPropertyFetch occurrences="1">
|
||||
<code>$key[$type . 'Algorithm']['parameters']->element</code>
|
||||
</MixedPropertyFetch>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayAccess occurrences="2">
|
||||
<code>$decoded[0]</code>
|
||||
<code>$decoded[0]</code>
|
||||
@ -3468,6 +3455,9 @@
|
||||
<MixedOperand occurrences="1">
|
||||
<code>$comment</code>
|
||||
</MixedOperand>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedStringArrayOffset occurrences="4">
|
||||
<code>$parsed['comment']</code>
|
||||
<code>$parsed['publicKey']</code>
|
||||
@ -3517,6 +3507,9 @@
|
||||
<MixedPropertyFetch occurrences="1">
|
||||
<code>$key[$type . 'Algorithm']['parameters']->element</code>
|
||||
</MixedPropertyFetch>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="2">
|
||||
<code>$decoded[0]</code>
|
||||
<code>$decoded[0]</code>
|
||||
@ -3544,9 +3537,6 @@
|
||||
<code>$y</code>
|
||||
<code>$y</code>
|
||||
</ImplicitToStringCast>
|
||||
<InvalidParamDefault occurrences="1">
|
||||
<code>string</code>
|
||||
</InvalidParamDefault>
|
||||
<MixedArrayAccess occurrences="1">
|
||||
<code>$components['public']</code>
|
||||
</MixedArrayAccess>
|
||||
@ -3554,6 +3544,9 @@
|
||||
<code>$private</code>
|
||||
<code>$public</code>
|
||||
</NullReference>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<UnusedClass occurrences="1">
|
||||
<code>PuTTY</code>
|
||||
</UnusedClass>
|
||||
@ -6074,10 +6067,10 @@
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="1">
|
||||
<code>$publicKey[0]</code>
|
||||
</PossiblyUndefinedIntArrayOffset>
|
||||
<RedundantConditionGivenDocblockType occurrences="2">
|
||||
<RedundantCondition occurrences="2">
|
||||
<code>!empty($password) && is_string($password)</code>
|
||||
<code>is_string($password)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</RedundantCondition>
|
||||
<UndefinedMethod occurrences="1">
|
||||
<code>toBytes</code>
|
||||
</UndefinedMethod>
|
||||
@ -6199,6 +6192,9 @@
|
||||
<code>$decoded</code>
|
||||
<code>$key</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="7">
|
||||
<code>$decoded[0]</code>
|
||||
<code>$decoded[0]</code>
|
||||
@ -6273,8 +6269,10 @@
|
||||
<PossiblyInvalidArrayOffset occurrences="1">
|
||||
<code>$key['privateKey']</code>
|
||||
</PossiblyInvalidArrayOffset>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<PossiblyNullArgument occurrences="3">
|
||||
<code>$key['privateKey']</code>
|
||||
<code>$password</code>
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayAccess occurrences="1">
|
||||
<code>$key['privateKey']</code>
|
||||
@ -6326,9 +6324,6 @@
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$publicKey</code>
|
||||
</InvalidArgument>
|
||||
<InvalidParamDefault occurrences="1">
|
||||
<code>string</code>
|
||||
</InvalidParamDefault>
|
||||
<MixedArgument occurrences="7">
|
||||
<code>$components['type']</code>
|
||||
<code>$length</code>
|
||||
@ -6354,6 +6349,9 @@
|
||||
<code>$length</code>
|
||||
<code>$length</code>
|
||||
</PossiblyInvalidArrayAccess>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="2">
|
||||
<code>$public[1]</code>
|
||||
<code>$public[1]</code>
|
||||
@ -6591,9 +6589,11 @@
|
||||
<PossiblyUnusedParam occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyUnusedParam>
|
||||
<RedundantConditionGivenDocblockType occurrences="3">
|
||||
<RedundantCondition occurrences="2">
|
||||
<code>!empty($password) && is_string($password)</code>
|
||||
<code>is_string($password)</code>
|
||||
</RedundantCondition>
|
||||
<RedundantConditionGivenDocblockType occurrences="1">
|
||||
<code>isset($public)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
@ -6688,7 +6688,7 @@
|
||||
<code>getPublicKey</code>
|
||||
<code>sign</code>
|
||||
</MissingReturnType>
|
||||
<MixedArgument occurrences="10">
|
||||
<MixedArgument occurrences="9">
|
||||
<code>$curve::HASH</code>
|
||||
<code>$curve::SIZE</code>
|
||||
<code>$curve::SIZE</code>
|
||||
@ -6698,7 +6698,6 @@
|
||||
<code>$this->curve->getBasePoint()</code>
|
||||
<code>$this->dA->secret</code>
|
||||
<code>$this->dA->toBytes()</code>
|
||||
<code>$this->withPassword()->toString('libsodium')</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess occurrences="1">
|
||||
<code>$r</code>
|
||||
@ -6719,7 +6718,7 @@
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedMethodCall occurrences="16">
|
||||
<MixedMethodCall occurrences="15">
|
||||
<code>$format::save($r, $s)</code>
|
||||
<code>$format::save($r, $s)</code>
|
||||
<code>$format::save($r, $s, $this->getCurve())</code>
|
||||
@ -6734,7 +6733,6 @@
|
||||
<code>toBytes</code>
|
||||
<code>toBytes</code>
|
||||
<code>toBytes</code>
|
||||
<code>toString</code>
|
||||
<code>withContext</code>
|
||||
</MixedMethodCall>
|
||||
<MixedOperand occurrences="6">
|
||||
@ -7452,10 +7450,6 @@
|
||||
</UnusedVariable>
|
||||
</file>
|
||||
<file src="../phpseclib/Crypt/PublicKeyLoader.php">
|
||||
<InvalidParamDefault occurrences="2">
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</InvalidParamDefault>
|
||||
<MixedAssignment occurrences="1">
|
||||
<code>$key</code>
|
||||
</MixedAssignment>
|
||||
@ -7949,10 +7943,10 @@
|
||||
<code>$primes[1]</code>
|
||||
<code>$primes[2]</code>
|
||||
</PossiblyUndefinedIntArrayOffset>
|
||||
<RedundantConditionGivenDocblockType occurrences="2">
|
||||
<RedundantCondition occurrences="2">
|
||||
<code>!empty($password) && is_string($password)</code>
|
||||
<code>is_string($password)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</RedundantCondition>
|
||||
<TypeDoesNotContainType occurrences="1">
|
||||
<code>is_string($key)</code>
|
||||
</TypeDoesNotContainType>
|
||||
@ -7991,6 +7985,9 @@
|
||||
<MixedOperand occurrences="1">
|
||||
<code>$comment</code>
|
||||
</MixedOperand>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="3">
|
||||
<code>$coefficients[2]</code>
|
||||
<code>$primes[1]</code>
|
||||
@ -8010,6 +8007,10 @@
|
||||
</PossiblyUnusedProperty>
|
||||
</file>
|
||||
<file src="../phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php">
|
||||
<MismatchingDocblockParamType occurrences="2">
|
||||
<code>string|false</code>
|
||||
<code>string|false</code>
|
||||
</MismatchingDocblockParamType>
|
||||
<MixedArgument occurrences="2">
|
||||
<code>$decoded[0]</code>
|
||||
<code>$decoded[0]</code>
|
||||
@ -8030,9 +8031,15 @@
|
||||
<code>$components['primes'][]</code>
|
||||
<code>$primeInfo</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyFalseArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyInvalidArgument occurrences="1">
|
||||
<code>$key</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="6">
|
||||
<code>$coefficients[2]</code>
|
||||
<code>$decoded[0]</code>
|
||||
@ -8061,6 +8068,9 @@
|
||||
<MixedAssignment occurrences="1">
|
||||
<code>$result['meta']</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUnusedMethod occurrences="1">
|
||||
<code>savePrivateKey</code>
|
||||
</PossiblyUnusedMethod>
|
||||
@ -8125,11 +8135,12 @@
|
||||
<PossiblyInvalidMethodCall occurrences="1">
|
||||
<code>toString</code>
|
||||
</PossiblyInvalidMethodCall>
|
||||
<PossiblyNullArgument occurrences="4">
|
||||
<PossiblyNullArgument occurrences="5">
|
||||
<code>$decoded[0]</code>
|
||||
<code>$decoded[0]</code>
|
||||
<code>$params['hashAlgorithm']['algorithm']</code>
|
||||
<code>$params['maskGenAlgorithm']['parameters']['algorithm']</code>
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayAccess occurrences="4">
|
||||
<code>$decoded[0]</code>
|
||||
@ -8211,6 +8222,9 @@
|
||||
<code>$private</code>
|
||||
<code>$public</code>
|
||||
</NullReference>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$password</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyUndefinedIntArrayOffset occurrences="3">
|
||||
<code>$coefficients[2]</code>
|
||||
<code>$primes[1]</code>
|
||||
@ -8263,10 +8277,10 @@
|
||||
<code>subtract</code>
|
||||
<code>subtract</code>
|
||||
</MixedMethodCall>
|
||||
<RedundantConditionGivenDocblockType occurrences="2">
|
||||
<RedundantCondition occurrences="2">
|
||||
<code>!empty($password) && is_string($password)</code>
|
||||
<code>is_string($password)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</RedundantCondition>
|
||||
<UnusedClass occurrences="1">
|
||||
<code>Raw</code>
|
||||
</UnusedClass>
|
||||
@ -10616,7 +10630,7 @@
|
||||
<code>signSPKAC</code>
|
||||
<code>translateDNProp</code>
|
||||
</MissingReturnType>
|
||||
<MixedArgument occurrences="131">
|
||||
<MixedArgument occurrences="130">
|
||||
<code>$attribute['value']</code>
|
||||
<code>$attribute['value']</code>
|
||||
<code>$attribute['value']</code>
|
||||
@ -10667,7 +10681,6 @@
|
||||
<code>$ipAddress</code>
|
||||
<code>$ip[0]</code>
|
||||
<code>$ip[1]</code>
|
||||
<code>$issuer->privateKey->withPassword()->toString('PSS')</code>
|
||||
<code>$key</code>
|
||||
<code>$key</code>
|
||||
<code>$key</code>
|
||||
@ -11072,7 +11085,7 @@
|
||||
<code>array|false</code>
|
||||
<code>bool</code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedMethodCall occurrences="8">
|
||||
<MixedMethodCall occurrences="7">
|
||||
<code>__toString</code>
|
||||
<code>add</code>
|
||||
<code>equals</code>
|
||||
@ -11080,7 +11093,6 @@
|
||||
<code>getPublicKey</code>
|
||||
<code>toBytes</code>
|
||||
<code>toString</code>
|
||||
<code>toString</code>
|
||||
</MixedMethodCall>
|
||||
<MixedOperand occurrences="5">
|
||||
<code>$issuer->privateKey->sign($this->signatureSubject)</code>
|
||||
@ -16577,8 +16589,7 @@
|
||||
</UnusedClass>
|
||||
</file>
|
||||
<file src="../tests/Unit/Crypt/DSA/LoadDSAKeyTest.php">
|
||||
<MixedAssignment occurrences="2">
|
||||
<code>$dsa</code>
|
||||
<MixedAssignment occurrences="1">
|
||||
<code>$sig</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="3">
|
||||
@ -16691,13 +16702,12 @@
|
||||
<code>$sig = $privateKey->sign('')</code>
|
||||
<code>$sig = $privateKey->sign('')</code>
|
||||
</MixedArgument>
|
||||
<MixedAssignment occurrences="35">
|
||||
<MixedAssignment occurrences="34">
|
||||
<code>$QA</code>
|
||||
<code>$curve</code>
|
||||
<code>$dA</code>
|
||||
<code>$oid</code>
|
||||
<code>$privateKey</code>
|
||||
<code>$privatekey</code>
|
||||
<code>$public</code>
|
||||
<code>$publicKey</code>
|
||||
<code>$publickey</code>
|
||||
@ -16728,14 +16738,12 @@
|
||||
<code>$signature2</code>
|
||||
<code>$signature2</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="18">
|
||||
<MixedMethodCall occurrences="16">
|
||||
<code>createRandomMultiplier</code>
|
||||
<code>getBasePoint</code>
|
||||
<code>getBasePoint</code>
|
||||
<code>getPublicKey</code>
|
||||
<code>multiplyPoint</code>
|
||||
<code>sign</code>
|
||||
<code>sign</code>
|
||||
<code>verify</code>
|
||||
<code>verify</code>
|
||||
<code>verify</code>
|
||||
@ -16850,18 +16858,16 @@
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$components['dA']</code>
|
||||
</InvalidArgument>
|
||||
<MissingParamType occurrences="2">
|
||||
<MissingParamType occurrences="1">
|
||||
<code>$key</code>
|
||||
<code>$password</code>
|
||||
</MissingParamType>
|
||||
<PossiblyUnusedMethod occurrences="1">
|
||||
<code>load</code>
|
||||
</PossiblyUnusedMethod>
|
||||
</file>
|
||||
<file src="../tests/Unit/Crypt/EC/Ed448PublicKey.php">
|
||||
<MissingParamType occurrences="2">
|
||||
<MissingParamType occurrences="1">
|
||||
<code>$key</code>
|
||||
<code>$password</code>
|
||||
</MissingParamType>
|
||||
<PossiblyUnusedMethod occurrences="1">
|
||||
<code>load</code>
|
||||
@ -17159,9 +17165,6 @@
|
||||
</UnusedVariable>
|
||||
</file>
|
||||
<file src="../tests/Unit/Crypt/RSA/LoadKeyTest.php">
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>false</code>
|
||||
</InvalidArgument>
|
||||
<InvalidCast occurrences="1">
|
||||
<code>$key</code>
|
||||
</InvalidCast>
|
||||
@ -17169,14 +17172,10 @@
|
||||
<code>$key</code>
|
||||
<code>$pass</code>
|
||||
</MissingParamType>
|
||||
<MixedArgument occurrences="11">
|
||||
<code>$encryptedKey</code>
|
||||
<MixedArgument occurrences="7">
|
||||
<code>$key</code>
|
||||
<code>$key</code>
|
||||
<code>$pass</code>
|
||||
<code>$pass</code>
|
||||
<code>$pass</code>
|
||||
<code>$pass</code>
|
||||
<code>$r['meta']['algorithm']</code>
|
||||
<code>$r['meta']['cipher']</code>
|
||||
<code>$r['meta']['prf']</code>
|
||||
@ -17196,20 +17195,16 @@
|
||||
<code>$r['meta']['cipher']</code>
|
||||
<code>$r['meta']['prf']</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment occurrences="7">
|
||||
<code>$encryptedKey</code>
|
||||
<MixedAssignment occurrences="5">
|
||||
<code>$key</code>
|
||||
<code>$key2</code>
|
||||
<code>$rsa</code>
|
||||
<code>$rsa</code>
|
||||
<code>$rsa2</code>
|
||||
<code>$sig</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="5">
|
||||
<MixedMethodCall occurrences="3">
|
||||
<code>sign</code>
|
||||
<code>toString</code>
|
||||
<code>toString</code>
|
||||
<code>toString</code>
|
||||
<code>withPadding</code>
|
||||
</MixedMethodCall>
|
||||
<PossiblyFalseArgument occurrences="3">
|
||||
@ -17249,9 +17244,6 @@
|
||||
<code>LoadKeyTest</code>
|
||||
<code>LoadKeyTest</code>
|
||||
</PropertyNotSetInConstructor>
|
||||
<TooManyArguments occurrences="1">
|
||||
<code>RSA::load($key, false, 'PKCS8')</code>
|
||||
</TooManyArguments>
|
||||
<UndefinedMethod occurrences="7">
|
||||
<code>asPrivateKey</code>
|
||||
<code>sign</code>
|
||||
|
@ -127,9 +127,8 @@ abstract class AsymmetricKey
|
||||
* Load the key
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string $password optional
|
||||
*/
|
||||
public static function load($key, $password = false): AsymmetricKey
|
||||
public static function load($key, ?string $password = null): AsymmetricKey
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
@ -208,10 +207,9 @@ abstract class AsymmetricKey
|
||||
/**
|
||||
* Load the key, assuming a specific format
|
||||
*
|
||||
* @param string $password optional
|
||||
* @return static
|
||||
*/
|
||||
public static function loadFormat(string $type, string $key, $password = false): AsymmetricKey
|
||||
public static function loadFormat(string $type, string $key, ?string $password = null): AsymmetricKey
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
@ -237,10 +235,8 @@ abstract class AsymmetricKey
|
||||
|
||||
/**
|
||||
* Loads a private key
|
||||
*
|
||||
* @param string $password optional
|
||||
*/
|
||||
public static function loadPrivateKeyFormat(string $type, string $key, $password = false): PrivateKey
|
||||
public static function loadPrivateKeyFormat(string $type, string $key, ?string $password = null): PrivateKey
|
||||
{
|
||||
$key = self::loadFormat($type, $key, $password);
|
||||
if (!$key instanceof PrivateKey) {
|
||||
|
@ -57,9 +57,8 @@ abstract class OpenSSH
|
||||
* $type can be either ssh-dss or ssh-rsa
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
|
@ -106,10 +106,9 @@ abstract class PKCS1 extends PKCS
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
* @return array|string
|
||||
*/
|
||||
protected static function load($key, $password = '')
|
||||
protected static function load($key, ?string $password = null)
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
|
@ -295,16 +295,15 @@ abstract class PKCS8 extends PKCS
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
protected static function load($key, $password = ''): array
|
||||
protected static function load($key, ?string $password = null): array
|
||||
{
|
||||
$decoded = self::preParse($key);
|
||||
|
||||
$meta = [];
|
||||
|
||||
$decrypted = ASN1::asn1map($decoded[0], Maps\EncryptedPrivateKeyInfo::MAP);
|
||||
if ($password !== false && strlen($password) && is_array($decrypted)) {
|
||||
if ($password !== null && strlen($password) && is_array($decrypted)) {
|
||||
$algorithm = $decrypted['encryptionAlgorithm']['algorithm'];
|
||||
switch ($algorithm) {
|
||||
// PBES1
|
||||
|
@ -26,7 +26,7 @@ interface PrivateKey
|
||||
public function toString(string $type, array $options = []): string;
|
||||
|
||||
/**
|
||||
* @param string|false $password
|
||||
* @return static
|
||||
*/
|
||||
public function withPassword($password = false);
|
||||
public function withPassword(?string $password = null): PrivateKey;
|
||||
}
|
||||
|
@ -23,11 +23,9 @@ namespace phpseclib3\Crypt\Common\Traits;
|
||||
trait PasswordProtected
|
||||
{
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string|bool
|
||||
* @var string|null
|
||||
*/
|
||||
private $password = false;
|
||||
private $password = null;
|
||||
|
||||
/**
|
||||
* Sets the password
|
||||
@ -37,9 +35,10 @@ trait PasswordProtected
|
||||
*
|
||||
* @see self::createKey()
|
||||
* @see self::load()
|
||||
* @param string|bool $password
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function withPassword($password = false)
|
||||
public function withPassword(?string $password = null): self
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->password = $password;
|
||||
|
@ -307,9 +307,8 @@ abstract class DH extends AsymmetricKey
|
||||
* Load the key
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string $password optional
|
||||
*/
|
||||
public static function load($key, $password = false): AsymmetricKey
|
||||
public static function load($key, ?string $password = null): AsymmetricKey
|
||||
{
|
||||
try {
|
||||
return EC::load($key, $password);
|
||||
|
@ -39,9 +39,8 @@ abstract class PKCS1 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
$key = parent::load($key, $password);
|
||||
|
||||
|
@ -59,9 +59,8 @@ abstract class PKCS8 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
@ -103,11 +102,8 @@ abstract class PKCS8 extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $prime, BigInteger $base, BigInteger $privateKey, BigInteger $publicKey, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $prime, BigInteger $base, BigInteger $privateKey, BigInteger $publicKey, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$params = [
|
||||
'prime' => $prime,
|
||||
|
@ -39,9 +39,8 @@ abstract class OpenSSH extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
$parsed = parent::load($key, $password);
|
||||
|
||||
@ -94,11 +93,8 @@ abstract class OpenSSH extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$publicKey = self::savePublicKey($p, $q, $g, $y, ['binary' => true]);
|
||||
$privateKey = Strings::packSSH2('si5', 'ssh-dss', $p, $q, $g, $y, $x);
|
||||
|
@ -46,9 +46,8 @@ abstract class PKCS1 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
$key = parent::load($key, $password);
|
||||
|
||||
|
@ -63,9 +63,8 @@ abstract class PKCS8 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
@ -113,11 +112,8 @@ abstract class PKCS8 extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$params = [
|
||||
'p' => $p,
|
||||
|
@ -69,11 +69,8 @@ abstract class PuTTY extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = false, array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, ?string $password = null, array $options = []): string
|
||||
{
|
||||
if ($q->getLength() != 160) {
|
||||
throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160');
|
||||
|
@ -30,9 +30,8 @@ abstract class Raw
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!is_array($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a array - not a ' . gettype($key));
|
||||
|
@ -35,10 +35,8 @@ abstract class XML
|
||||
{
|
||||
/**
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load(string $key, $password = ''): array
|
||||
public static function load(string $key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
|
@ -43,10 +43,8 @@ abstract class MontgomeryPrivate
|
||||
|
||||
/**
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load(string $key, $password = ''): array
|
||||
public static function load(string $key, ?string $password = null): array
|
||||
{
|
||||
switch (strlen($key)) {
|
||||
case 32:
|
||||
@ -82,9 +80,8 @@ abstract class MontgomeryPrivate
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param Integer[] $publicKey
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $privateKey, MontgomeryCurve $curve, array $publicKey, $password = ''): string
|
||||
public static function savePrivateKey(BigInteger $privateKey, MontgomeryCurve $curve, array $publicKey, ?string $password = null): string
|
||||
{
|
||||
if (!empty($password) && is_string($password)) {
|
||||
throw new UnsupportedFormatException('MontgomeryPrivate private keys do not support encryption');
|
||||
|
@ -34,10 +34,8 @@ abstract class MontgomeryPublic
|
||||
|
||||
/**
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load(string $key, $password = ''): array
|
||||
public static function load(string $key, ?string $password = null): array
|
||||
{
|
||||
switch (strlen($key)) {
|
||||
case 32:
|
||||
|
@ -49,9 +49,8 @@ abstract class OpenSSH extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
$parsed = parent::load($key, $password);
|
||||
|
||||
|
@ -52,9 +52,8 @@ abstract class PKCS1 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
@ -164,10 +163,8 @@ abstract class PKCS1 extends Progenitor
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param Integer[] $publicKey
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $password = null, array $options = []): string
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
|
@ -65,9 +65,8 @@ abstract class PKCS8 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
// initialize_static_variables() is defined in both the trait and the parent class
|
||||
// when it's defined in two places it's the traits one that's called
|
||||
@ -201,10 +200,8 @@ abstract class PKCS8 extends Progenitor
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param Integer[] $publicKey
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $password = null, array $options = []): string
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
|
@ -86,10 +86,8 @@ abstract class PuTTY extends Progenitor
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
|
||||
* @param string $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $password = false, array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $password = null, array $options = []): string
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
|
@ -57,9 +57,8 @@ abstract class XML
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
|
@ -39,10 +39,8 @@ abstract class libsodium
|
||||
|
||||
/**
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|false $password optional
|
||||
*/
|
||||
public static function load(string $key, $password = ''): array
|
||||
public static function load(string $key, ?string $password = null): array
|
||||
{
|
||||
switch (strlen($key)) {
|
||||
case 32:
|
||||
@ -89,9 +87,8 @@ abstract class libsodium
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $privateKey, Ed25519 $curve, array $publicKey, $password = ''): string
|
||||
public static function savePrivateKey(BigInteger $privateKey, Ed25519 $curve, array $publicKey, ?string $password = null): string
|
||||
{
|
||||
if (!isset($privateKey->secret)) {
|
||||
throw new \RuntimeException('Private Key does not have a secret set');
|
||||
|
@ -32,9 +32,8 @@ abstract class PublicKeyLoader
|
||||
* Loads a public or private key
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string $password optional
|
||||
*/
|
||||
public static function load($key, $password = false): AsymmetricKey
|
||||
public static function load($key, ?string $password = null): AsymmetricKey
|
||||
{
|
||||
try {
|
||||
return EC::load($key, $password);
|
||||
@ -68,9 +67,8 @@ abstract class PublicKeyLoader
|
||||
* Loads a private key
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string $password optional
|
||||
*/
|
||||
public static function loadPrivateKey($key, $password = false): PrivateKey
|
||||
public static function loadPrivateKey($key, ?string $password = null): PrivateKey
|
||||
{
|
||||
$key = self::load($key, $password);
|
||||
if (!$key instanceof PrivateKey) {
|
||||
|
@ -64,9 +64,8 @@ abstract class MSBLOB
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
@ -168,10 +167,8 @@ abstract class MSBLOB
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = ''): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null): string
|
||||
{
|
||||
if (count($primes) != 2) {
|
||||
throw new \InvalidArgumentException('MSBLOB does not support multi-prime RSA keys');
|
||||
|
@ -39,9 +39,8 @@ abstract class OpenSSH extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
static $one;
|
||||
if (!isset($one)) {
|
||||
@ -109,11 +108,8 @@ abstract class OpenSSH extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$publicKey = self::savePublicKey($n, $e, ['binary' => true]);
|
||||
$privateKey = Strings::packSSH2('si6', 'ssh-rsa', $n, $e, $d, $coefficients[2], $primes[1], $primes[2]);
|
||||
|
@ -43,7 +43,7 @@ abstract class PKCS1 extends Progenitor
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
@ -106,7 +106,7 @@ abstract class PKCS1 extends Progenitor
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$num_primes = count($primes);
|
||||
$key = [
|
||||
|
@ -64,9 +64,8 @@ abstract class PKCS8 extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
@ -105,11 +104,8 @@ abstract class PKCS8 extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
$key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients);
|
||||
$key = ASN1::extractBER($key);
|
||||
|
@ -94,9 +94,8 @@ abstract class PSS extends Progenitor
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
@ -154,11 +153,8 @@ abstract class PSS extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
self::initialize_static_variables();
|
||||
|
||||
|
@ -86,11 +86,8 @@ abstract class PuTTY extends Progenitor
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
if (count($primes) != 2) {
|
||||
throw new \InvalidArgumentException('PuTTY does not support multi-prime RSA keys');
|
||||
|
@ -39,9 +39,8 @@ abstract class Raw
|
||||
* Break a public or private key down into its constituent components
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|false $password
|
||||
*/
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!is_array($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a array - not a ' . gettype($key));
|
||||
@ -139,11 +138,8 @@ abstract class Raw
|
||||
|
||||
/**
|
||||
* Convert a private key to the appropriate format.
|
||||
*
|
||||
* @param string|false $password optional
|
||||
* @param array $options optional
|
||||
*/
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []): string
|
||||
public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, ?string $password = null, array $options = []): string
|
||||
{
|
||||
if (!empty($password) && is_string($password)) {
|
||||
throw new UnsupportedFormatException('Raw private keys do not support encryption');
|
||||
|
@ -298,10 +298,9 @@ class Identity implements PrivateKey
|
||||
/**
|
||||
* Sets the password
|
||||
*
|
||||
* @param string|bool $password
|
||||
* @return never
|
||||
*/
|
||||
public function withPassword($password = false)
|
||||
public function withPassword(?string $password = null): PrivateKey
|
||||
{
|
||||
throw new \RuntimeException('ssh-agent does not provide a mechanism to get the private key');
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use phpseclib3\Crypt\EC\Curves\Ed448;
|
||||
|
||||
class Ed448PrivateKey
|
||||
{
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
|
@ -12,7 +12,7 @@ class Ed448PublicKey
|
||||
{
|
||||
use Common;
|
||||
|
||||
public static function load($key, $password = ''): array
|
||||
public static function load($key, ?string $password = null): array
|
||||
{
|
||||
if (!Strings::is_stringable($key)) {
|
||||
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||
|
@ -431,7 +431,7 @@ qMnD/pkHR/NFcYSYShUJS0cHyryVl7/eCclsQlZTRdnVTtKF9xPGTQC8fK0G7BDN
|
||||
Z2sKniRCcDT1ZP4=
|
||||
-----END PRIVATE KEY-----';
|
||||
|
||||
$rsa = RSA::load($key, false, 'PKCS8');
|
||||
$rsa = RSA::load($key);
|
||||
|
||||
$this->assertInstanceOf(PrivateKey::class, $rsa);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user