test_crypto.py 文件源码

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

项目:2FAssassin 作者: maxwellkoh 项目源码 文件源码
def test_sign_verify_ecdsa(self):
        """
        `sign` generates a cryptographic signature which `verify` can check.
        ECDSA Signatures in the X9.62 format may have variable length,
        different from the length of the private key.
        """
        content = (
            b"It was a bright cold day in April, and the clocks were striking "
            b"thirteen. Winston Smith, his chin nuzzled into his breast in an "
            b"effort to escape the vile wind, slipped quickly through the "
            b"glass doors of Victory Mansions, though not quickly enough to "
            b"prevent a swirl of gritty dust from entering along with him."
        ).decode("ascii")
        priv_key = load_privatekey(FILETYPE_PEM, ec_root_key_pem)
        cert = load_certificate(FILETYPE_PEM, ec_root_cert_pem)
        sig = sign(priv_key, content, "sha1")
        verify(cert, sig, content, "sha1")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号