예제 #1
0
    def _gk_decrypt(self, key, cipher_link):
        try:
            key += (24 - len(key)) * '\0'
            decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationECB(key))
            plain_text = decrypter.feed(cipher_link.decode('hex'))
            plain_text += decrypter.feed()
            plain_text = plain_text.split('\0', 1)[0]
        except Exception as e:
            log_utils.log('Exception (%s) during %s gk decrypt: cipher_link: %s' % (e, self.get_name(), cipher_link), log_utils.LOGWARNING)
            plain_text = ''

        return plain_text
예제 #2
0
 def __encrypt(self, key, text):
     encrypter = pyaes.Encrypter(pyaes.AESModeOfOperationECB(key))
     ct = encrypter.feed(text)
     ct += encrypter.feed()
     return ct
예제 #3
0
 def __decrypt(self, key, cipher_text):
     decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationECB(key))
     plain_text = decrypter.feed(cipher_text)
     plain_text += decrypter.feed()
     return plain_text