本文整理汇总了Python中twisted.conch.ssh.keys.Key._fromECComponents方法的典型用法代码示例。如果您正苦于以下问题:Python Key._fromECComponents方法的具体用法?Python Key._fromECComponents怎么用?Python Key._fromECComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.conch.ssh.keys.Key
的用法示例。
在下文中一共展示了Key._fromECComponents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_verifyNonPresentECKey
# 需要导入模块: from twisted.conch.ssh.keys import Key [as 别名]
# 或者: from twisted.conch.ssh.keys.Key import _fromECComponents [as 别名]
def test_verifyNonPresentECKey(self):
"""
Set up a test to verify an ECDSA key that isn't present.
Return a 3-tuple of the UI, a list set up to collect the result
of the verifyHostKey call, and the sample L{KnownHostsFile} being used.
"""
ecObj = Key._fromECComponents(
x=keydata.ECDatanistp256['x'],
y=keydata.ECDatanistp256['y'],
privateValue=keydata.ECDatanistp256['privateValue'],
curve=keydata.ECDatanistp256['curve']
)
hostsFile = self.loadSampleHostsFile()
ui = FakeUI()
l = []
d = hostsFile.verifyHostKey(
ui, b"sample-host.example.com", b"4.3.2.1", ecObj)
d.addBoth(l.append)
self.assertEqual([], l)
self.assertEqual(
ui.promptText,
b"The authenticity of host 'sample-host.example.com (4.3.2.1)' "
b"can't be established.\n"
b"ECDSA key fingerprint is "
b"SHA256:fJnSpgCcYoYYsaBbnWj1YBghGh/QTDgfe4w4U5M5tEo=.\n"
b"Are you sure you want to continue connecting (yes/no)? ")