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


Python DSSKey.verify_ssh_sig方法代码示例

本文整理汇总了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))
开发者ID:StefanKjartansson,项目名称:paramiko,代码行数:16,代码来源:test_pkey.py

示例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))
开发者ID:AlexanderChernikov,项目名称:paramiko,代码行数:16,代码来源:test_pkey.py


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