Created
November 7, 2022 20:14
-
-
Save njofce/0fb3eb0a7f4c88668e6f82f4f775e1d1 to your computer and use it in GitHub Desktop.
Generate ECDSA key pair
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
#!/usr/bin/env bash | |
set -e | |
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key | |
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub | |
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv | |
echo "Private Key: \n" | |
cat priv | |
echo "Public Key: \n" | |
cat priv | |
rm key pub priv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment