changeset 8639:c3ae916ef55f

ssh: support ssh-ed448 keys https://tools.ietf.org/html/rfc8709 defines both "ssh-ed25519" and "ssh-ed448" - let's keep it simple and feature complete and support both types.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 28 Sep 2020 14:10:41 +0200
parents 0e33f4ec0617
children 12824a48192d
files kallithea/lib/ssh.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/ssh.py	Mon Sep 28 14:17:10 2020 +0200
+++ b/kallithea/lib/ssh.py	Mon Sep 28 14:10:41 2020 +0200
@@ -52,7 +52,7 @@
     >>> parse_pub_key('''abc AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ''')
     Traceback (most recent call last):
     ...
-    kallithea.lib.ssh.SshKeyParseError: Invalid SSH key - it must start with key type 'ssh-rsa', 'ssh-dss', or 'ssh-ed25519'
+    kallithea.lib.ssh.SshKeyParseError: Invalid SSH key - it must start with key type 'ssh-rsa', 'ssh-dss', 'ssh-ed448', or 'ssh-ed25519'
     >>> parse_pub_key('''ssh-rsa  AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ''')
     Traceback (most recent call last):
     ...
@@ -91,8 +91,8 @@
         raise SshKeyParseError(_("Invalid SSH key - it must have both a key type and a base64 part, like 'ssh-rsa ASRNeaZu4FA...xlJp='"))
 
     keytype, keyvalue, comment = (parts + [''])[:3]
-    if keytype not in ('ssh-rsa', 'ssh-dss', 'ssh-ed25519'):
-        raise SshKeyParseError(_("Invalid SSH key - it must start with key type 'ssh-rsa', 'ssh-dss', or 'ssh-ed25519'"))
+    if keytype not in ('ssh-rsa', 'ssh-dss', 'ssh-ed448', 'ssh-ed25519'):
+        raise SshKeyParseError(_("Invalid SSH key - it must start with key type 'ssh-rsa', 'ssh-dss', 'ssh-ed448', or 'ssh-ed25519'"))
 
     if re.search(r'[^a-zA-Z0-9+/=]', keyvalue):  # make sure b64decode doesn't stop at the first invalid character and skip the rest
         raise SshKeyParseError(_("Invalid SSH key - unexpected characters in base64 part %r") % keyvalue)