#include <cs_ConnectionEncryption.h>
◆ ConnectionEncryption() [1/2]
◆ ConnectionEncryption() [2/2]
◆ decrypt()
Parses headers, decrypts data, and validates decrypted data.
- Parameters
-
[in] | input | Input data to be parsed and decrypted. |
[out] | output | Buffer to write decrypted payload to. |
[out] | accessLevel | Access level that was used for encryption. |
[in] | encryptionType | Type of encryption to use. |
- Returns
- Return code.
◆ disconnect()
void ConnectionEncryption::disconnect |
( |
| ) |
|
Close connection due to insufficient access.
◆ encrypt()
Add headers and encrypt data.
- Parameters
-
[in] | input | Input data to be encrypted. |
[out] | output | Buffer to write headers and encrypted data to. |
[in] | accessLevel | Access level to use for encryption. |
[in] | encryptionType | Type of encryption to use. |
- Returns
- Return code.
◆ generateSessionData()
void ConnectionEncryption::generateSessionData |
( |
| ) |
|
|
private |
Generate new session data.
To be called on connect.
◆ getEncryptedBufferSize()
Get the required output buffer size when encrypting plaintext.
- Parameters
-
[in] | plaintextBufferSize | Size of the buffer with the payload that will be encrypted. |
[in] | encryptionType | Type of encryption to use. |
- Returns
- Required size of the buffer that will hold the encryption headers and encrypted payload.
◆ getInstance()
Use static variant of singleton, no dynamic memory allocation.
◆ getPlaintextBufferSize()
Get the required output buffer size when decrypting encrypted data.
- Parameters
-
[in] | encryptedBufferSize | Size of the buffer with encryption headers and encrypted payload. |
[in] | encryptionType | Type of encryption to use. |
- Returns
- Required size of the buffer that will hold the decrypted payload.
◆ handleEvent()
void ConnectionEncryption::handleEvent |
( |
event_t & |
event | ) |
|
|
overridevirtual |
◆ init()
void ConnectionEncryption::init |
( |
| ) |
|
Initialize the class, reads from State.
◆ operator=()
◆ setSessionData()
Set session data.
To be used when connecting to another crownstone.
- Parameters
-
[in] | sessionData | The session data that has been read. |
- Returns
- ERR_PROTOCOL_UNSUPPORTED When the protocol is not supported.
-
ERR_SUCCESS When the session data is set.
◆ _nonce
Nonce used for encryption and decryption.
Cached because it holds the session nonce.
◆ _sessionData
Session data: data that's valid for a whole session (connection).
The documentation for this class was generated from the following file: