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