aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/curve25519
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-20 11:01:03 -0500
committerJack Lloyd <[email protected]>2020-11-28 08:03:14 -0500
commit0c76f906a3083b9f4662e89508325e1dd474c7c3 (patch)
treef4c846c132feaaa22c9f5ff5563429671bea0668 /src/lib/pubkey/curve25519
parentb00cd7cea9233b782697f645a5aa54fd59ecacd9 (diff)
Add Private_Key::public_key
Diffstat (limited to 'src/lib/pubkey/curve25519')
-rw-r--r--src/lib/pubkey/curve25519/curve25519.cpp5
-rw-r--r--src/lib/pubkey/curve25519/curve25519.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/pubkey/curve25519/curve25519.cpp b/src/lib/pubkey/curve25519/curve25519.cpp
index 515fdc5e6..a06e700c4 100644
--- a/src/lib/pubkey/curve25519/curve25519.cpp
+++ b/src/lib/pubkey/curve25519/curve25519.cpp
@@ -87,6 +87,11 @@ Curve25519_PrivateKey::Curve25519_PrivateKey(const AlgorithmIdentifier&,
curve25519_basepoint(m_public.data(), m_private.data());
}
+std::unique_ptr<Public_Key> Curve25519_PrivateKey::public_key() const
+ {
+ return std::unique_ptr<Public_Key>(new Curve25519_PublicKey(public_value()));
+ }
+
secure_vector<uint8_t> Curve25519_PrivateKey::private_key_bits() const
{
return DER_Encoder().encode(m_private, OCTET_STRING).get_contents();
diff --git a/src/lib/pubkey/curve25519/curve25519.h b/src/lib/pubkey/curve25519/curve25519.h
index c2f8f42b3..99860630e 100644
--- a/src/lib/pubkey/curve25519/curve25519.h
+++ b/src/lib/pubkey/curve25519/curve25519.h
@@ -88,6 +88,8 @@ class BOTAN_PUBLIC_API(2,0) Curve25519_PrivateKey final : public Curve25519_Publ
secure_vector<uint8_t> private_key_bits() const override;
+ std::unique_ptr<Public_Key> public_key() const override;
+
bool check_key(RandomNumberGenerator& rng, bool strong) const override;
std::unique_ptr<PK_Ops::Key_Agreement>