From 84f07cc9cb8e04346ad50be69856c80b9feb5caa Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 22 May 2021 10:10:09 -0500 Subject: [PATCH 1/2] X509: signing with pw protected PSS keys yielded errors --- phpseclib/File/X509.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 2e1620c1..daf54796 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -2615,7 +2615,7 @@ class X509 if ($signatureAlgorithm != 'id-RSASSA-PSS') { $signatureAlgorithm = ['algorithm' => $signatureAlgorithm]; } else { - $r = PSS::load($issuer->privateKey->toString('PSS')); + $r = PSS::load($issuer->privateKey->withPassword()->toString('PSS')); $signatureAlgorithm = [ 'algorithm' => 'id-RSASSA-PSS', 'parameters' => PSS::savePSSParams($r) From cfe8a2401114ba30a7e7775552a838840c6ca1a0 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 22 May 2021 10:18:11 -0500 Subject: [PATCH 2/2] PrivateKey: tweak interface --- phpseclib/Crypt/Common/PrivateKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/Crypt/Common/PrivateKey.php b/phpseclib/Crypt/Common/PrivateKey.php index 00712328..bc0b9ede 100644 --- a/phpseclib/Crypt/Common/PrivateKey.php +++ b/phpseclib/Crypt/Common/PrivateKey.php @@ -26,5 +26,5 @@ interface PrivateKey //public function decrypt($ciphertext); public function getPublicKey(); public function toString($type, array $options = []); - public function withPassword($string); + public function withPassword($string = false); }