RSA: fix issue with PKCS1 encryption

This commit is contained in:
terrafrost 2019-06-08 18:58:24 -05:00
parent a431a1959a
commit 88b6337a3f

View File

@ -451,7 +451,8 @@ class PublicKey extends RSA implements Common\PublicKey
return $this->raw_encrypt($plaintext); return $this->raw_encrypt($plaintext);
case self::ENCRYPTION_PKCS15_COMPAT: case self::ENCRYPTION_PKCS15_COMPAT:
case self::ENCRYPTION_PKCS1: case self::ENCRYPTION_PKCS1:
return $this->rsaes_pkcs1_v1_5_encrypt($plaintext, $padding == self::ENCRYPTION_PKCS15_COMPAT); $pkcs15_compat = $this->encryptionPadding & self::ENCRYPTION_PKCS15_COMPAT;
return $this->rsaes_pkcs1_v1_5_encrypt($plaintext, $pkcs15_compat);
//case self::ENCRYPTION_OAEP: //case self::ENCRYPTION_OAEP:
default: default:
return $this->rsaes_oaep_encrypt($plaintext); return $this->rsaes_oaep_encrypt($plaintext);