14#define DEFAULT_VALIDATION_KEY 0xCAFEBABE
Definition: cs_ConnectionEncryption.h:18
void disconnect()
Close connection due to insufficient access.
void generateSessionData()
Generate new session data.
static cs_buffer_size_t getPlaintextBufferSize(cs_buffer_size_t encryptedBufferSize, ConnectionEncryptionType encryptionType)
Get the required output buffer size when decrypting encrypted data.
cs_ret_code_t decrypt(cs_data_t input, cs_data_t output, EncryptionAccessLevel &accessLevel, ConnectionEncryptionType encryptionType)
Parses headers, decrypts data, and validates decrypted data.
ConnectionEncryption(ConnectionEncryption const &)
encryption_nonce_t _nonce
Nonce used for encryption and decryption.
Definition: cs_ConnectionEncryption.h:122
static ConnectionEncryption & getInstance()
Use static variant of singleton, no dynamic memory allocation.
Definition: cs_ConnectionEncryption.h:21
void init()
Initialize the class, reads from State.
static cs_buffer_size_t getEncryptedBufferSize(cs_buffer_size_t plaintextBufferSize, ConnectionEncryptionType encryptionType)
Get the required output buffer size when encrypting plaintext.
cs_ret_code_t encrypt(cs_data_t input, cs_data_t output, EncryptionAccessLevel accessLevel, ConnectionEncryptionType encryptionType)
Add headers and encrypt data.
session_data_t _sessionData
Session data: data that's valid for a whole session (connection).
Definition: cs_ConnectionEncryption.h:115
void operator=(ConnectionEncryption const &)
cs_ret_code_t setSessionData(session_data_t &sessionData)
Set session data.
void handleEvent(event_t &event) override
Handle events.
Event listener.
Definition: cs_EventListener.h:17
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
ConnectionEncryptionType
Definition: cs_ConnectionEncryption.h:16
EncryptionAccessLevel
Packets (structs) that are used over the air, over uart, or stored in flash.
Definition: cs_Packets.h:36
uint16_t cs_buffer_size_t
Definition: cs_Typedefs.h:20
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Nonce used for encryption.
Definition: cs_Packets.h:51
Definition: cs_Packets.h:71