Skip to content

Instantly share code, notes, and snippets.

@csobankesmarki
Last active July 18, 2024 17:12
Show Gist options
  • Save csobankesmarki/ea5e46a5af68623f1d9b442af1528225 to your computer and use it in GitHub Desktop.
Save csobankesmarki/ea5e46a5af68623f1d9b442af1528225 to your computer and use it in GitHub Desktop.
Convert OpenSSH ED25519 to OpenSSL ED25519
(printf \\x30\\x2e\\x02\\x01\\x00\\x30\\x05\\x06\\x03\\x2b\\x65\\x70\\x04\\x22\\x04\\x20;egrep -v "^-" | tr -d '\n' | base64 -d | dd bs=161 skip=1 2>/dev/null | dd bs=32 count=1 2>/dev/null) | openssl pkey -inform der -outform pem
(printf \\x30\\x2a\\x30\\x05\\x06\\x03\\x2b\\x65\\x70\\x03\\x21\\00;egrep -v "^-" | tr -d '\n' | base64 -d | dd bs=62 skip=1 2>/dev/null | dd bs=32 count=1 2>/dev/null) | openssl pkey -pubin -inform der -pubout -outform pem
@domo141
Copy link

domo141 commented Feb 2, 2023

These 2 shell scripts to convert from openssl to openssh key formats are great stuff, have to copy those.

Just note that printf '\x00' does not work in all posix shells, (e.g. /bin/dash does not support), \000 etc, octal versions works in those...

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