aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ecdh
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-11-28 09:30:49 -0500
committerJack Lloyd <[email protected]>2020-11-28 09:30:49 -0500
commit56fb90630cb4af156df16e78bbbc382ac7cec619 (patch)
tree39bbdd5446aeda1939d625d485399cc70dc908c8 /src/lib/pubkey/ecdh
parentf75b797ca1632804205500fcf4f2f1f9005900fb (diff)
parent0c76f906a3083b9f4662e89508325e1dd474c7c3 (diff)
Merge GH #2520 Add Private_Key::public_key
Diffstat (limited to 'src/lib/pubkey/ecdh')
-rw-r--r--src/lib/pubkey/ecdh/ecdh.cpp5
-rw-r--r--src/lib/pubkey/ecdh/ecdh.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/pubkey/ecdh/ecdh.cpp b/src/lib/pubkey/ecdh/ecdh.cpp
index e7e49a74f..74c385fcf 100644
--- a/src/lib/pubkey/ecdh/ecdh.cpp
+++ b/src/lib/pubkey/ecdh/ecdh.cpp
@@ -17,6 +17,11 @@
namespace Botan {
+std::unique_ptr<Public_Key> ECDH_PrivateKey::public_key() const
+ {
+ return std::unique_ptr<Public_Key>(new ECDH_PublicKey(domain(), public_point()));
+ }
+
namespace {
/**
diff --git a/src/lib/pubkey/ecdh/ecdh.h b/src/lib/pubkey/ecdh/ecdh.h
index f88955ac4..4be7e656c 100644
--- a/src/lib/pubkey/ecdh/ecdh.h
+++ b/src/lib/pubkey/ecdh/ecdh.h
@@ -89,6 +89,8 @@ class BOTAN_PUBLIC_API(2,0) ECDH_PrivateKey final : public ECDH_PublicKey,
const BigInt& x = 0) :
EC_PrivateKey(rng, domain, x) {}
+ std::unique_ptr<Public_Key> public_key() const override;
+
std::vector<uint8_t> public_value() const override
{ return ECDH_PublicKey::public_value(PointGFp::UNCOMPRESSED); }