jpsaraiva has asked for the wisdom of the Perl Monks concerning the following question:
Hello
On Windows, I'm using Crypt::PK::RSA to generate key pairs like this:
use Crypt::PK::RSA; my $pk = Crypt::PK::RSA->new(); $pk->generate_key(256, 65537); my $private_pem = $pk->export_key_pem('private'); my $public_pem = $pk->export_key_pem('public');
Private key format is fine. Public key is generated like this:
-----BEGIN RSA PUBLIC KEY----- ... -----END RSA PUBLIC KEY-----
Since I need to add this key to authorized_keys files it needs to be in a ssh-rsa format.
Can easly be done using ssh-keygen to convert:
$ ssh-keygen -y -f privatekey > publickey
I found this thread explaining the process and having several solutions none perl based.
And all end up being dependent on ssh-keygen or open-ssl both not natively available on Windows
Does anyone know how to do this only in perl or if it is even possible?
Back to
Seekers of Perl Wisdom