OpenTTD Source: NetworkEncryptionHandler Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions
NetworkEncryptionHandler Class Referenceabstract

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

`#include <network_crypto.h>`

Inheritance diagram for NetworkEncryptionHandler:

## Public Member Functions
virtual size_t | MACSize () const =0
| Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol.
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.
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.

## 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

  mac | The message authentication code (MAC).
  message | The 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

  mac | The location to write the message authentication code (MAC) to.
  message | The 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:

- src/network/network_crypto.h