encryption_utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def get_key(encoded_key):
    IV = None
    CIPHER = None
    if encoded_key is False:
        try:
            MYFILE = Tools.__path__[0]+os.sep+"admin"+os.sep+'secret.key'
            with open(MYFILE, 'r') as myfileHandle:
                encoded_key = myfileHandle.read()
        except IOError:
            print_error("Could not find the secret.key file in Tools/Admin!")
    try:
        IV = Random.new().read(AES.block_size)
        CIPHER = AES.new(base64.b64decode(encoded_key), AES.MODE_CFB, IV)
    except Exception as e:
        print_exception("Some problem occured: {0}".format(e))

    return IV, CIPHER
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号