Skip to content

Instantly share code, notes, and snippets.

@GabLeRoux
Created July 31, 2019 01:35
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabLeRoux/d6d5fc1ee1cc8583f4dfe9aa4ed2bd05 to your computer and use it in GitHub Desktop.
Save GabLeRoux/d6d5fc1ee1cc8583f4dfe9aa4ed2bd05 to your computer and use it in GitHub Desktop.
Convert OPENSSH to RSA from command line

Convert openssh keys to rsa keys

from something that starts with

-----BEGIN OPENSSH PRIVATE KEY-----

to something that starts with

-----BEGIN RSA PRIVATE KEY-----

🎉

#!/usr/bin/env bash
set -e
set -x
original_key=$1
puttygen_destinaton=${original_key}_puttygen
rsa_destinaton=${original_key}_rsa
# FROM OPENSSH to SSH2 ENCRYPTED
puttygen $original_key -O private-sshcom -o $puttygen_destinaton
# FROM SSH2 ENCRYPTED format to RSA
ssh-keygen -i -f $puttygen_destinaton > $rsa_destinaton
@jim-binxhealth
Copy link

It worked! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment