EC Cryptography Tutorials - Herong's Tutorial Examples - v1.03, by Herong Yang
EC Key File with Curve Name
This section provides a tutorial example on the EC private key file with curve name only. Actuall domain parameters are not stored in the key file.
If your private key is generated from a named elliptic curve, you can store the curve name instead of domain parameters to reduce the key file size.
Let's generate another EC private key with OpenSSL and keep the curve name only:
herong> openssl ecparam -genkey -name secp256k1 \ -out ec_key_with_name.pem herong> type ec_key_with_name.pem -----BEGIN EC PARAMETERS----- BgUrgQQACg== -----END EC PARAMETERS----- -----BEGIN EC PRIVATE KEY----- MHQCAQEEICT5ZF/xctNhmSRpX9c05KnCwQDxHLUWz0CK9rSZQKbqoAcGBSuBBAAK oUQDQgAEvQinrrTC12K1irns23vh7VR//Z/hXR0Yx545HNDZ/hm4rhRjj1T3X3Pe KITUKm1oUC1zs5nphvkN+4mhNI14ew== -----END EC PRIVATE KEY----- herong> openssl ec -in ec_key_with_name .pem -noout -text read EC key Private-Key: (256 bit) priv: 24:f9:64:5f:f1:72:d3:61:99:24:69:5f:d7:34:e4: a9:c2:c1:00:f1:1c:b5:16:cf:40:8a:f6:b4:99:40: a6:ea pub: 04:bd:08:a7:ae:b4:c2:d7:62:b5:8a:b9:ec:db:7b: e1:ed:54:7f:fd:9f:e1:5d:1d:18:c7:9e:39:1c:d0: d9:fe:19:b8:ae:14:63:8f:54:f7:5f:73:de:28:84: d4:2a:6d:68:50:2d:73:b3:99:e9:86:f9:0d:fb:89: a1:34:8d:78:7b ASN1 OID: secp256k1
As you can see, domain parameters are replaced with the curve name: secp256k1.
ec_key_with_name.pem is a valid EC private key, as long as your application knows domain parameters of the given curve name: secp256k1.
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)