OpenTTD Source  20240919-master-gdf0233f4c2
NetworkEncryptionHandler Class Referenceabstract

Base class for handling the encryption (or decryption) of a network connection. More...

#include <network_crypto.h>

Inheritance diagram for NetworkEncryptionHandler:
X25519EncryptionHandler

Public Member Functions

virtual size_t MACSize () const =0
 Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol. More...
 
virtual bool Decrypt (std::span< std::uint8_t > mac, std::span< std::uint8_t > message)=0
 Decrypt the given message in-place, validating against the given MAC. More...
 
virtual void Encrypt (std::span< std::uint8_t > mac, std::span< std::uint8_t > message)=0
 Encrypt the given message in-place, and write the associated MAC. More...
 

Detailed Description

Base class for handling the encryption (or decryption) of a network connection.

Definition at line 41 of file network_crypto.h.

Member Function Documentation

◆ Decrypt()

virtual bool NetworkEncryptionHandler::Decrypt ( std::span< std::uint8_t >  mac,
std::span< std::uint8_t >  message 
)
pure virtual

Decrypt the given message in-place, validating against the given MAC.

Parameters
macThe message authentication code (MAC).
messageThe location of the message to decrypt.
Returns
Whether decryption and authentication/validation of the message succeeded.

Implemented in X25519EncryptionHandler.

◆ Encrypt()

virtual void NetworkEncryptionHandler::Encrypt ( std::span< std::uint8_t >  mac,
std::span< std::uint8_t >  message 
)
pure virtual

Encrypt the given message in-place, and write the associated MAC.

Parameters
macThe location to write the message authentication code (MAC) to.
messageThe location of the message to encrypt.

Implemented in X25519EncryptionHandler.

◆ MACSize()

virtual size_t NetworkEncryptionHandler::MACSize ( ) const
pure virtual

Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol.

Returns
The size, in bytes, of the MACs.

Implemented in X25519EncryptionHandler.


The documentation for this class was generated from the following file: