StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
ecdh.hxx
1#pragma once
2
3#include <StormByte/crypto/secret/generic.hxx>
4#include <StormByte/crypto/keypair/ecdh.hxx>
5
10namespace StormByte::Crypto::Secret {
15 class STORMBYTE_CRYPTO_PUBLIC ECDH final: public Generic {
16 public:
21 inline ECDH(KeyPair::Generic::PointerType keypair):
22 Generic(Type::ECDH, keypair) {}
23
28 inline ECDH(const KeyPair::ECDH& keypair):
29 Generic(Type::ECDH, keypair.Clone()) {}
30
35 inline ECDH(KeyPair::ECDH&& keypair):
36 Generic(Type::ECDH, keypair.Move()) {}
37
42 ECDH(const ECDH& other) = default;
43
48 ECDH(ECDH&& other) noexcept = default;
49
53 ~ECDH() noexcept = default;
54
60 ECDH& operator=(const ECDH& other) = default;
61
67 ECDH& operator=(ECDH&& other) noexcept = default;
68
73 inline PointerType Clone() const noexcept override {
74 return std::make_shared<ECDH>(*this);
75 }
76
81 inline PointerType Move() noexcept override {
82 return std::make_shared<ECDH>(std::move(*this));
83 }
84
85 private:
91 std::optional<std::string> DoShare(const std::string& peerPublicKey) const noexcept override;
92 };
93}
A ECDH keypair class.
Definition ecdh.hxx:14
A generic secret class.
Definition ecdh.hxx:15
~ECDH() noexcept=default
Virtual destructor.
ECDH(const ECDH &other)=default
Copy constructor.
PointerType Move() noexcept override
Move the ECDH secret.
Definition ecdh.hxx:81
ECDH(KeyPair::Generic::PointerType keypair)
Constructor.
Definition ecdh.hxx:21
ECDH(const KeyPair::ECDH &keypair)
Constructor.
Definition ecdh.hxx:28
ECDH(ECDH &&other) noexcept=default
Move constructor.
ECDH(KeyPair::ECDH &&keypair)
Constructor.
Definition ecdh.hxx:35
A generic secret class.
Definition generic.hxx:23