Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Convert pem to ssh-rsa

by hippo (Chancellor)
on Aug 23, 2019 at 12:49 UTC ( #11104895=note: print w/replies, xml ) Need Help??


in reply to Convert pem to ssh-rsa

Since I need to add this key to authorized_keys files it needs to be in a ssh-rsa format

I've not used it myself, but perhaps Net::SSH::Perl::Key->dump_public might do the trick? Just a suggestion.

Replies are listed 'Best First'.
Re^2: Convert pem to ssh-rsa
by jpsaraiva (Novice) on Aug 23, 2019 at 14:33 UTC
    Hello hippo, That worked! Thanks a million.
    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'); use Net::SSH::Perl::Key; my $key = Net::SSH::Perl::Key->read_private('RSA', \$private_pem); say $key->dump_public;

    Output:

    ssh-rsa AAAAB...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104895]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2019-09-21 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (271 votes). Check out past polls.

    Notices?