ericvicenti / ssh-keygen

Generates SSH key-pairs in node.js
MIT License
67 stars 49 forks source link

Bit Length Option #3

Open simon-p-r opened 10 years ago

simon-p-r commented 10 years ago

Hi

Nice module however I can't seem to leave passphrase empty and configure the bits length -is that right?

Thanks Simon

ericvicenti commented 10 years ago

Empty passphrase is the default, or you can pass null/false/undefined .

Bit length is not configurable, but you could add an option for it: https://github.com/ericvicenti/ssh-keygen/blob/master/src/ssh-keygen.js#L50

I'd be happy to merge and release any upgrades you've got, adding this as an opt would be pretty easy.

Also, check out the pem module. It is a more mature alternative which I stumbled upon after writing this module.

simon-p-r commented 10 years ago

Thanks

I have tried passing null, false or undefined to passphrase but it doesn't work. I have attached code;

var keygen = require('ssh-keygen'); var fs = require('fs'); var config = { comment: 'wonderful comment', password: 'testing1234', location: '/path/to/store/key', read: true };

var comment = config.comment; var password = config.password; var location = config.location; var read = config.read;

keygen({location: location,comment:comment, password: password, read: read}, function(err, out){ console.log('SSH keys being created!'); fs.writeFile(location, out.key, function (err) { if (err) throw err; console.log('Private key created!'); fs.writeFile(location + '.pub', out.pubKey, function (err) { if (err) throw err; console.log('Public key created!'); }); }); });

Maybe you can show me how to override passphrase as trying to make it generic?

Cheers Simon