def _decrypt(self, msg, key, iv):
     msg = unhexlify(msg)
     key = unhexlify(key)
     iv = unhexlify(iv)
     if len(iv) != 16:
         logger.info("iv length is" + str(len(iv)) + " must be 16.")
         return False
     decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationCBC(key, iv))
     plain_text = decrypter.feed(msg)
     plain_text += decrypter.feed()
     f = hexlify(plain_text)
     return f
示例#2
0
def _decrypt(msg, key, iv):
    msg = unhexlify(msg)
    key = unhexlify(key)
    iv = unhexlify(iv)
    if len(iv) != 16:
        logger.info("iv length is" + str(len(iv)) + " must be 16.")
        return False
    decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationCBC(key, iv))
    plain_text = decrypter.feed(msg)
    plain_text += decrypter.feed()
    f = hexlify(plain_text)
    return f

    if 'User-Agent=' not in sUrl:
        delimiter = '&' if '|' in sUrl else '|'
        sUrl += delimiter + "User-Agent=" + oRequest.getHeaderEntry('User-Agent')
    return sUrl
 def __decrypt_text(self, key, iv, txt):
     from resources.lib import pyaes
     decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationCBC(key, iv=iv))
     decrypted_txt = decrypter.feed(txt)
     decrypted_txt += decrypter.feed()
     return decrypted_txt