ソースを参照

Add extraction of actual key from public key file

j433866 6 年 前
コミット
d56ff0825a
1 ファイル変更7 行追加0 行削除
  1. 7 0
      src/core/operations/ParseSSHHostKey.mjs

+ 7 - 0
src/core/operations/ParseSSHHostKey.mjs

@@ -80,6 +80,13 @@ class ParseSSHHostKey extends Operation {
      * @returns {byteArray}
      */
     convertKeyToBinary(inputKey, inputFormat) {
+        const keyPattern = new RegExp(/^(?:[ssh]|[ecdsa-sha2])\S+\s+(\S*)/),
+            keyMatch = inputKey.match(keyPattern);
+
+        if (keyMatch) {
+            inputKey = keyMatch[1];
+        }
+
         if (inputFormat === "Auto") {
             inputFormat = this.detectKeyFormat(inputKey);
         }