当前位置: 首页>>代码示例>>Python>>正文


Python ECDSAKey.verify_ssh_sig方法代码示例

本文整理汇总了Python中paramiko.ECDSAKey.verify_ssh_sig方法的典型用法代码示例。如果您正苦于以下问题:Python ECDSAKey.verify_ssh_sig方法的具体用法?Python ECDSAKey.verify_ssh_sig怎么用?Python ECDSAKey.verify_ssh_sig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在paramiko.ECDSAKey的用法示例。


在下文中一共展示了ECDSAKey.verify_ssh_sig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_13_sign_ecdsa

# 需要导入模块: from paramiko import ECDSAKey [as 别名]
# 或者: from paramiko.ECDSAKey import verify_ssh_sig [as 别名]
    def test_13_sign_ecdsa(self):
        # verify that the rsa private key can sign and verify
        key = ECDSAKey.from_private_key_file('tests/test_ecdsa.key')
        msg = key.sign_ssh_data(rng, b'ice weasels')
        self.assert_(type(msg) is Message)
        msg.rewind()
        self.assertEquals(b'ecdsa-sha2-nistp256', msg.get_string())
        # ECDSA signatures, like DSS signatures, tend to be different
        # each time, so we can't compare against a "known correct"
        # signature.
        # Even the length of the signature can change.

        msg.rewind()
        pub = ECDSAKey(data=bytes(key))
        self.assert_(pub.verify_ssh_sig(b'ice weasels', msg))
开发者ID:chuckds,项目名称:paramiko,代码行数:17,代码来源:test_pkey.py

示例2: test_21_sign_ecdsa_521

# 需要导入模块: from paramiko import ECDSAKey [as 别名]
# 或者: from paramiko.ECDSAKey import verify_ssh_sig [as 别名]
    def test_21_sign_ecdsa_521(self):
        # verify that the rsa private key can sign and verify
        key = ECDSAKey.from_private_key_file(test_path('test_ecdsa_521.key'))
        msg = key.sign_ssh_data(b'ice weasels')
        self.assertTrue(type(msg) is Message)
        msg.rewind()
        self.assertEqual('ecdsa-sha2-nistp521', msg.get_text())
        # ECDSA signatures, like DSS signatures, tend to be different
        # each time, so we can't compare against a "known correct"
        # signature.
        # Even the length of the signature can change.

        msg.rewind()
        pub = ECDSAKey(data=key.asbytes())
        self.assertTrue(pub.verify_ssh_sig(b'ice weasels', msg))
开发者ID:AlexanderChernikov,项目名称:paramiko,代码行数:17,代码来源:test_pkey.py


注:本文中的paramiko.ECDSAKey.verify_ssh_sig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。