Prev: [ANN] Zbatery v0.2.1 - use a less-broken parser from Unicorn
Next: Windows 7 - 64-bit and MySql - what are my options?
From: Aaron D. Gifford on 19 Apr 2010 17:35
I need to do some decryption of data encrypted with Rijndael (AES) but
that is NOT PKCS padded. I can't use openssl, as it chokes on data
that isn't padded PKCS-style. And I tried the all-Ruby crypt gem and
it seems to have issues on my system running 1.9.1 (I haven't analyzed
what the deal is yet so I can't say more).
Are there any OTHER gems I should take a look at, or is there a way to
disable PKCS padding and use openssl?
From: Aaron D. Gifford on 20 Apr 2010 18:33
On Tue, Apr 20, 2010 at 4:46 AM, Brian Candler <b.candler(a)pobox.com> wrote:
> I think the equivalent in Ruby is this:
> => ["padding="]
Thank you, that was exactly what I needed and it works perfectly for my data:
def decrypt_aes_256_cbc(key, iv, ciphertext)
aes = OpenSSL::Cipher::AES.NEW('256-CBC')
aes.padding = 0
aes.key = key
aes.iv = iv
aes.update(ciphertext) + aes.final