StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
asymetric.hxx
1#pragma once
2
3#include <StormByte/crypto/crypter.hxx>
4#include <StormByte/crypto/keypair.hxx>
5
10namespace StormByte::Crypto {
17 class STORMBYTE_CRYPTO_PUBLIC Asymmetric final : public Crypter {
18 public:
24 explicit Asymmetric(const Algorithm::Asymmetric& algorithm, const KeyPair& key_pair) noexcept;
25
31 explicit Asymmetric(const Algorithm::Asymmetric& algorithm, KeyPair&& key_pair) noexcept;
32
37 Asymmetric(const Asymmetric& crypter) = default;
38
43 Asymmetric(Asymmetric&& crypter) noexcept = default;
44
48 ~Asymmetric() noexcept override = default;
49
55 Asymmetric& operator=(const Asymmetric& crypter) = default;
56
62 Asymmetric& operator=(Asymmetric&& crypter) noexcept = default;
63
69 [[nodiscard]]
70 Expected<std::string, Exception> Encrypt(const std::string& input) const noexcept override;
71
77 [[nodiscard]]
78 Expected<Buffer::Simple, Exception> Encrypt(const Buffer::Simple& buffer) const noexcept override;
79
85 [[nodiscard]]
86 Buffer::Consumer Encrypt(const Buffer::Consumer consumer) const noexcept override;
87
93 [[nodiscard]]
94 Expected<std::string, Exception> Decrypt(const std::string& input) const noexcept override;
95
101 [[nodiscard]]
102 Expected<Buffer::Simple, Exception> Decrypt(const Buffer::Simple& buffer) const noexcept override;
103
109 [[nodiscard]]
110 Buffer::Consumer Decrypt(const Buffer::Consumer consumer) const noexcept override;
111
116 [[nodiscard]]
117 const KeyPair& KeyPair() const noexcept;
118
119 private:
120 Algorithm::Asymmetric m_algorithm;
121 class KeyPair m_keys;
122 };
123}
A class for managing asymmetric encryption and decryption.
Definition asymetric.hxx:17
~Asymmetric() noexcept override=default
Destructor for the Asymmetric class.
Asymmetric(const Asymmetric &crypter)=default
Copy constructor for the Asymmetric class.
Asymmetric(const Algorithm::Asymmetric &algorithm, KeyPair &&key_pair) noexcept
Constructs an Asymmetric instance with a specified algorithm and key pair (move version).
Asymmetric(Asymmetric &&crypter) noexcept=default
Move constructor for the Asymmetric class.
Asymmetric(const Algorithm::Asymmetric &algorithm, const KeyPair &key_pair) noexcept
Constructs an Asymmetric instance with a specified algorithm and key pair.
An abstract base class for encryption and decryption operations.
Definition crypter.hxx:21
A class representing an exception in the crypto module.
Definition exception.hxx:15
A class representing a public/private key pair.
Definition keypair.hxx:23
The namespace containing cryptographic algorithms.