From 88b6337a3f871750f4ad42d38dcaa7744149cb4d Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 8 Jun 2019 18:58:24 -0500 Subject: [PATCH] RSA: fix issue with PKCS1 encryption --- phpseclib/Crypt/RSA/PublicKey.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpseclib/Crypt/RSA/PublicKey.php b/phpseclib/Crypt/RSA/PublicKey.php index fe0dff79..14f6c9f1 100644 --- a/phpseclib/Crypt/RSA/PublicKey.php +++ b/phpseclib/Crypt/RSA/PublicKey.php @@ -451,7 +451,8 @@ class PublicKey extends RSA implements Common\PublicKey return $this->raw_encrypt($plaintext); case self::ENCRYPTION_PKCS15_COMPAT: 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: default: return $this->rsaes_oaep_encrypt($plaintext);