@@ -38,11 +38,10 @@ public static function padPayload($payload, $maxLengthToPad)
3838 * @param string $payload With padding
3939 * @param string $userPublicKey Base 64 encoded (MIME or URL-safe)
4040 * @param string $userAuthToken Base 64 encoded (MIME or URL-safe)
41- * @param bool $nativeEncryption Use OpenSSL (>PHP7.1)
4241 *
4342 * @return array
4443 */
45- public static function encrypt ($ payload , $ userPublicKey , $ userAuthToken, $ nativeEncryption )
44+ public static function encrypt ($ payload , $ userPublicKey , $ userAuthToken )
4645 {
4746 $ userPublicKey = Base64Url::decode ($ userPublicKey );
4847 $ userAuthToken = Base64Url::decode ($ userAuthToken );
@@ -86,11 +85,7 @@ public static function encrypt($payload, $userPublicKey, $userAuthToken, $native
8685
8786 // encrypt
8887 // "The additional data passed to each invocation of AEAD_AES_128_GCM is a zero-length octet sequence."
89- if (!$ nativeEncryption ) {
90- list ($ encryptedText , $ tag ) = \AESGCM \AESGCM ::encrypt ($ contentEncryptionKey , $ nonce , $ payload , '' );
91- } else {
92- $ encryptedText = openssl_encrypt ($ payload , 'aes-128-gcm ' , $ contentEncryptionKey , OPENSSL_RAW_DATA , $ nonce , $ tag ); // base 64 encoded
93- }
88+ list ($ encryptedText , $ tag ) = \AESGCM \AESGCM ::encrypt ($ contentEncryptionKey , $ nonce , $ payload , '' );
9489
9590 // return values in url safe base64
9691 return array (
0 commit comments