SSH-Keygen NPM软件包提供了未定义的公共和私钥
钥匙的输出对于私钥和公共密钥均未定义 [ssh-keygen] [1]
创建的密钥!
私钥:未定义
公钥:未定义
async generateAndWriteSSHKeyv2() {
return new Promise((resolve, reject) => {
let t = new Date().getTime();
var location = path.join(process.cwd(), `contents/apps/SSHkeys/key_${t}`);
var comment = 'test';
var password = 'test';
var format = 'PEM';
keygen({
location: location,
comment: comment,
password: password,
read: true,
destroy: false,
format: format,
size: 4096,
}, (err, output) => {
if (err) resolve(console.log('Something went wrong: ' + err));
console.log('Keys created!');
console.log('private key: ' + output.key);
console.log('public key: ' + output.pubKey);
resolve({
location,
comment,
password,
read: true,
format,
size: 4096,
output
})
});
})
};
Output for the keys is undefined for both private and public key
[ssh-keygen][1]
Keys created!
private key: undefined
public key: undefined
async generateAndWriteSSHKeyv2() {
return new Promise((resolve, reject) => {
let t = new Date().getTime();
var location = path.join(process.cwd(), `contents/apps/SSHkeys/key_${t}`);
var comment = 'test';
var password = 'test';
var format = 'PEM';
keygen({
location: location,
comment: comment,
password: password,
read: true,
destroy: false,
format: format,
size: 4096,
}, (err, output) => {
if (err) resolve(console.log('Something went wrong: ' + err));
console.log('Keys created!');
console.log('private key: ' + output.key);
console.log('public key: ' + output.pubKey);
resolve({
location,
comment,
password,
read: true,
format,
size: 4096,
output
})
});
})
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
I have found this example,让您与自己的代码进行比较
,请检查是否与该类型的功能获得了相同类型的错误消息。
I have found this example, for you to compare with your own code
Check if you get the same kind of error message with that type of function.