OpenTTD Source
20241108-master-g80f628063a
|
Encryption handler implementation for monocypther encryption after a X25519 key exchange. More...
Public Member Functions | |
X25519EncryptionHandler (const std::span< const uint8_t > key, const X25519Nonce &nonce) | |
Create the encryption handler. More... | |
~X25519EncryptionHandler () | |
Ensure the encryption context is wiped! | |
size_t | MACSize () const override |
Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol. More... | |
bool | Decrypt (std::span< std::uint8_t > mac, std::span< std::uint8_t > message) override |
Decrypt the given message in-place, validating against the given MAC. More... | |
void | Encrypt (std::span< std::uint8_t > mac, std::span< std::uint8_t > message) override |
Encrypt the given message in-place, and write the associated MAC. More... | |
Private Attributes | |
crypto_aead_ctx | context |
The actual encryption context. | |
Encryption handler implementation for monocypther encryption after a X25519 key exchange.
Definition at line 97 of file network_crypto.cpp.
|
inline |
Create the encryption handler.
key | The key used for the encryption. |
nonce | The nonce used for the encryption. |
Definition at line 107 of file network_crypto.cpp.
References X25519_KEY_SIZE.
|
inlineoverridevirtual |
Decrypt the given message in-place, validating against the given MAC.
mac | The message authentication code (MAC). |
message | The location of the message to decrypt. |
Implements NetworkEncryptionHandler.
Definition at line 124 of file network_crypto.cpp.
|
inlineoverridevirtual |
Encrypt the given message in-place, and write the associated MAC.
mac | The location to write the message authentication code (MAC) to. |
message | The location of the message to encrypt. |
Implements NetworkEncryptionHandler.
Definition at line 129 of file network_crypto.cpp.
|
inlineoverridevirtual |
Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol.
Implements NetworkEncryptionHandler.
Definition at line 119 of file network_crypto.cpp.
References X25519_MAC_SIZE.