Merge pull request #5983 from librick/feature_sk_ecc

luci-mod-system: allow ecdsa-sk and ed25519-sk key types
This commit is contained in:
Jo-Philipp Wich 2022-09-30 10:08:10 +02:00 committed by GitHub
commit 0c5d7dd8d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ var SSHPubkeyDecoder = baseclass.singleton({
decode: function(s)
{
var parts = s.trim().match(/^((?:(?:^|,)[^ =,]+(?:=(?:[^ ",]+|"(?:[^"\\]|\\.)*"))?)+ +)?(ssh-dss|ssh-rsa|ssh-ed25519|ecdsa-sha2-nistp[0-9]+) +([^ ]+)( +.*)?$/);
var parts = s.trim().match(/^((?:(?:^|,)[^ =,]+(?:=(?:[^ ",]+|"(?:[^"\\]|\\.)*"))?)+ +)?(ssh-dss|ssh-rsa|ssh-ed25519|ecdsa-sha2-nistp[0-9]+|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) +([^ ]+)( +.*)?$/);
if (!parts)
return null;
@ -100,6 +100,12 @@ var SSHPubkeyDecoder = baseclass.singleton({
case 'ecdsa-sha2':
return { type: 'ECDSA', curve: curve, comment: comment, options: options, fprint: fprint, src: s };
case 'sk-ecdsa-sha2-nistp256@openssh.com':
return { type: 'ECDSA-SK', curve: 'NIST P-256', comment: comment, options: options, fprint: fprint, src: s };
case 'sk-ssh-ed25519@openssh.com':
return { type: 'EdDSA-SK', curve: 'Curve25519', comment: comment, options: options, fprint: fprint, src: s };
default:
return null;
}