openssl ecparam -genkey -name prime256v1 -noout -out es256_private_key.pem
生成的标准格式es256私钥示例
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIAhaV62YXNexj9/GY9EUcz25G69/afOiF2Vh0CxYlKRvoAoGCCqGSM49
AwEHoUQDQgAEuXR/yRJaNAAMGC0gaB/5H9f8ySyN5gGP3pUUotZq5UwrFTufXCG3
QC0rLKQpqy8t1/GQU+S2Hsrwf/PvB/o7KQ==
-----END EC PRIVATE KEY-----
openssl pkcs8 -topk8 -nocrypt -in es256_private_key.pem -out es256_pkcs8_private_key.pem
生成的pkcs8格式es256私钥示例
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgCFpXrZhc17GP38Zj
0RRzPbkbr39p86IXZWHQLFiUpG+hRANCAAS5dH/JElo0AAwYLSBoH/kf1/zJLI3m
AY/elRSi1mrlTCsVO59cIbdALSsspCmrLy3X8ZBT5LYeyvB/8+8H+jsp
-----END PRIVATE KEY-----
openssl ec -in es256_pkcs8_private_key.pem -out es256_private_key.pem
生成的标准格式es256私钥示例
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIAhaV62YXNexj9/GY9EUcz25G69/afOiF2Vh0CxYlKRvoAoGCCqGSM49
AwEHoUQDQgAEuXR/yRJaNAAMGC0gaB/5H9f8ySyN5gGP3pUUotZq5UwrFTufXCG3
QC0rLKQpqy8t1/GQU+S2Hsrwf/PvB/o7KQ==
-----END EC PRIVATE KEY-----
openssl ec -in es256_private_key.pem -pubout -out es256_public_key.pem
或
openssl ec -in es256_pkcs8_private_key.pem -pubout -out es256_public_key.pem
生成的公钥示例
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuXR/yRJaNAAMGC0gaB/5H9f8ySyN
5gGP3pUUotZq5UwrFTufXCG3QC0rLKQpqy8t1/GQU+S2Hsrwf/PvB/o7KQ==
-----END PUBLIC KEY-----