|
OpenTTD Source 20251117-master-g7398d2e290
|
Base class for server side cryptographic authentication handlers. More...
#include <network_crypto.h>
Public Types | |
| enum class | ResponseResult : uint8_t { Authenticated , NotAuthenticated , RetryNextMethod } |
| The processing result of receiving a response. More... | |
Public Member Functions | |
| virtual void | SendRequest (struct Packet &p)=0 |
| Create the request to send to the client. | |
| virtual ResponseResult | ReceiveResponse (struct Packet &p)=0 |
| Read the response from the client. | |
| virtual void | SendEnableEncryption (struct Packet &p)=0 |
| Create the request to enable encryption to the client. | |
| virtual bool | CanBeUsed () const =0 |
| Checks whether this handler can be used with the current configuration. | |
| virtual std::string | GetPeerPublicKey () const =0 |
| Get the public key the peer provided during the authentication. | |
Public Member Functions inherited from NetworkAuthenticationHandler | |
| virtual std::string_view | GetName () const =0 |
| Get the name of the handler for debug messages. | |
| virtual NetworkAuthenticationMethod | GetAuthenticationMethod () const =0 |
| Get the method this handler is providing functionality for. | |
| virtual std::unique_ptr< NetworkEncryptionHandler > | CreateClientToServerEncryptionHandler () const =0 |
| Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server. | |
| virtual std::unique_ptr< NetworkEncryptionHandler > | CreateServerToClientEncryptionHandler () const =0 |
| Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client. | |
Static Public Member Functions | |
| static std::unique_ptr< NetworkAuthenticationServerHandler > | Create (const NetworkAuthenticationPasswordProvider *password_provider, const NetworkAuthenticationAuthorizedKeyHandler *authorized_key_handler, NetworkAuthenticationMethodMask client_supported_method_mask={NetworkAuthenticationMethod::X25519_KeyExchangeOnly, NetworkAuthenticationMethod::X25519_PAKE, NetworkAuthenticationMethod::X25519_AuthorizedKey}) |
| Create a NetworkAuthenticationServerHandler. | |
Base class for server side cryptographic authentication handlers.
Definition at line 258 of file network_crypto.h.
|
strong |
The processing result of receiving a response.
Definition at line 261 of file network_crypto.h.
|
pure virtual |
Checks whether this handler can be used with the current configuration.
For example when there is no password, the handler cannot be used.
Implemented in X25519KeyExchangeOnlyServerHandler, X25519PAKEServerHandler, X25519AuthorizedKeyServerHandler, and CombinedAuthenticationServerHandler.
|
static |
Create a NetworkAuthenticationServerHandler.
| password_provider | Callback to provide the password handling. Must remain valid until the authentication has succeeded or failed. Can be nullptr to skip password checks. |
| authorized_key_handler | Callback to provide the authorized key handling. Must remain valid until the authentication has succeeded or failed. Can be nullptr to skip authorized key checks. |
| client_supported_method_mask | Bitmask of the methods that are supported by the client. Defaults to support of all methods. |
Definition at line 478 of file network_crypto.cpp.
References X25519SecretKey::CreateRandom(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), X25519_AuthorizedKey, X25519_KeyExchangeOnly, and X25519_PAKE.
Referenced by ServerNetworkAdminSocketHandler::Receive_ADMIN_JOIN_SECURE(), and ServerNetworkGameSocketHandler::SendAuthRequest().
|
pure virtual |
Get the public key the peer provided during the authentication.
Implemented in X25519KeyExchangeOnlyServerHandler, X25519PAKEServerHandler, X25519AuthorizedKeyServerHandler, and CombinedAuthenticationServerHandler.
References X25519_AuthorizedKey, X25519_KeyExchangeOnly, and X25519_PAKE.
|
pure virtual |
Read the response from the client.
| p | The packet to read the response from. |
ResponseResult describing the result. Implemented in X25519KeyExchangeOnlyServerHandler, X25519PAKEServerHandler, X25519AuthorizedKeyServerHandler, and CombinedAuthenticationServerHandler.
|
pure virtual |
Create the request to enable encryption to the client.
| p | The packet to write the enable encryption request to. |
Implemented in X25519KeyExchangeOnlyServerHandler, X25519PAKEServerHandler, X25519AuthorizedKeyServerHandler, and CombinedAuthenticationServerHandler.
|
pure virtual |
Create the request to send to the client.
| p | The packet to write the request to. |
Implemented in X25519KeyExchangeOnlyServerHandler, X25519PAKEServerHandler, X25519AuthorizedKeyServerHandler, and CombinedAuthenticationServerHandler.