MSL.py 文件源码

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

项目:plugin.video.netflix 作者: asciidisco 项目源码 文件源码
def __encrypt(self, plaintext):
        """
        Encrypt the given Plaintext with the encryption key
        :param plaintext:
        :return: Serialized JSON String of the encryption Envelope
        """
        esn = self.kodi_helper.get_esn()

        iv = get_random_bytes(16)
        encryption_envelope = {
            'ciphertext': '',
            'keyid': esn + '_' + str(self.sequence_number),
            'sha256': 'AA==',
            'iv': base64.standard_b64encode(iv)
        }
        # Padd the plaintext
        plaintext = Padding.pad(plaintext, 16)
        # Encrypt the text
        cipher = AES.new(self.encryption_key, AES.MODE_CBC, iv)
        citext = cipher.encrypt(plaintext)
        encryption_envelope['ciphertext'] = base64.standard_b64encode(citext)
        return json.dumps(encryption_envelope)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号