EC Cryptography Tutorials - Herong's Tutorial Examples - v1.02, by Dr. Herong Yang
Create EC Public Key File
This section provides a tutorial example on how to extract the public key out of an EC private key file with the 'openssl ec -pubout' command.
As you can see from previous tutorials, the EC public key is stored together with the private key in a private key file.
But you need to extract the public key out into a separate file, so that you send it to others publicly. Here is how you can do it with the "openssl ec -pubout" command:
herong> openssl ecparam -genkey -name secp256k1 \ -out ec_key.pem -param_enc explicit herong> openssl ec -in ec_key.pem -pubout -out ec_key_public.pem read EC key writing EC key herong> type ec_key_public.pem -----BEGIN PUBLIC KEY----- MIH1MIGuBgcqhkjOPQIBMIGiAgEBMCwGByqGSM49AQECIQD///////////////// ///////////////////+///8LzAGBAEABAEHBEEEeb5mfvncu6xVoGKVzocLBwKb /NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIh AP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABPt7sLuj+VfF 9LXLE072LbdLPVULdneOe+oLW1bVNA01gQd5vb4PTpkNVm0L+AIO09D9m7lUQ0ch qwCa1sMd5Go= -----END PUBLIC KEY-----
Table of Contents
Geometric Introduction to Elliptic Curves
Algebraic Introduction to Elliptic Curves
Abelian Group and Elliptic Curves
Discrete Logarithm Problem (DLP)
Generators and Cyclic Subgroups
tinyec - Python Library for ECC
EC Private and Public Key Pair
EC Private Key Example - secp256k1
Generate secp256k1 Keys with OpenSSL
ECDH (Elliptic Curve Diffie-Hellman) Key Exchange
ECDSA (Elliptic Curve Digital Signature Algorithm)