StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
rsa.hxx
1#pragma once
2
3#include <StormByte/crypto/signer/generic.hxx>
4#include <StormByte/crypto/keypair/rsa.hxx>
5
10namespace StormByte::Crypto::Signer {
15 class STORMBYTE_CRYPTO_PUBLIC RSA final: public Generic {
16 public:
22 inline RSA(KeyPair::Generic::PointerType keypair):
23 Generic(Type::RSA, keypair) {}
24
30 inline RSA(const KeyPair::RSA& keypair):
31 Generic(Type::RSA, keypair) {}
32
38 inline RSA(KeyPair::RSA&& keypair):
39 Generic(Type::RSA, keypair) {}
40
45 RSA(const RSA& other) = default;
46
51 RSA(RSA&& other) noexcept = default;
52
56 ~RSA() noexcept = default;
57
63 RSA& operator=(const RSA& other) = default;
64
70 RSA& operator=(RSA&& other) noexcept = default;
71
76 PointerType Clone() const noexcept override {
77 return std::make_shared<RSA>(*this);
78 }
79
84 PointerType Move() noexcept override {
85 return std::make_shared<RSA>(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}
A generic signer class.
Definition generic.hxx:27
A generic signer signer class.
Definition rsa.hxx:15
~RSA() noexcept=default
Virtual destructor.
RSA(KeyPair::Generic::PointerType keypair)
Constructor.
Definition rsa.hxx:22
RSA(KeyPair::RSA &&keypair)
Constructor.
Definition rsa.hxx:38
RSA(const KeyPair::RSA &keypair)
Constructor.
Definition rsa.hxx:30
PointerType Move() noexcept override
Move the RSA signer.
Definition rsa.hxx:84
RSA(RSA &&other) noexcept=default
Move constructor.
RSA(const RSA &other)=default
Copy constructor.