StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
ed25519.hxx
1#pragma once
2
3#include <StormByte/crypto/signer/generic.hxx>
4#include <StormByte/crypto/keypair/ed25519.hxx>
5
10namespace StormByte::Crypto::Signer {
15 class STORMBYTE_CRYPTO_PUBLIC ED25519 final: public Generic {
16 public:
22 inline ED25519(KeyPair::Generic::PointerType keypair):
23 Generic(Type::ED25519, keypair) {}
24
30 inline ED25519(const KeyPair::ED25519& keypair):
31 Generic(Type::ED25519, keypair) {}
32
38 inline ED25519(KeyPair::ED25519&& keypair):
39 Generic(Type::ED25519, keypair) {}
40
45 ED25519(const ED25519& other) = default;
46
51 ED25519(ED25519&& other) noexcept = default;
52
56 ~ED25519() noexcept = default;
57
63 ED25519& operator=(const ED25519& other) = default;
64
70 ED25519& operator=(ED25519&& other) noexcept = default;
71
76 PointerType Clone() const noexcept override {
77 return std::make_shared<ED25519>(*this);
78 }
79
84 PointerType Move() noexcept override {
85 return std::make_shared<ED25519>(std::move(*this));
86 }
87
88 private:
96 bool DoSign(std::span<const std::byte> input, Buffer::WriteOnly& output) const noexcept override;
97
104 Buffer::Consumer DoSign(Buffer::Consumer consumer, ReadMode mode) const noexcept override;
105
112 bool DoVerify(std::span<const std::byte> input, const std::string& signature) const noexcept override;
120 bool DoVerify(Buffer::Consumer consumer, const std::string& signature, ReadMode mode) const noexcept override;
121 };
122}
An ED25519 keypair class.
Definition ed25519.hxx:14
A generic signer signer class.
Definition ed25519.hxx:15
ED25519(ED25519 &&other) noexcept=default
Move constructor.
ED25519(const ED25519 &other)=default
Copy constructor.
ED25519(KeyPair::Generic::PointerType keypair)
Constructor.
Definition ed25519.hxx:22
ED25519(const KeyPair::ED25519 &keypair)
Constructor.
Definition ed25519.hxx:30
ED25519(KeyPair::ED25519 &&keypair)
Constructor.
Definition ed25519.hxx:38
~ED25519() noexcept=default
Virtual destructor.
PointerType Move() noexcept override
Move the ED25519 signer.
Definition ed25519.hxx:84
A generic signer class.
Definition generic.hxx:27