Skip to content

Commit

Permalink
fix: ¯\_(ツ)_/¯
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDobrzan committed Sep 28, 2023
1 parent b1742bf commit 1064993
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pubnub/crypto/aes_cbc_cryptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ def encrypt(data)
cipher.iv = OpenSSL::Random.random_bytes BLOCK_SIZE
encoded_message = cipher.update data
encoded_message << cipher.final

Base64.strict_encode64(encoded_message)
end

def decrypt(data, iv)
undecoded_text = Base64.strict_decode64(data)

cipher = OpenSSL::Cipher.new(@alg).decrypt
cipher.key = @cipher_key
cipher.iv = iv

decrypted = cipher.update data
decrypted = cipher.update undecoded_text
decrypted << cipher.final
end
end
Expand Down

0 comments on commit 1064993

Please sign in to comment.