|
OpenTTD Source 20251104-master-g3befbdd52f
|
Encryption handler implementation for monocypher 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. | |
| ~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. | |
| 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. | |
| 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. | |
Private Attributes | |
| crypto_aead_ctx | context |
| The actual encryption context. | |
Encryption handler implementation for monocypher 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.
|
inline |
Ensure the encryption context is wiped!
Definition at line 114 of file network_crypto.cpp.
References crypto_wipe().
|
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.
|
private |
The actual encryption context.
Definition at line 99 of file network_crypto.cpp.