OpenTTD Source
20241121-master-g67a0fccfad
|
Base class for client side cryptographic authentication handlers. More...
#include <network_crypto.h>
Public Types | |
enum | RequestResult { AWAIT_USER_INPUT , READY_FOR_RESPONSE , INVALID } |
The processing result of receiving a request. More... | |
Public Member Functions | |
virtual RequestResult | ReceiveRequest (struct Packet &p)=0 |
Read a request from the server. More... | |
virtual bool | SendResponse (struct Packet &p)=0 |
Create the response to send to the server. More... | |
virtual bool | ReceiveEnableEncryption (struct Packet &p)=0 |
Read the request to enable encryption from the server. More... | |
Public Member Functions inherited from NetworkAuthenticationHandler | |
virtual std::string_view | GetName () const =0 |
Get the name of the handler for debug messages. More... | |
virtual NetworkAuthenticationMethod | GetAuthenticationMethod () const =0 |
Get the method this handler is providing functionality for. More... | |
virtual std::unique_ptr< NetworkEncryptionHandler > | CreateClientToServerEncryptionHandler () const =0 |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server. More... | |
virtual std::unique_ptr< NetworkEncryptionHandler > | CreateServerToClientEncryptionHandler () const =0 |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client. More... | |
Static Public Member Functions | |
static void | EnsureValidSecretKeyAndUpdatePublicKey (std::string &secret_key, std::string &public_key) |
Ensures that the given secret key is valid, and when not overwrite it with a valid secret key. More... | |
static std::unique_ptr< NetworkAuthenticationClientHandler > | Create (std::shared_ptr< NetworkAuthenticationPasswordRequestHandler > password_handler, std::string &secret_key, std::string &public_key) |
Create a NetworkAuthenticationClientHandler. More... | |
Base class for client side cryptographic authentication handlers.
Definition at line 222 of file network_crypto.h.
The processing result of receiving a request.
Definition at line 225 of file network_crypto.h.
|
static |
Create a NetworkAuthenticationClientHandler.
password_handler | The handler for when a request for password needs to be passed on to the user. |
secret_key | The location where the secret key is stored; can be overwritten when invalid. |
public_key | The location where the public key is stored; can be overwritten when invalid. |
Definition at line 462 of file network_crypto.cpp.
References X25519AuthorizedKeyClientHandler::GetValidSecretKeyAndUpdatePublicKey().
Referenced by ClientNetworkGameSocketHandler::Receive_SERVER_AUTH_REQUEST().
|
static |
Ensures that the given secret key is valid, and when not overwrite it with a valid secret key.
Then update the public key to be associated with the secret key.
secret_key | The location where the secret key is stored; can be overwritten when invalid. |
public_key | The location where the public key is stored; can be overwritten when invalid. |
Definition at line 451 of file network_crypto.cpp.
References X25519AuthorizedKeyClientHandler::GetValidSecretKeyAndUpdatePublicKey().
|
pure virtual |
Read the request to enable encryption from the server.
p | The request from the server. |
Implemented in CombinedAuthenticationClientHandler, X25519AuthorizedKeyClientHandler, X25519PAKEClientHandler, and X25519KeyExchangeOnlyClientHandler.
Referenced by CombinedAuthenticationClientHandler::ReceiveEnableEncryption().
|
pure virtual |
Read a request from the server.
p | The packet to read the request from. |
Implemented in CombinedAuthenticationClientHandler, X25519AuthorizedKeyClientHandler, X25519PAKEClientHandler, and X25519KeyExchangeOnlyClientHandler.
Referenced by CombinedAuthenticationClientHandler::ReceiveRequest().
|
pure virtual |
Create the response to send to the server.
p | The packet to write the response from. |
Implemented in CombinedAuthenticationClientHandler, X25519AuthorizedKeyClientHandler, X25519PAKEClientHandler, and X25519KeyExchangeOnlyClientHandler.
Referenced by CombinedAuthenticationClientHandler::SendResponse().