Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know the options that I need in order to produce RFC 4716 format ssh keys (ie, what you would get if you ran ssh-keygen on *nix)? I ask because I need to programatically generate keypairs on windows. I can't use ssh-keygen via cygwin b/c I need to ultimately deploy this script, and the puttygen.exe is interactive-only. Apparently, KF => 'SSH' is not enough:
use Crypt::RSA; my $rsa = new Crypt::RSA; my ($public, $private) = $rsa->keygen ( Identity => 'Lord Macbeth <macbeth@glamis.com>', Size => 1024, Password => 'A day so foul & fair', Verbosity => 1, KF => 'SSH', Filename => 'mykey' ) or die $rsa->errstr();
help? is there a better module for this?

Replies are listed 'Best First'.
Re: generating ssh2 keypairs with Crypt::RSA?
by oko1 (Deacon) on Oct 12, 2010 at 02:42 UTC

    Well, Crypt::DSA will generate a keypair for you, but it's not going to be in RFC4716 format. A quick Net search brings up the Chilkat module... but that looks like it's proprietary. Have you considered downloading Cygwin and using "ssh-keygen" from there? That might be your best option.


    --
    "Language shapes the way we think, and determines what we can think about."
    -- B. L. Whorf
Re: generating ssh2 keypairs with Crypt::RSA?
by Anonymous Monk on Oct 12, 2010 at 03:13 UTC
Re: generating ssh2 keypairs with Crypt::RSA?
by Anonymous Monk on Oct 12, 2010 at 03:08 UTC
    and the puttygen.exe is interactive-only

    You can always install GnuPG

    Apparently, KF => 'SSH' is not enough

    How did you arrive at that conclusion? It works for me

      How did you arrive at that conclusion? It works for me

      Sorry, duh, of course it works, but its not SSH2 format, obviously