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/crypter/asymmetric/generic.hxx>
4#include <StormByte/crypto/keypair/rsa.hxx>
5
10namespace StormByte::Crypto::Crypter {
15 class STORMBYTE_CRYPTO_PUBLIC RSA final: public Asymmetric {
16 public:
21 inline RSA(KeyPair::Generic::PointerType keypair):
22 Asymmetric(Type::RSA, keypair) {}
23
28 inline RSA(const KeyPair::RSA& keypair):
29 Asymmetric(Type::RSA, keypair) {}
30
35 inline RSA(KeyPair::RSA&& keypair):
36 Asymmetric(Type::RSA, std::forward<KeyPair::RSA>(keypair)) {}
37
42 RSA(const RSA& other) = default;
43
48 RSA(RSA&& other) noexcept = default;
49
53 virtual ~RSA() noexcept = default;
54
60 RSA& operator=(const RSA& other) = default;
61
67 RSA& operator=(RSA&& other) noexcept = default;
68
73 inline PointerType Clone() const noexcept override {
74 return std::make_shared<RSA>(*this);
75 }
76
81 inline PointerType Move() noexcept override {
82 return std::make_shared<RSA>(std::move(*this));
83 }
84
85 private:
92 bool DoEncrypt(std::span<const std::byte> input, Buffer::WriteOnly& output) const noexcept override;
93
100 Buffer::Consumer DoEncrypt(Buffer::Consumer consumer, ReadMode mode) const noexcept override;
101
108 bool DoDecrypt(std::span<const std::byte> input, Buffer::WriteOnly& output) const noexcept override;
109
116 Buffer::Consumer DoDecrypt(Buffer::Consumer consumer, ReadMode mode) const noexcept override;
117 };
118}
A generic asymmetric crypter class.
Definition generic.hxx:15
An asymmetric crypter class.
Definition rsa.hxx:15
RSA(const KeyPair::RSA &keypair)
Constructor.
Definition rsa.hxx:28
RSA(KeyPair::Generic::PointerType keypair)
Constructor.
Definition rsa.hxx:21
virtual ~RSA() noexcept=default
Virtual destructor.
RSA(const RSA &other)=default
Copy constructor.
RSA(RSA &&other) noexcept=default
Move constructor.
RSA(KeyPair::RSA &&keypair)
Constructor.
Definition rsa.hxx:35
PointerType Move() noexcept override
Move the RSA crypter.
Definition rsa.hxx:81
The namespace containing all the keypair-related classes.