本文整理汇总了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))
示例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))