简体   繁体   English

使用ed25519密钥从nodejs SSH到服务器

[英]SSH to a server from nodejs with ed25519 key

I tried using the module ssh2 by mscdex which, but it doesn't support the key ed25519. 我尝试使用mscdex的模块ssh2,但它不支持密钥ed25519。

var Connection = require('ssh2');
var c = new Connection();
c.connect({
    host: host,
    port: port, 
    username: user,
    privateKey: require('fs').readFileSync(keyPath)
});

The error is: 错误是:

node_modules/ssh2/lib/client.js:225                                               
      throw new Error('Cannot parse privateKey: ' + privKeyInfo.message);                      
      ^                                                                                        

Error: Cannot parse privateKey: Unsupported key format                                         
    at Client.connect

I also tried using node-sshpk because I saw that it supports ed25519, but I didn't find a way to connect to the linux server. 我也尝试使用node-sshpk,因为我看到它支持ed25519,但我没有找到连接linux服务器的方法。

Does anyone know a way to connect to the server using ed25519 keys? 有没有人知道使用ed25519密钥连接服务器的方法?

There is an open issue in the ssh2 package. ssh2包中存在一个未解决的问题


If you want to use the specific ed25519 format, look at the npm package ed25519 . 如果要使用特定的ed25519格式,请查看npm包ed25519

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM