extract_tokens.py 文件源码

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

项目:python-miio 作者: rytilahti 项目源码 文件源码
def decrypt_ztoken(ztoken):
        """Decrypt the given ztoken, used by apple."""
        if len(ztoken) <= 32:
            return ztoken

        keystring = '00000000000000000000000000000000'
        key = bytes.fromhex(keystring)
        cipher = Cipher(algorithms.AES(key), modes.ECB(),
                        backend=default_backend())
        decryptor = cipher.decryptor()
        token = decryptor.update(bytes.fromhex(ztoken[:64])) \
                + decryptor.finalize()

        return token.decode()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号