miio.py 文件源码

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

项目:mihome-binary-protocol 作者: OpenMiHome 项目源码 文件源码
def AES_cbc_decrypt(token: bytes, ciphertext: bytes) -> bytes:
    """Decrypt cipher text with device token."""
    key, iv = key_iv(token)
    cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=_backend)
    decryptor = cipher.decryptor()
    padded_plaintext = decryptor.update(bytes(ciphertext)) \
        + decryptor.finalize()
    unpadder = padding.PKCS7(128).unpadder()
    unpadded_plaintext = unpadder.update(padded_plaintext)
    unpadded_plaintext += unpadder.finalize()
    return unpadded_plaintext
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号