ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
crypto_handshake_context_t Struct Reference

Cryptographic handshake context structure. More...

#include <lib/crypto/handshake/common.h>

Data Fields

crypto_context_t crypto_ctx
 
crypto_handshake_state_t state
 
bool is_server
 
public_key_t server_public_key
 
private_key_t server_private_key
 
public_key_t client_public_key
 
private_key_t client_private_key
 
char expected_server_key [256]
 
char client_gpg_key_id [41]
 
char server_hostname [256]
 
char server_ip [256]
 
uint16_t server_port
 
bool verify_server_key
 
bool require_client_auth
 
bool server_uses_client_auth
 
char client_keys_path [PLATFORM_MAX_PATH_LENGTH]
 
public_key_tclient_whitelist
 
size_t num_whitelisted_clients
 
public_key_t client_ed25519_key
 
bool client_ed25519_key_verified
 
bool client_sent_identity
 
bool has_password
 
char password [256]
 
uint8_t client_challenge_nonce [32]
 

Detailed Description

Cryptographic handshake context structure.

Manages the complete handshake state for a single connection, including key exchange, authentication, and connection metadata.

Note
Server/Client specific fields:
  • Server-only: server_public_key, server_private_key, client_whitelist
  • Client-only: client_public_key, client_private_key, expected_server_key
Dynamic crypto parameters: All size fields are stored in crypto_ctx and accessed via ctx->crypto_ctx.* (public_key_size, auth_public_key_size, etc.)
Authentication modes:
  • Password: Uses Argon2id-derived key for authentication
  • Client key: Uses Ed25519 signature for client authentication (whitelist)
  • Server identity: Uses Ed25519 signature for server authentication (known_hosts)
State validation: Functions validate current state before proceeding. Invalid state transitions return ERROR_INVALID_STATE.

Definition at line 70 of file crypto/handshake/common.h.

Field Documentation

◆ client_challenge_nonce

uint8_t crypto_handshake_context_t::client_challenge_nonce[32]

Mutual authentication (client challenges server) Client-generated nonce for server to prove knowledge of shared secret

Definition at line 109 of file crypto/handshake/common.h.

Referenced by crypto_handshake_client_complete(), and crypto_handshake_server_complete().

◆ client_ed25519_key

public_key_t crypto_handshake_context_t::client_ed25519_key

Client's Ed25519 key (received during handshake)

Definition at line 100 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_auth_challenge(), and crypto_handshake_server_complete().

◆ client_ed25519_key_verified

bool crypto_handshake_context_t::client_ed25519_key_verified

Whether client's Ed25519 key was verified against whitelist

Definition at line 101 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_auth_challenge(), and crypto_handshake_server_complete().

◆ client_gpg_key_id

char crypto_handshake_context_t::client_gpg_key_id[41]

Client's GPG key ID (8/16/40 hex chars + null terminator, for server verification)

Definition at line 84 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), and crypto_handshake_client_key_exchange().

◆ client_keys_path

char crypto_handshake_context_t::client_keys_path[PLATFORM_MAX_PATH_LENGTH]

Server: client keys file path (whitelist)

Definition at line 95 of file crypto/handshake/common.h.

◆ client_private_key

private_key_t crypto_handshake_context_t::client_private_key

Client's Ed25519 private key (for signing challenges)

Definition at line 82 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), crypto_handshake_client_auth_response(), and crypto_handshake_client_key_exchange().

◆ client_public_key

public_key_t crypto_handshake_context_t::client_public_key

Client identity (client only) Client's Ed25519 public key (for authentication)

Definition at line 81 of file crypto/handshake/common.h.

Referenced by client_crypto_handshake(), and client_crypto_init().

◆ client_sent_identity

bool crypto_handshake_context_t::client_sent_identity

Whether client provided an identity key during handshake

Definition at line 102 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_auth_challenge(), and crypto_handshake_server_complete().

◆ client_whitelist

public_key_t* crypto_handshake_context_t::client_whitelist

Client whitelist (server only) Pointer to whitelist array (server only)

Definition at line 98 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_auth_challenge(), and server_crypto_handshake().

◆ crypto_ctx

◆ expected_server_key

char crypto_handshake_context_t::expected_server_key[256]

Expected server key fingerprint (client only, for known_hosts)

Definition at line 83 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), and crypto_handshake_client_key_exchange().

◆ has_password

bool crypto_handshake_context_t::has_password

Password authentication Whether password authentication is enabled

Definition at line 105 of file crypto/handshake/common.h.

Referenced by crypto_handshake_init_with_password().

◆ is_server

bool crypto_handshake_context_t::is_server

True if this is the server side

Definition at line 74 of file crypto/handshake/common.h.

Referenced by crypto_handshake_init(), crypto_handshake_init_with_password(), and crypto_handshake_set_parameters().

◆ num_whitelisted_clients

size_t crypto_handshake_context_t::num_whitelisted_clients

Number of whitelisted clients

Definition at line 99 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_auth_challenge(), and server_crypto_handshake().

◆ password

char crypto_handshake_context_t::password[256]

Password for authentication (temporary storage, cleared after use)

Definition at line 106 of file crypto/handshake/common.h.

Referenced by crypto_handshake_init_with_password().

◆ require_client_auth

◆ server_hostname

char crypto_handshake_context_t::server_hostname[256]

Connection info for known_hosts Server hostname (user-provided)

Definition at line 87 of file crypto/handshake/common.h.

Referenced by client_crypto_init().

◆ server_ip

char crypto_handshake_context_t::server_ip[256]

Server IP address (resolved from connection)

Definition at line 88 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), and crypto_handshake_client_key_exchange().

◆ server_port

uint16_t crypto_handshake_context_t::server_port

Server port

Definition at line 89 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), and crypto_handshake_client_key_exchange().

◆ server_private_key

private_key_t crypto_handshake_context_t::server_private_key

Server's long-term Ed25519 private key (for signing)

Definition at line 78 of file crypto/handshake/common.h.

Referenced by crypto_handshake_server_start(), and server_crypto_handshake().

◆ server_public_key

public_key_t crypto_handshake_context_t::server_public_key

Server identity (server only) Server's long-term Ed25519 public key (identity)

Definition at line 77 of file crypto/handshake/common.h.

Referenced by server_crypto_handshake().

◆ server_uses_client_auth

bool crypto_handshake_context_t::server_uses_client_auth

Client: whether server requested client authentication

Definition at line 94 of file crypto/handshake/common.h.

Referenced by client_crypto_handshake(), crypto_handshake_client_key_exchange(), crypto_handshake_init(), and crypto_handshake_init_with_password().

◆ state

◆ verify_server_key

bool crypto_handshake_context_t::verify_server_key

Authentication configuration Client: verify server key against known_hosts

Definition at line 92 of file crypto/handshake/common.h.

Referenced by client_crypto_init(), crypto_handshake_client_key_exchange(), crypto_handshake_init(), and crypto_handshake_init_with_password().


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