RSA: fix for RSA PKCS1 public keys masquerading as public keys

This commit is contained in:
terrafrost 2020-03-29 23:31:13 -05:00
parent 7b5356bf86
commit 5d5ed4a449

View File

@ -412,7 +412,7 @@ abstract class RSA extends AsymmetricKey
$key->publicExponent = $components['publicExponent'];
$key->k = $key->modulus->getLengthInBytes();
if ($components['isPublicKey']) {
if ($components['isPublicKey'] || !isset($components['privateExponent'])) {
$key->exponent = $key->publicExponent;
} else {
$key->privateExponent = $components['privateExponent'];