[SQLObject] what is the best way to make an EncryptedCol
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Mathias S. <ms...@um...> - 2007-03-19 21:23:28
|
We have several column in a legacy db that are stored as AES_ENCRYPTed blobs. I would like to make a subclass of BLOBCol that will handle this for me. My plan would be to have it wrap all accesses with AES_DECRYPT(SSN, 'password') and all sets with AES_ENCRYPT(value, 'password'). Is there a good way to do this? I have already tested Instructors.select(func.AES_DECRYPT(Instructors.q.SSN,'password').endswith('9')) which works as expected, but the SSN atributes are still encrypted. I would like to make a new column type so that all the goodies like bySSN() will work. Also, I dont want to have to put __set_SSN and __get_SSN in each class that needs them. If I cant easily make a new column type, is there an easy way to execute an sqlbuilder.func call? Thank-you, Mathias Stearn |