MysqlAes does not use a random iv, that means ciphertext for a given key and plaintext will always be the same. That means you could index your encrypted column and find results by searching for the ciphertext.  

PostreSQL PGP on the other hand uses random_iv, that means we can't search by ciphertext and instead need to look at each row after it's decrypted.  

--  
Justin Mazzi


On Tuesday, October 1, 2013 at 9:47 AM, Fabio Kreusch wrote:

> In lib/crypt_keeper/provider/mysql_aes.rb:
> > escape_and_execute_sql( > ["SELECT AES_DECRYPT(?, ?)", Base64.decode64(value), key]).first > end > + > + def search(records, field, criteria) > + records.where(field.to_sym => encrypt(criteria))  
> Can't we do it similarly to the pg implementation? (decrypt in the query and compare against that)
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/jmazzi/crypt_keeper/pull/53/files#r6686418).
>  
>  
>