From a0a3b98c997944abeb8edb7adc5157bf0188c1eb Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Mon, 29 Apr 2024 21:35:39 +0530 Subject: [PATCH] Fixed empty string encryption using openSSL crypto --- lib/ably/util/crypto.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ably/util/crypto.rb b/lib/ably/util/crypto.rb index 3635b59a5..7707af93e 100644 --- a/lib/ably/util/crypto.rb +++ b/lib/ably/util/crypto.rb @@ -83,8 +83,8 @@ def encrypt(payload, encrypt_options = {}) cipher.key = key iv = encrypt_options[:iv] || fixed_iv || cipher.random_iv cipher.iv = iv - - iv << cipher.update(payload) << cipher.final + iv << cipher.update(payload) unless payload.empty? + iv << cipher.final end # Decrypt payload using configured Cipher