Skip to content

Commit e56fa31

Browse files
cl-k-takahashiyadvr
authored andcommitted
ssh: Add support for ecdsa and ed25519 public keys (#3740)
See #3705 Fixes: #3705 Signed-off-by: Kai Takahashi <k-takahashi@creationline.com>
1 parent 828405d commit e56fa31

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

utils/src/main/java/com/cloud/utils/ssh/SSHKeysHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ public static String getPublicKeyFromKeyMaterial(String keyMaterial) {
8888
if (!keyMaterial.contains(" "))
8989
keyMaterial = new String(Base64.decodeBase64(keyMaterial.getBytes()));
9090

91-
if ((!keyMaterial.startsWith("ssh-rsa") && !keyMaterial.startsWith("ssh-dss")) || !keyMaterial.contains(" "))
91+
if ((!keyMaterial.startsWith("ssh-rsa")
92+
&& !keyMaterial.startsWith("ssh-dss")
93+
&& !keyMaterial.startsWith("ecdsa-sha2-nistp256")
94+
&& !keyMaterial.startsWith("ecdsa-sha2-nistp384")
95+
&& !keyMaterial.startsWith("ecdsa-sha2-nistp521")
96+
&& !keyMaterial.startsWith("ssh-ed25519"))
97+
|| !keyMaterial.contains(" "))
9298
return null;
9399

94100
String[] key = keyMaterial.split(" ");

0 commit comments

Comments
 (0)