Commit 6d335881 authored by Hugo LEVY-FALK's avatar Hugo LEVY-FALK Committed by root

Meilleure gestion du AESField

parent f0168825
......@@ -27,6 +27,7 @@ def encrypt(key, s):
def decrypt(key, s):
obj =
ss = obj.decrypt(s)
return ss.split(bytes(EOD, 'utf-8'))[0]
......@@ -35,10 +36,6 @@ class AESEncryptedField(models.CharField):
binascii.b2a_base64(encrypt(settings.AES_KEY, data)))
def value_from_object(self, obj):
return decrypt(settings.AES_KEY,
binascii.a2b_base64(getattr(obj, self.attname))).decode('utf-8')
def to_python(self, value):
if value is None:
return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment