本文整理汇总了Python中paramiko.DSSKey.verify_ssh_sig方法的典型用法代码示例。如果您正苦于以下问题:Python DSSKey.verify_ssh_sig方法的具体用法?Python DSSKey.verify_ssh_sig怎么用?Python DSSKey.verify_ssh_sig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paramiko.DSSKey
的用法示例。
在下文中一共展示了DSSKey.verify_ssh_sig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_9_sign_dss
# 需要导入模块: from paramiko import DSSKey [as 别名]
# 或者: from paramiko.DSSKey import verify_ssh_sig [as 别名]
def test_9_sign_dss(self):
# verify that the dss private key can sign and verify
key = DSSKey.from_private_key_file('tests/test_dss.key')
msg = key.sign_ssh_data(rng, 'ice weasels')
self.assert_(type(msg) is Message)
msg.rewind()
self.assertEquals('ssh-dss', msg.get_string())
# can't do the same test as we do for RSA, because DSS signatures
# are usually different each time. but we can test verification
# anyway so it's ok.
self.assertEquals(40, len(msg.get_string()))
msg.rewind()
pub = DSSKey(data=str(key))
self.assert_(pub.verify_ssh_sig('ice weasels', msg))
示例2: test_9_sign_dss
# 需要导入模块: from paramiko import DSSKey [as 别名]
# 或者: from paramiko.DSSKey import verify_ssh_sig [as 别名]
def test_9_sign_dss(self):
# verify that the dss private key can sign and verify
key = DSSKey.from_private_key_file(test_path('test_dss.key'))
msg = key.sign_ssh_data(b'ice weasels')
self.assertTrue(type(msg) is Message)
msg.rewind()
self.assertEqual('ssh-dss', msg.get_text())
# can't do the same test as we do for RSA, because DSS signatures
# are usually different each time. but we can test verification
# anyway so it's ok.
self.assertEqual(40, len(msg.get_binary()))
msg.rewind()
pub = DSSKey(data=key.asbytes())
self.assertTrue(pub.verify_ssh_sig(b'ice weasels', msg))