ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
crypto_handshake_context_t Struct Reference

Cryptographic handshake context structure. More...

#include <include/ascii-chat/crypto/handshake/common.h>

Data Fields

crypto_context_t crypto_ctx
crypto_handshake_state_t state
bool is_server
uint8_t password_failure
bool defer_password_prompt
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]
uint8_t expected_server_key_bytes [32]
bool expected_server_key_bytes_set
char client_gpg_key_id [(20 *2+1)]
char server_hostname [256]
char server_ip [256]
uint16_t server_port
bool addressless_transport
bool verify_server_key
bool require_client_auth
bool allow_unlisted_client_identity
 Require proof of key possession without whitelist membership (discovery).
bool server_uses_client_auth
char client_keys_path [4096]
public_key_t * client_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 80 of file crypto/handshake/common.h.

Field Documentation

◆ addressless_transport

bool crypto_handshake_context_t::addressless_transport

Authentication configuration Peer transports use explicit identities, not IP:port TOFU.

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

Referenced by acip_security_start(), and crypto_handshake_client_key_exchange().

◆ allow_unlisted_client_identity

bool crypto_handshake_context_t::allow_unlisted_client_identity

Require proof of key possession without whitelist membership (discovery).

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

Referenced by crypto_handshake_server_auth_challenge().

◆ 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 129 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 120 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 121 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[(20 *2+1)]

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

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

Referenced by acip_security_init_options(), and crypto_handshake_client_key_exchange().

◆ client_keys_path

char crypto_handshake_context_t::client_keys_path[4096]

Server: client keys file path (whitelist)

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

◆ client_private_key

private_key_t crypto_handshake_context_t::client_private_key

◆ 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 93 of file crypto/handshake/common.h.

Referenced by acip_security_init_options(), discovery_session_start(), and peer_crypto_create().

◆ client_sent_identity

bool crypto_handshake_context_t::client_sent_identity

Whether client provided an identity key during handshake

Definition at line 122 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 118 of file crypto/handshake/common.h.

Referenced by acip_security_cleanup(), acip_security_init_options(), crypto_handshake_server_auth_challenge(), and peer_crypto_create().

◆ crypto_ctx

◆ defer_password_prompt

bool crypto_handshake_context_t::defer_password_prompt

Application owns interactive password entry and reconnect.

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

Referenced by crypto_handshake_client_auth_response(), crypto_handshake_client_complete(), and network_connection_establish().

◆ expected_server_key

char crypto_handshake_context_t::expected_server_key[256]

Expected server key fingerprint (client only, for known_hosts)

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

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

◆ expected_server_key_bytes

uint8_t crypto_handshake_context_t::expected_server_key_bytes[32]

Expected Ed25519 identity key supplied by a browser client

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

Referenced by crypto_handshake_client_key_exchange(), peer_crypto_create(), and peer_crypto_receive().

◆ expected_server_key_bytes_set

bool crypto_handshake_context_t::expected_server_key_bytes_set

Whether expected_server_key_bytes is configured

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

Referenced by crypto_handshake_client_key_exchange(), and peer_crypto_create().

◆ has_password

bool crypto_handshake_context_t::has_password

Password authentication Whether password authentication is enabled

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

Referenced by acip_security_receive(), and crypto_handshake_init_with_password().

◆ is_server

bool crypto_handshake_context_t::is_server

◆ num_whitelisted_clients

size_t crypto_handshake_context_t::num_whitelisted_clients

Number of whitelisted clients

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

Referenced by acip_security_init_options(), crypto_handshake_server_auth_challenge(), and peer_crypto_create().

◆ password

char crypto_handshake_context_t::password[256]

Password for authentication (temporary storage, cleared after use)

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

Referenced by crypto_handshake_init_with_password().

◆ password_failure

uint8_t crypto_handshake_context_t::password_failure

Password-only rejection flags, for application-owned retry.

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

Referenced by crypto_handshake_client_auth_response(), crypto_handshake_client_complete(), and network_connection_establish().

◆ 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 105 of file crypto/handshake/common.h.

Referenced by acip_security_init_options(), and network_connection_prepare_security().

◆ server_ip

char crypto_handshake_context_t::server_ip[256]

Server IP address (resolved from connection)

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

Referenced by crypto_handshake_client_key_exchange(), and network_connection_prepare_security().

◆ server_port

uint16_t crypto_handshake_context_t::server_port

◆ 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 90 of file crypto/handshake/common.h.

Referenced by acip_security_init_options(), crypto_handshake_server_send_parameters(), crypto_handshake_server_start(), and peer_crypto_create().

◆ 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 89 of file crypto/handshake/common.h.

Referenced by acip_security_init_options(), crypto_handshake_server_start(), and peer_crypto_create().

◆ server_uses_client_auth

bool crypto_handshake_context_t::server_uses_client_auth

Client: whether server requested client authentication

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

Referenced by 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

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