140 return DoSign(input, output);
150 template<StormByte::Type::ByteInputRange Range>
153 for (
const auto value: input) {
156 return Sign(std::span<const std::byte>(data), output);
166 return DoSign(
const_cast<Buffer::ReadOnly&
>(input), output, ReadMode::Copy);
176 return DoSign(input, output, ReadMode::Move);
186 return DoSign(consumer, mode);
200 inline bool Verify(std::span<const std::byte> input, std::string_view signature)
const noexcept {
201 return DoVerify(input, signature);
211 template<StormByte::Type::ByteInputRange Range>
212 bool Verify(
const Range& input, std::string_view signature)
const {
214 for (
const auto value: input) {
217 return Verify(std::span<const std::byte>(data), signature);
227 return DoVerify(
const_cast<Buffer::ReadOnly&
>(input), signature, ReadMode::Copy);
237 return DoVerify(input, signature, ReadMode::Move);
248 return DoVerify(consumer, signature, mode);
262 m_type(type), m_keypair(keypair) {}
270 m_type(type), m_keypair(keypair.Clone()) {}
278 m_type(type), m_keypair(keypair.
Move()) {}
296 virtual bool DoSign(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
321 virtual bool DoVerify(std::span<const std::byte> input, std::string_view signature)
const noexcept = 0;
reference emplace_back(T &&value)
Abstract keypair.
Definition generic.hxx:99
DSA signer.
Definition dsa.hxx:67
ECDSA signer.
Definition ecdsa.hxx:67
Ed25519 signer.
Definition ed25519.hxx:67
Abstract signer.
Definition generic.hxx:83
virtual ~Generic() noexcept
Destructor.
Generic(enum Type type, KeyPair::Generic &&keypair)
Construct by moving a keypair.
Definition generic.hxx:277
bool Verify(const Buffer::ReadOnly &input, std::string_view signature) const noexcept
Verify a ReadOnly buffer (copy).
Definition generic.hxx:226
enum Type m_type
Algorithm.
Definition generic.hxx:253
bool Sign(const Range &input, Buffer::WriteOnly &output) const
Sign an input range of byte-convertible values.
Definition generic.hxx:151
bool Verify(Buffer::Consumer consumer, std::string_view signature, ReadMode mode=ReadMode::Move) const noexcept
Verify a Consumer.
Definition generic.hxx:247
Generic(const Generic &other)=default
Copy constructor.
KeyPair::Generic::PointerType m_keypair
Keypair.
Definition generic.hxx:254
bool Verify(std::span< const std::byte > input, std::string_view signature) const noexcept
Verify a byte span against a signature.
Definition generic.hxx:200
Generic(enum Type type, KeyPair::Generic::PointerType keypair)
Construct from a keypair pointer.
Definition generic.hxx:261
Buffer::Consumer Sign(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Sign a Consumer.
Definition generic.hxx:185
bool Sign(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Sign a ReadOnly buffer (copy).
Definition generic.hxx:165
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:139
Generic(enum Type type, const KeyPair::Generic &keypair)
Construct by cloning a keypair.
Definition generic.hxx:269
bool Verify(const Range &input, std::string_view signature) const
Verify an input range of byte-convertible values against a signature.
Definition generic.hxx:212
bool Sign(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Sign a ReadOnly buffer (move).
Definition generic.hxx:175
bool Verify(Buffer::ReadOnly &input, std::string_view signature) const noexcept
Verify a ReadOnly buffer (move).
Definition generic.hxx:236
RSA signer.
Definition rsa.hxx:67
Generic::PointerType Create(enum Type type, KeyPair::Generic::PointerType keypair) noexcept
Create a signer from a keypair pointer.
ReadMode
How a source buffer is consumed.
Definition typedefs.hxx:57
Root namespace of the StormByte suite.
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53