changeset 7988:690e7a035521 stable

ssh: add doctest showing incorrect handling of ed25519 keys This doctest just demonstrates that ed25519 keys are not treated correctly by parse_pub_key(). A subsequent commit will actually fix it.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Fri, 06 Dec 2019 21:13:41 +0100
parents 22321950133a
children e7be0cbb7850
files kallithea/lib/ssh.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/ssh.py	Sat Nov 30 20:47:01 2019 +0100
+++ b/kallithea/lib/ssh.py	Fri Dec 06 21:13:41 2019 +0100
@@ -66,6 +66,11 @@
     >>> parse_pub_key(''' ssh-rsa  AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ== and a comment
     ... ''')
     ('ssh-rsa', '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x0bThis is fake!', 'and a comment\n')
+    >>> # FIXME below test shows incorrect behavior -- to be fixed in a subsequent commit
+    >>> parse_pub_key('''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP1NA2kBQIKe74afUXmIWD9ByDYQJqUwW44Y4gJOBRuo''')
+    Traceback (most recent call last):
+    ...
+    SshKeyParseError: Incorrect SSH key - base64 part is not 'ssh-ed25519' as claimed but 'ssh-ed25519'
     """
     if not ssh_key:
         raise SshKeyParseError(_("SSH key is missing"))