I've been using OpenSSL as the library of choice. I created ONE set of ECC parameters via
openssl ecparam -out ecparams.pem -name secp521r1 -genkey
I then created two certificate requests, with each certificate generating it's own set of public/private keys.
openssl req -x509 -newkey ec:ecparams.pem -keyform PEM -keyout ECCParam1Key1.pem -out LocalCACert1.pem -outform PEM -days 3650
openssl req -x509 -newkey ec:ecparams.pem -keyform PEM -keyout ECCParam1Key2.pem -out LocalCACert2.pem -outform PEM -days 3650
I was expecting the generated keys to be identical given that the ecparams.pem I used was same and defines everything very specifically:
-----BEGIN EC PARAMETERS-----
BgUrgQQAIw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MIHbAgEBBEF6N74mfCh946N1seJUjTrkmjSTRUKgWGqqCkNlZgwauNQD0dAHRJ9Y
PePxH1eIxOC8jDO85OUUawrP2j4n0kijbqAHBgUrgQQAI6GBiQOBhgAEAewexGGT
v3Dl40W0pTH1sWKPWhohPOo4pMDIbUJDZjtmwY9qvylU5JvtU2yvHBolMzxaHKFl
D0K7+agglcbT58dkASVYeOCK+bt7VrqtdJFuUm+TCr9vOmuWxR3bnVMuZWR+4fh5
z7XcIqRMYXO/gYdEX9bc8hPW/bdD9PDPZwZf62LC
-----END EC PRIVATE KEY-----
private key section. However, when I dump the keys back via
openssl ec -in ECCParam1Key1.pem -text -param_out
openssl ec -in ECCParam1Key2.pem -text -param_out
I can see that they are different despite having the same keying bits. I'm copy-pasting the output below at the end of the question.
Question: It seems not all the parameters are actually "fixed" when the ECC parameters are created; some seem to be fixed but others seem to be randomly generated later one during key creation. Which one(s) are left for generation later? And why is that so?
Thanks
Key dumps follow (these keys are generated just for this demonstration, not used anywhere)
$ openssl ec -in ECCParam1Key1.pem -text -param_out
read EC key
Enter PEM pass phrase:
Private-Key: (521 bit)
priv:
6a:ef:af:bf:73:85:0f:aa:4a:92:7a:1e:ac:da:a8:
38:ee:17:b7:c1:3e:45:ae:2d:e6:ac:4b:d6:18:19:
f6:e5:3a:89:d2:3c:b6:79:4a:2e:e4:30:2e:74:62:
8c:87:b0:88:a7:93:82:57:e3:0c:b9:bf:af:89:ae:
85:94:76:3a:e1
pub:
04:00:db:e4:59:e9:9f:f8:98:9d:31:96:69:af:e0:
89:41:c2:8d:b0:4b:00:b4:83:31:61:c9:96:ba:22:
88:49:5f:cc:25:87:fd:75:a4:21:ac:11:a4:f2:bf:
08:a0:1b:ff:e2:66:5e:08:3e:21:11:d4:0e:a0:32:
7a:17:cb:11:2a:87:e7:01:90:92:7a:b2:26:1b:5b:
84:01:c3:7e:8f:81:1d:35:bc:59:58:ef:e3:95:5e:
72:30:16:8c:f6:06:46:dc:34:fd:b6:33:cf:46:61:
ec:ea:64:3f:90:0a:3a:f9:e6:78:2d:55:32:ab:00:
b2:32:4f:be:48:82:3f:c0:09:9f:6f:cc:de
ASN1 OID: secp521r1
writing EC key
-----BEGIN EC PARAMETERS-----
BgUrgQQAIw==
-----END EC PARAMETERS-----
$ openssl ec -in ECCParam1Key2.pem -text -param_out
read EC key
Enter PEM pass phrase:
Private-Key: (521 bit)
priv:
01:6e:f7:03:33:18:1f:32:82:41:35:ca:11:4b:23:
0d:1f:7b:78:9d:13:39:0a:ec:0a:f2:f9:24:09:06:
f3:86:17:9b:20:05:a6:88:07:ed:0b:e6:c6:83:41:
6c:87:93:57:f7:cd:8f:21:eb:3b:24:46:d4:c6:8f:
ee:95:f5:8d:c3:01
pub:
04:00:bd:ae:f7:8b:c4:39:6c:e0:01:ba:26:9a:a9:
8c:72:85:cf:15:d0:24:78:a0:d2:08:a4:e8:36:f1:
15:cd:c4:00:a9:0d:43:cc:e3:23:c0:cb:18:d3:5c:
a7:9b:84:1e:c1:4e:3a:a8:bf:83:0f:3a:4b:11:c9:
f1:4a:0e:ae:60:27:79:01:2f:d7:44:51:11:d2:b5:
d1:ab:f5:a0:af:e2:eb:1e:7d:c6:b8:60:91:3e:c3:
52:4a:a7:83:12:75:59:62:f2:15:59:b4:0f:0d:52:
46:41:2e:29:00:94:26:49:37:5e:36:29:30:ae:fa:
a9:2b:2b:5b:74:c4:b0:80:03:2e:ea:61:b0
ASN1 OID: secp521r1
writing EC key
-----BEGIN EC PARAMETERS-----
BgUrgQQAIw==
-----END EC PARAMETERS-----