Last active
April 19, 2017 13:32
-
-
Save vkobel/52048e12d8930ef63930949a717ddcbf to your computer and use it in GitHub Desktop.
Convert hex public key (ECDSA, secp256k1) to pem format
This file contains hidden or 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
#!/bin/bash | |
readonly ASN1_PREFIX='3056301006072a8648ce3d020106052b8104000a03420004' | |
if [ -z "$1" ] | |
then | |
echo "Hex key should be supplied as first argument!" | |
exit 1 | |
fi | |
key=$ASN1_PREFIX$1 | |
echo -n $key | xxd -r -p | openssl ec -inform der -pubin -pubout -outform pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment