I have a 'User' table with the email as encrypted type,
class AllUser(db.Model):
id = db.Column(db.Integer, autoincrement=True, primary_key=True, index=True)
email = db.Column(EncryptedType(db.String(200), KEY), primary_key=True, index=True)
password = db.Column(db.Text, default=None)
firstname = db.Column(StringEncryptedType(db.Text, KEY))
lastname = db.Column(StringEncryptedType(db.Text, KEY))
name = db.Column(StringEncryptedType(db.Text, KEY))
And I need to query this table for migration without changing the python code and I cannot find anywhere on the internet how do to the same, we use postgres db so I tried the following queries with pgcrypto extension and it doesn't seem to work.
SELECT decrypt(email::bytea, key::bytea, 'aes') FROM all_user WHERE id=1;
SELECT decrypt(email, key, 'aes') FROM all_user WHERE id=1;
Running the above queries gives me the following error decrypt error: Data not a multiple of block size
.
Any help would be much appreciated, thank you.