Cuberite
A lightweight, fast and extensible game server for Minecraft
AesCfb128Decryptor.h
Go to the documentation of this file.
1 
2 // AesCfb128Decryptor.h
3 
4 // Declares the cAesCfb128Decryptor class decrypting data using AES CFB-128
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #if PLATFORM_CRYPTOGRAPHY && defined(_WIN32)
13 #include <wincrypt.h>
14 #else
15 #include "mbedtls/aes.h"
16 #endif
17 
18 
19 
20 
21 
24 {
25 public:
26 
27  cAesCfb128Decryptor(void);
29 
31  void Init(const Byte a_Key[16], const Byte a_IV[16]);
32 
34  void ProcessData(std::byte * a_EncryptedIn, size_t a_Length);
35 
37  bool IsValid(void) const { return m_IsValid; }
38 
39 protected:
40 
41 #if PLATFORM_CRYPTOGRAPHY && defined(_WIN32)
42  HCRYPTPROV m_Aes;
43  HCRYPTKEY m_Key;
44 #else
45  mbedtls_aes_context m_Aes;
46 #endif
47 
49  Byte m_IV[16];
50 
52  bool m_IsValid;
53 } ;
unsigned char Byte
Definition: Globals.h:161
Decrypts data using the AES / CFB 128 algorithm.
Byte m_IV[16]
The InitialVector, used by the CFB mode decryption.
bool IsValid(void) const
Returns true if the object has been initialized with the Key / IV.
bool m_IsValid
Indicates whether the object has been initialized with the Key / IV.
void Init(const Byte a_Key[16], const Byte a_IV[16])
Initializes the decryptor with the specified Key / IV.
mbedtls_aes_context m_Aes
void ProcessData(std::byte *a_EncryptedIn, size_t a_Length)
Decrypts a_Length bytes of the encrypted data in-place; produces a_Length output bytes.