EC: don't call loadCurveByParams if params is null

This commit is contained in:
terrafrost 2020-01-02 05:43:27 -06:00
parent a7b1d031bb
commit c4e07725aa

View File

@ -106,6 +106,9 @@ abstract class PKCS8 extends Progenitor
$decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element);
$params = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP); $params = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP);
if (!$params) {
throw new \RuntimeException('Unable to decode the parameters using Maps\ECParameters');
}
$components = []; $components = [];
$components['curve'] = self::loadCurveByParam($params); $components['curve'] = self::loadCurveByParam($params);