attr-encrypted / encryptor

A simple wrapper for the standard ruby OpenSSL library
MIT License
336 stars 51 forks source link

ArgumentError: data must not be empty #33

Open MattSmithASU opened 5 years ago

MattSmithASU commented 5 years ago

When upgrading the gem from version 1.1.3 to 3.0.0 (or 2.0.0), I get the error: "ArgumentError: data must not be empty" on a Encryptor.decrypt call I'm calling the decrypt method with the same value as before (iv is 12 bytes instead of 16). dcrypted_value = Encryptor.decrypt unpacked, :key => the_key, :iv => the_iv, :salt => the_salt

Jorgelina1983 commented 5 years ago

@MattSmithASU I just figured that with this upgrade the default algorithm changed from aes-256-cbc to aes-256-gcm. So in order to use the decrypt with old data you will need to send the following options insecure_mode: true, algorithm: 'aes-256-cbc'.