Skip to content

Commit 0e65740

Browse files
author
epriestley
committed
Support ecdsa-sha2-nistp256 SSH keys
Summary: See discussion in <https://github.com/facebook/phabricator/issues/430>. (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
1 parent 038f532 commit 0e65740

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,17 @@ public function processRequest(AphrontRequest $request) {
8181

8282
if (!$errors) {
8383
list($type, $body, $comment) = $parts;
84-
if (!preg_match('/^ssh-dsa|ssh-rsa$/', $type)) {
84+
85+
$recognized_keys = array(
86+
'ssh-dsa',
87+
'ssh-rsa',
88+
'ecdsa-sha2-nistp256',
89+
);
90+
91+
if (!in_array($type, $recognized_keys)) {
8592
$e_key = pht('Invalid');
86-
$errors[] = pht('Public key should be "ssh-dsa" or "ssh-rsa".');
93+
$type_list = implode(', ', $recognized_keys);
94+
$errors[] = pht('Public key should be one of: %s', $type_list);
8795
} else {
8896
$key->setKeyType($type);
8997
$key->setKeyBody($body);

0 commit comments

Comments
 (0)