aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ecc_key/ecc_key.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-07-23 19:20:04 -0400
committerJack Lloyd <[email protected]>2018-07-23 19:20:04 -0400
commit3ed4e1bcf332493e1132ce45a2ad3c5f8610cfb5 (patch)
tree77bdaedad511975167a100ba891c071fcc656fe6 /src/lib/pubkey/ecc_key/ecc_key.cpp
parent8b5403be46015adb48d1d61e8a886a900d6d4e4f (diff)
In ECC private key encoding, include the optional public key field
Otherwise GnuTLS refuses to parse the private key. Fixes #1634
Diffstat (limited to 'src/lib/pubkey/ecc_key/ecc_key.cpp')
-rw-r--r--src/lib/pubkey/ecc_key/ecc_key.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index 2c23c1b47..767a799bf 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -147,8 +147,10 @@ secure_vector<uint8_t> EC_PrivateKey::private_key_bits() const
return DER_Encoder()
.start_cons(SEQUENCE)
.encode(static_cast<size_t>(1))
- .encode(BigInt::encode_1363(m_private_key, m_private_key.bytes()),
- OCTET_STRING)
+ .encode(BigInt::encode_1363(m_private_key, m_private_key.bytes()), OCTET_STRING)
+ .start_cons(ASN1_Tag(1), PRIVATE)
+ .encode(m_public_key.encode(PointGFp::Compression_Type::UNCOMPRESSED), BIT_STRING)
+ .end_cons()
.end_cons()
.get_contents();
}