Example #1
0
 def encrypt(self):
     aes = crypto.AESCipher(settings.AES_DEFAULT_KEY)
     if len(self.name) > 0:
         self.name = str(aes.encrypt(self.name), 'utf-8')
     if len(self.surname) > 0:
         self.surname = str(aes.encrypt(self.surname), 'utf-8')
     if len(self.patronymic) > 0:
         self.patronymic = str(aes.encrypt(self.patronymic), 'utf-8')
     self.login = str(aes.encrypt(self.login, iv=settings.AES_DEFAULT_IV, random=False), 'utf-8')
     self.mail = str(aes.encrypt(self.mail, iv=settings.AES_DEFAULT_IV, random=False), 'utf-8')
     self.password = str(aes.encrypt(self.password), 'utf-8')
Example #2
0
 def decrypt(self):
     aes = crypto.AESCipher(settings.AES_DEFAULT_KEY)
     if len(self.name) > 0:
         self.name = aes.decrypt(self.name)
     if len(self.surname) > 0:
         self.surname = aes.decrypt(self.surname)
     if len(self.patronymic) > 0:
         self.patronymic = aes.decrypt(self.patronymic)
     self.login = aes.decrypt(self.login)
     self.mail = aes.decrypt(self.mail)
     self.password = aes.decrypt(self.password)
Example #3
0
 def encActivationKey(self, commit=False):
     aes = crypto.AESCipher(settings.AES_ACTIVATION_KEY)
     encKey = str(aes.encrypt(self.activationKey), 'utf-8')
     if commit:
         self.activationKey = encKey
     return encKey
Example #4
0
def StandartEncryptField(field, aesKey):
    aes = crypto.AESCipher(aesKey)
    return str(aes.encrypt(field, iv=settings.AES_DEFAULT_IV, random=False), 'utf-8')
Example #5
0
 def getEncID(self):
     aes = crypto.AESCipher(settings.AES_ID_KEY)
     return str(aes.encrypt(str(self.id)), 'utf-8')
Example #6
0
def StandartDecryptField(field, aesKey):
    aes = crypto.AESCipher(aesKey)
    return aes.decrypt(field)
Example #7
0
 def decActivationKey(self):
     aes = crypto.AESCipher(settings.AES_ACTIVATION_KEY)
     self.activationKey = str(aes.decrypt(self.activationKey))
     return self.activationKey
Example #8
0
 def decrypt(self):
     aes = crypto.AESCipher(settings.AES_DEFAULT_KEY)
     if len(self.adress) > 0:
         self.adress = aes.decrypt(self.adress)
     if len(self.phone) > 0:
         self.phone = aes.decrypt(self.phone)
Example #9
0
 def encrypt(self):
     aes = crypto.AESCipher(settings.AES_DEFAULT_KEY)
     if len(self.adress) > 0:
         self.adress = str(aes.encrypt(self.adress), 'utf-8')
     if len(self.phone) > 0:
         self.phone = str(aes.encrypt(self.phone), 'utf-8')