How to convert ssh keys between different formats

Solution Verified - Updated -

Issue

  • We received an ssh public key that is in an odd format we don't know what to do with. Instead of the usual 1-line key, e.g. "ssh-rsa AAAAB3NzaC1yc2EA...rItP3PZn5Dtihz2LyFkufs= rsaw@sawzall", the key spans multiple lines and looks like a certificate, e.g.:

    ---- BEGIN SSH2 PUBLIC KEY ----
    Comment: "rsa-key-20100925"
    AAAAB3NzaC1yc2EAAAADAQABAAAAYQC97noqdutsU+YqIeSlZNI9/ApXZJB0b6yAz2wk36
    z98OscQa5YstNLGiuyIrOPeHAPVf0sK0+ndyZ/3+2hb072mXDOo7EmdPNkqudiVxqPHnT+
    u93GzzZvBaIc/pMp1AE=
    ---- END SSH2 PUBLIC KEY ----
    

    Adding these lines to ~/.ssh/authorized_keys does not allow the remote ssh client to connect.

Environment

  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.