EC: make secret field in savePrivateKey optional

This commit is contained in:
terrafrost 2022-08-12 13:12:16 -05:00
parent 5c8966334e
commit f928536632
5 changed files with 6 additions and 6 deletions

View File

@ -176,8 +176,8 @@ abstract class OpenSSH extends Progenitor
BigInteger $privateKey,
BaseCurve $curve,
array $publicKey,
string $secret,
$password,
?string $secret = null,
?string $password = null,
array $options = []
): string {
if ($curve instanceof Ed25519) {

View File

@ -164,7 +164,7 @@ abstract class PKCS1 extends Progenitor
*
* @param Integer[] $publicKey
*/
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, string $secret, ?string $password = null, array $options = []): string
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $secret = null, ?string $password = null, array $options = []): string
{
self::initialize_static_variables();

View File

@ -203,7 +203,7 @@ abstract class PKCS8 extends Progenitor
*
* @param Integer[] $publicKey
*/
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, string $secret, ?string $password = null, array $options = []): string
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $secret = null, ?string $password = null, array $options = []): string
{
self::initialize_static_variables();

View File

@ -89,7 +89,7 @@ abstract class PuTTY extends Progenitor
*
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
*/
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, string $secret, ?string $password = null, array $options = []): string
public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, ?string $secret = null, ?string $password = null, array $options = []): string
{
self::initialize_static_variables();

View File

@ -90,7 +90,7 @@ abstract class libsodium
*
* @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
*/
public static function savePrivateKey(BigInteger $privateKey, Ed25519 $curve, array $publicKey, string $secret, ?string $password = null): string
public static function savePrivateKey(BigInteger $privateKey, Ed25519 $curve, array $publicKey, ?string $secret = null, ?string $password = null): string
{
if (!isset($secret)) {
throw new \RuntimeException('Private Key does not have a secret set');