OpenTTD Source
20241108-master-g80f628063a
|
Client side handler for using X25519 without actual authentication. More...
#include <network_crypto_internal.h>
Public Member Functions | |
X25519KeyExchangeOnlyClientHandler (const X25519SecretKey &secret_key) | |
Create the handler that that one does the key exchange. More... | |
virtual RequestResult | ReceiveRequest (struct Packet &p) override |
Read a request from the server. More... | |
virtual bool | SendResponse (struct Packet &p) override |
Create the response to send to the server. More... | |
virtual std::string_view | GetName () const override |
Get the name of the handler for debug messages. More... | |
virtual NetworkAuthenticationMethod | GetAuthenticationMethod () const override |
Get the method this handler is providing functionality for. More... | |
virtual bool | ReceiveEnableEncryption (struct Packet &p) override |
Read the request to enable encryption from the server. More... | |
virtual std::unique_ptr< NetworkEncryptionHandler > | CreateClientToServerEncryptionHandler () const override |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server. More... | |
virtual std::unique_ptr< NetworkEncryptionHandler > | CreateServerToClientEncryptionHandler () const override |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client. More... | |
Additional Inherited Members | |
Public Types inherited from NetworkAuthenticationClientHandler | |
enum | RequestResult { AWAIT_USER_INPUT , READY_FOR_RESPONSE , INVALID } |
The processing result of receiving a request. More... | |
Static Public Member Functions inherited from NetworkAuthenticationClientHandler | |
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... | |
Protected Types inherited from NetworkAuthenticationClientHandler | |
enum | RequestResult { AWAIT_USER_INPUT , READY_FOR_RESPONSE , INVALID } |
The processing result of receiving a request. More... | |
Protected Member Functions inherited from X25519AuthenticationHandler | |
X25519AuthenticationHandler (const X25519SecretKey &secret_key) | |
Create the handler, and generate the public keys accordingly. More... | |
void | SendRequest (struct Packet &p) |
bool | ReceiveRequest (struct Packet &p) |
Read the key exchange data from a Packet that came from the server,. More... | |
bool | SendResponse (struct Packet &p, std::string_view derived_key_extra_payload) |
Perform the key exchange, and when that is correct fill the Packet with the appropriate data. More... | |
NetworkAuthenticationServerHandler::ResponseResult | ReceiveResponse (struct Packet &p, std::string_view derived_key_extra_payload) |
Read the key exchange data from a Packet that came from the client, and check whether the client passes the key exchange successfully. More... | |
std::string | GetPeerPublicKey () const |
Get the public key the peer provided for the key exchange. More... | |
void | SendEnableEncryption (struct Packet &p) const |
Send the initial nonce for the encrypted connection. More... | |
bool | ReceiveEnableEncryption (struct Packet &p) |
Receive the initial nonce for the encrypted connection. More... | |
std::unique_ptr< NetworkEncryptionHandler > | CreateClientToServerEncryptionHandler () const |
std::unique_ptr< NetworkEncryptionHandler > | CreateServerToClientEncryptionHandler () const |
Static Protected Member Functions inherited from NetworkAuthenticationClientHandler | |
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... | |
Client side handler for using X25519 without actual authentication.
This follows the method described in X25519AuthenticationHandler
, without an extra payload.
Definition at line 135 of file network_crypto_internal.h.
|
inline |
Create the handler that that one does the key exchange.
secret_key | The secret key to initialize this handler with. |
Definition at line 141 of file network_crypto_internal.h.
|
inlineoverridevirtual |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the client to the server.
Implements NetworkAuthenticationHandler.
Definition at line 150 of file network_crypto_internal.h.
|
inlineoverridevirtual |
Create a NetworkEncryptionHandler to encrypt or decrypt messages from the server to the client.
Implements NetworkAuthenticationHandler.
Definition at line 151 of file network_crypto_internal.h.
|
inlineoverridevirtual |
Get the method this handler is providing functionality for.
NetworkAuthenticationMethod
. Implements NetworkAuthenticationHandler.
Definition at line 147 of file network_crypto_internal.h.
References NETWORK_AUTH_METHOD_X25519_KEY_EXCHANGE_ONLY.
|
inlineoverridevirtual |
Get the name of the handler for debug messages.
Implements NetworkAuthenticationHandler.
Definition at line 146 of file network_crypto_internal.h.
|
inlineoverridevirtual |
Read the request to enable encryption from the server.
p | The request from the server. |
Implements NetworkAuthenticationClientHandler.
Definition at line 149 of file network_crypto_internal.h.
References X25519AuthenticationHandler::ReceiveEnableEncryption().
|
inlineoverridevirtual |
Read a request from the server.
p | The packet to read the request from. |
Implements NetworkAuthenticationClientHandler.
Definition at line 143 of file network_crypto_internal.h.
References NetworkAuthenticationClientHandler::INVALID, NetworkAuthenticationClientHandler::READY_FOR_RESPONSE, and X25519AuthenticationHandler::ReceiveRequest().
|
inlineoverridevirtual |
Create the response to send to the server.
p | The packet to write the response from. |
Implements NetworkAuthenticationClientHandler.
Definition at line 144 of file network_crypto_internal.h.
References X25519AuthenticationHandler::SendResponse().