From 4eb9cbd0c892f1436fb3b27a31f3f467ee0a8cc4 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 14 Nov 2021 00:52:37 -0600 Subject: [PATCH] EC/Keys/PKCS8: publicKey parameter should be optional --- phpseclib/Crypt/EC/Formats/Keys/PKCS8.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php index 247beedb..e6a3d59f 100644 --- a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php @@ -128,8 +128,9 @@ abstract class PKCS8 extends Progenitor $temp = new BigInteger($key['privateKey'], 256); $components['dA'] = $components['curve']->convertInteger($temp); - - $components['QA'] = self::extractPoint($key['publicKey'], $components['curve']); + $components['QA'] = isset($key['publicKey']) ? + self::extractPoint($key['publicKey'], $components['curve']) : + $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); return $components; }