10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
WinCNGAESCipher.h
1#ifndef TENDUKE_CRYPTO_WIN_CNG_AES_WINCNGAESCIPHER_H
2#define TENDUKE_CRYPTO_WIN_CNG_AES_WINCNGAESCIPHER_H
3
4#include "crypto/symmetric/aes/AESGCMCipher.h"
5#include "utl/DataSink.h"
6#include "utl/DataSpan.h"
7
8#include <memory>
9
10namespace tenduke { namespace crypto { namespace win { namespace cng {
11
12class WinCNGAESKey;
13
17class WinCNGAESCipher : public ::tenduke::crypto::aes::AESGCMCipher
18{
19public:
20 explicit WinCNGAESCipher(const WinCNGAESKey &key);
21
22 // Ciphers are not copyable
23 WinCNGAESCipher(const WinCNGAESCipher &) = delete;
24 WinCNGAESCipher &operator=(const WinCNGAESCipher &) = delete;
25
26 // Ciphers are movable
27 WinCNGAESCipher(WinCNGAESCipher &&) noexcept = default;
28 WinCNGAESCipher &operator=(WinCNGAESCipher &&) noexcept = default;
29
30 // tenduke::crypto::Cipher implementation
31 void decryptData(const ::tenduke::utl::DataSpan &ciphertext, ::tenduke::utl::DataSink &plaintext) const override;
32 void encryptData(const ::tenduke::utl::DataSpan &plaintext, ::tenduke::utl::DataSink &ciphertext) const override;
33
34 // tenduke::crypto::aes::AESGCMCipher implementation
35 void encryptData(
36 const ::tenduke::utl::DataSpan &nonce,
37 const ::tenduke::utl::DataSpan &plaintext,
38 ::tenduke::utl::DataSink &ciphertext
39 ) const override;
40
41private:
42 std::unique_ptr<::tenduke::utl::DataSpan> key;
43};
44
45}}}}
46
47#endif //TENDUKE_CRYPTO_WIN_CNG_AES_WINCNGAESCIPHER_H
An AES-GCM cipher that supports encryption with an externally provided nonce.
Definition AESGCMCipher.h:17
void encryptData(const ::tenduke::utl::DataSpan &plaintext, ::tenduke::utl::DataSink &ciphertext) const override
Utility method to encrypt data.
Definition WinCNGAESCipher.cpp:168
void decryptData(const ::tenduke::utl::DataSpan &ciphertext, ::tenduke::utl::DataSink &plaintext) const override
Utility method to decrypt data.
Definition WinCNGAESCipher.cpp:178
WinCNG implementation of AES key.
Definition WinCNGAESKey.h:15
A sink to which binary data can be appended.
Definition DataSink.h:14
Cryptography services.
Definition AbstractCiphers.h:18
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4