test_crypto.py 文件源码

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

项目:2FAssassin 作者: maxwellkoh 项目源码 文件源码
def test_export_without_bytes(self):
        """
        Test `PKCS12.export` with text not bytes as passphrase
        """
        p12 = self.gen_pkcs12(server_cert_pem, server_key_pem, root_cert_pem)

        with pytest.warns(DeprecationWarning) as w:
            simplefilter("always")
            dumped_p12 = p12.export(passphrase=b"randomtext".decode("ascii"))
            assert (
                "{0} for passphrase is no longer accepted, use bytes".format(
                    WARNING_TYPE_EXPECTED
                ) == str(w[-1].message))
        self.check_recovery(
            dumped_p12,
            key=server_key_pem,
            cert=server_cert_pem,
            passwd=b"randomtext"
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号