I am using the ActiveRecord serialize method with a class of my own, AESCoder. This will uses aes-256-cbc with a random initialization vector every time. This initialization vector is prepended to the field when I store it in the database, and is of course extracted before deserializing.
Now, this scheme prevents me from using any finders on those attributes. I have to select all the rows I need, which will be automatically decrypted, and the perform a ruby select on the item list. This is, of course, a huge performance bottleneck, which I can't afford for this application.
One solution would be not to use a random IV, but then aes-256-cbc wouldn't be as secure any more.
Am I overlooking something here?