10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
AESSecretKey.h
1
#ifndef TENDUKE_CRYPTO_AES_AESSECRETKEY_H
2
#define TENDUKE_CRYPTO_AES_AESSECRETKEY_H
3
4
#include "./AESGCMCipher.h"
5
#include "../SecretKey.h"
6
#include "../../../utl/DataSpan.h"
7
8
#include <cstdint>
9
#include <memory>
10
11
namespace
tenduke
{
namespace
crypto
{
namespace
aes {
12
13
class
AESSecretKey :
public
virtual
SecretKey
14
{
15
public
:
16
explicit
AESSecretKey(std::unique_ptr<::tenduke::utl::DataSpan> key)
17
: data(std::move(key))
18
{
19
}
20
21
// The key is not copyable
22
AESSecretKey(
const
AESSecretKey&) =
delete
;
23
AESSecretKey& operator=(
const
AESSecretKey&) =
delete
;
24
25
// The key is movable
26
AESSecretKey(AESSecretKey&& other)
noexcept
=
default
;
27
AESSecretKey& operator=(AESSecretKey&& other)
noexcept
=
default
;
28
33
virtual
std::unique_ptr<::tenduke::crypto::aes::AESGCMCipher>
gcmCipher
()
const
= 0;
34
35
virtual
uint32_t numBits()
const
36
{
37
return
size
() * 8;
38
}
39
40
const
unsigned
char
*
raw
()
const override
41
{
42
return
data->data();
43
}
44
45
size_t
size
()
const override
46
{
47
return
data->size_bytes();
48
}
49
50
private
:
51
std::unique_ptr<::tenduke::utl::DataSpan> data;
52
};
53
54
}}}
55
56
#endif
//TENDUKE_CRYPTO_AES_AESSECRETKEY_H
tenduke::crypto::aes::AESSecretKey::gcmCipher
virtual std::unique_ptr<::tenduke::crypto::aes::AESGCMCipher > gcmCipher() const =0
Returns AES-GCM cipher, which uses this key for operations.
tenduke::crypto::aes::AESSecretKey::size
size_t size() const override
Returns the size of the key in bytes.
Definition
AESSecretKey.h:45
tenduke::crypto::aes::AESSecretKey::raw
const unsigned char * raw() const override
Returns the raw key data as a byte array.
Definition
AESSecretKey.h:40
tenduke::crypto
Cryptography services.
Definition
AbstractCiphers.h:18
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
core
src
crypto
symmetric
aes
AESSecretKey.h
Generated by
1.17.0