You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2019/12/06 12:54:47 UTC

[cloudstack] branch master updated: ssh: Add support for ecdsa and ed25519 public keys (#3740)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new e56fa31  ssh: Add support for ecdsa and ed25519 public keys (#3740)
e56fa31 is described below

commit e56fa313793855800a5174fdb5cf79a96d1ba519
Author: Kai Takahashi <39...@users.noreply.github.com>
AuthorDate: Fri Dec 6 21:54:35 2019 +0900

    ssh: Add support for ecdsa and ed25519 public keys (#3740)
    
    See #3705
    Fixes: #3705
    
    Signed-off-by: Kai Takahashi <k-...@creationline.com>
---
 utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java b/utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java
index f80baaf..f25881c 100644
--- a/utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java
+++ b/utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java
@@ -88,7 +88,13 @@ public class SSHKeysHelper {
         if (!keyMaterial.contains(" "))
             keyMaterial = new String(Base64.decodeBase64(keyMaterial.getBytes()));
 
-        if ((!keyMaterial.startsWith("ssh-rsa") && !keyMaterial.startsWith("ssh-dss")) || !keyMaterial.contains(" "))
+        if ((!keyMaterial.startsWith("ssh-rsa")
+             && !keyMaterial.startsWith("ssh-dss")
+             && !keyMaterial.startsWith("ecdsa-sha2-nistp256")
+             && !keyMaterial.startsWith("ecdsa-sha2-nistp384")
+             && !keyMaterial.startsWith("ecdsa-sha2-nistp521")
+             && !keyMaterial.startsWith("ssh-ed25519"))
+             || !keyMaterial.contains(" "))
             return null;
 
         String[] key = keyMaterial.split(" ");