Last active
July 18, 2024 17:12
-
-
Save csobankesmarki/ea5e46a5af68623f1d9b442af1528225 to your computer and use it in GitHub Desktop.
Convert OpenSSH ED25519 to OpenSSL ED25519
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
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
Thank you, this is very interresting! I added this to my stared repo and installed it locally.
I also did conversion in bash scripting the other way around (by reading fucking openssh private format):
Convert openssl private ed25519 key format to openssh private ed25519 key format:
To Convert openssl public ed25519 key format to openssh public ed25519 key format:
In case it’s usefull for people who cannot install your python app.