diff options
author | René Korthaus <[email protected]> | 2017-12-19 18:29:41 +0100 |
---|---|---|
committer | René Korthaus <[email protected]> | 2017-12-19 18:29:41 +0100 |
commit | f19ab7155d746fde5ce8b811576abb5a6ee0ff28 (patch) | |
tree | 4a24aec13ea45b76ab4bd6bc3f5a3180da42f927 /src/lib/pubkey/ecc_key/ecc_key.cpp | |
parent | 1e9db1f1d3d4d04368a7f7da490230deb5b6431e (diff) |
Always set domain encoding correctly when loading an ECC key
When loading an ECC key from file, the domain encoding was always
set to explicit instead of depending on the encoded key file read.
This resulted in different encodings and therefore different
fingerprints of the same key when encoding the same key twice
(once after generation, once after re-reading it).
Diffstat (limited to 'src/lib/pubkey/ecc_key/ecc_key.cpp')
-rw-r--r-- | src/lib/pubkey/ecc_key/ecc_key.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp index 962cd3f45..6adb806ef 100644 --- a/src/lib/pubkey/ecc_key/ecc_key.cpp +++ b/src/lib/pubkey/ecc_key/ecc_key.cpp @@ -163,7 +163,11 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id, bool with_modular_inverse) { m_domain_params = EC_Group(alg_id.parameters); - m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT; + + if (!domain().get_oid().empty()) + m_domain_encoding = EC_DOMPAR_ENC_OID; + else + m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT; OID key_parameters; secure_vector<uint8_t> public_key_bits; |