Skip to content

Commit

Permalink
Re-adding Elliptic Curve support. It appears doing blind merges isn't…
Browse files Browse the repository at this point in the history
… always smart.
  • Loading branch information
user committed Oct 25, 2016
1 parent 6b02dd4 commit 653de65
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 68 deletions.
14 changes: 10 additions & 4 deletions src/twisted/conch/client/knownhosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from twisted.python.util import FancyEqMixin
from twisted.conch.interfaces import IKnownHostEntry
from twisted.conch.error import HostKeyChanged, UserRejectedKey, InvalidEntry
from twisted.conch.ssh.keys import Key, BadKeyError
from twisted.conch.ssh.keys import Key, BadKeyError, FingerprintFormats
from twisted.python.compat import nativeString


Expand Down Expand Up @@ -482,13 +482,19 @@ def promptResponse(response):
return response
else:
raise UserRejectedKey()

keytype = key.type()

if keytype is "EC":
keytype = "ECDSA"

prompt = (
"The authenticity of host '%s (%s)' "
"can't be established.\n"
"RSA key fingerprint is %s.\n"
"%s key fingerprint is SHA256:%s.\n"
"Are you sure you want to continue connecting (yes/no)? " %
(nativeString(hostname), nativeString(ip),
key.fingerprint()))
(nativeString(hostname), nativeString(ip), keytype,
key.fingerprint(format=FingerprintFormats.SHA256_BASE64)))
proceed = ui.prompt(prompt.encode(sys.getdefaultencoding()))
return proceed.addCallback(promptResponse)
return hhk.addCallback(gotHasKey)
Expand Down
Loading

0 comments on commit 653de65

Please sign in to comment.