From c4e07725aa15a583d6dab3688b72e6289dae8c52 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 2 Jan 2020 05:43:27 -0600 Subject: [PATCH] EC: don't call loadCurveByParams if params is null --- phpseclib/Crypt/EC/Formats/Keys/PKCS8.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php index fa7ed457..9132807f 100644 --- a/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php @@ -106,6 +106,9 @@ abstract class PKCS8 extends Progenitor $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); $params = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP); + if (!$params) { + throw new \RuntimeException('Unable to decode the parameters using Maps\ECParameters'); + } $components = []; $components['curve'] = self::loadCurveByParam($params);