From 0e65740c2dfa16b69eafbeef0496da8949996ab1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 7 Nov 2013 11:33:46 -0800 Subject: [PATCH] Support ecdsa-sha2-nistp256 SSH keys Summary: See discussion in . (If we end up with more than like 5 of these we should probably make this a warning or something instead, the only goal is to prevent user error.) Test Plan: {F79196} {F79197} Reviewers: btrahan, chad Reviewed By: chad CC: aran, enko Differential Revision: https://secure.phabricator.com/D7522 --- .../panel/PhabricatorSettingsPanelSSHKeys.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index 908671669e..53e7fe671d 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -81,9 +81,17 @@ final class PhabricatorSettingsPanelSSHKeys if (!$errors) { list($type, $body, $comment) = $parts; - if (!preg_match('/^ssh-dsa|ssh-rsa$/', $type)) { + + $recognized_keys = array( + 'ssh-dsa', + 'ssh-rsa', + 'ecdsa-sha2-nistp256', + ); + + if (!in_array($type, $recognized_keys)) { $e_key = pht('Invalid'); - $errors[] = pht('Public key should be "ssh-dsa" or "ssh-rsa".'); + $type_list = implode(', ', $recognized_keys); + $errors[] = pht('Public key should be one of: %s', $type_list); } else { $key->setKeyType($type); $key->setKeyBody($body);