43#include <StormByte/buffer/consumer.hxx>
47#include <StormByte/safe/binary.hxx>
48#include <StormByte/safe/clonable.hxx>
49#include <StormByte/type_traits.hxx>
50#include <StormByte/type_traits/safe.hxx>
151 return DoSign(input, output);
161 template<StormByte::Type::ByteInputRange Range>
194 return DoSign(consumer, mode);
208 inline bool Verify(std::span<const std::byte> input, std::string_view signature)
const noexcept {
209 return DoVerify(input, signature);
219 template<StormByte::Type::ByteInputRange Range>
220 bool Verify(
const Range& input, std::string_view signature)
const {
253 return DoVerify(consumer, signature, mode);
301 virtual bool DoSign(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
326 virtual bool DoVerify(std::span<const std::byte> input, std::string_view signature)
const noexcept = 0;
Abstract keypair.
Definition generic.hxx:113
DSA signer.
Definition dsa.hxx:69
ECDSA signer.
Definition ecdsa.hxx:69
Ed25519 signer.
Definition ed25519.hxx:69
Abstract signer.
Definition generic.hxx:94
virtual ~Generic() noexcept
Destructor.
Generic(enum Type type, KeyPair::Generic &&keypair)
Construct by moving a keypair.
Definition generic.hxx:282
bool Verify(const Buffer::ReadOnly &input, std::string_view signature) const noexcept
Verify a ReadOnly buffer (copy).
Definition generic.hxx:231
KeyPair::Generic::PointerType KeyPair() const noexcept
Keypair used to sign and verify.
Definition generic.hxx:136
enum Type m_type
Algorithm.
Definition generic.hxx:258
bool Sign(const Range &input, Buffer::WriteOnly &output) const
Sign an input range of byte-convertible values.
Definition generic.hxx:162
bool Verify(Buffer::Consumer consumer, std::string_view signature, ReadMode mode=ReadMode::Move) const noexcept
Verify a Consumer.
Definition generic.hxx:252
Generic(const Generic &other)=default
Copy constructor.
KeyPair::Generic::PointerType m_keypair
Keypair.
Definition generic.hxx:259
bool Verify(std::span< const std::byte > input, std::string_view signature) const noexcept
Verify a byte span against a signature.
Definition generic.hxx:208
Generic(enum Type type, KeyPair::Generic::PointerType keypair)
Construct from a keypair pointer.
Definition generic.hxx:266
Buffer::Consumer Sign(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Sign a Consumer.
Definition generic.hxx:193
bool Sign(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Sign a ReadOnly buffer (copy).
Definition generic.hxx:173
Generic(Generic &&other) noexcept=default
Move constructor.
bool Sign(std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
Sign a byte span.
Definition generic.hxx:150
Generic(enum Type type, const KeyPair::Generic &keypair)
Construct by cloning a keypair.
Definition generic.hxx:274
bool Verify(const Range &input, std::string_view signature) const
Verify an input range of byte-convertible values against a signature.
Definition generic.hxx:220
bool Sign(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Sign a ReadOnly buffer (move).
Definition generic.hxx:183
bool Verify(Buffer::ReadOnly &input, std::string_view signature) const noexcept
Verify a ReadOnly buffer (move).
Definition generic.hxx:241
RSA signer.
Definition rsa.hxx:69
STORMBYTE_FORCE_INLINE std::span< std::byte > span() noexcept
virtual PointerType Clone() const =0
virtual PointerType Move()=0
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Signers of the Crypto module.
Generic::PointerType Create(enum Type type, KeyPair::Generic::PointerType keypair) noexcept
Create a signer from a keypair pointer.
Crypto module of the StormByte suite.
Definition aead.hxx:53
ReadMode
How a source buffer is consumed.
Definition typedefs.hxx:57
@ Copy
Copy the input.
Definition typedefs.hxx:58
@ Move
Consume the input.
Definition typedefs.hxx:59
Root namespace of the StormByte suite.
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53