DKTP: Dual Key Tunneling Protocol 1.0.0.0a (A1)
A quantum secure dual-key encrypted tunneling protocol
kex.h File Reference

DKTP Key Exchange Functions. More...

#include "dktp.h"

Go to the source code of this file.

Data Structures

struct  dktp_kex_client_state
 Internal state for the Duplex key exchange (client-side). More...
struct  dktp_kex_server_state
 Internal state for the Duplex key exchange (server-side). More...

Typedefs

typedef struct dktp_kex_client_state dktp_kex_client_state
typedef struct dktp_kex_server_state dktp_kex_server_state

Functions

dktp_errors dktp_kex_server_key_exchange (dktp_kex_server_state *kss, dktp_connection_state *cns)
 Execute the server-side key exchange.
dktp_errors dktp_kex_client_key_exchange (dktp_kex_client_state *kcs, dktp_connection_state *cns)
 Execute the client-side key exchange.
bool dktp_kex_test (void)
 Run internal tests for the key exchange functions.

Detailed Description

DKTP Key Exchange Functions.

This header file contains the internal key exchange functions for the Dual Key Tunneling Protocol (DKTP).

The file defines internal state structures for both the client and server roles in the key exchange. These structures encapsulate various cryptographic parameters such as key identities, session token hashes, asymmetric keys (for encryption, signing, and verification), shared secrets, and session expiration times.

The following internal (non-exportable) functions are declared:

  • dktp_kex_server_key_exchange: Executes the server-side Duplex key exchange.
  • dktp_kex_client_key_exchange: Executes the client-side Duplex key exchange.
  • dktp_kex_simplex_server_key_exchange: Executes the server-side Simplex key exchange.
  • dktp_kex_simplex_client_key_exchange: Executes the client-side Simplex key exchange.
  • dktp_kex_test: Runs a suite of internal tests to validate the correctness of the key exchange operations.
Note
These functions and state structures are internal and are not part of the public DKTP API.

Function Documentation

◆ dktp_kex_client_key_exchange()

dktp_errors dktp_kex_client_key_exchange ( dktp_kex_client_state * kcs,
dktp_connection_state * cns )

Execute the client-side key exchange.

This function initiates and completes the key exchange from the client side. It processes the server's response, computes the shared secret, and updates the DKTP connection state with the derived cryptographic parameters.

Parameters
kcsA pointer to the client key exchange state structure.
cnsA pointer to the current DKTP connection state.
Returns
Returns a value of type dktp_errors representing the result of the key exchange operation.
Note
This is an internal non-exportable API.

◆ dktp_kex_server_key_exchange()

dktp_errors dktp_kex_server_key_exchange ( dktp_kex_server_state * kss,
dktp_connection_state * cns )

Execute the server-side key exchange.

This function processes an incoming key exchange request on the server side. It uses the server key exchange state (dktp_kex_server_state) to verify client credentials, exchange the necessary asymmetric keys, and update the DKTP connection state accordingly.

Parameters
kssA pointer to the server key exchange state structure.
cnsA pointer to the current DKTP connection state.
Returns
Returns a value of type dktp_errors indicating the outcome of the key exchange process.
Note
This is an internal non-exportable API.

◆ dktp_kex_test()

bool dktp_kex_test ( void )

Run internal tests for the key exchange functions.

This function executes a suite of internal tests designed to validate the correct operation of the DKTP key exchange mechanisms. The tests include:

  • Verifying the proper initialization and management of state structures.
  • Testing the cryptographic operations involved in key generation, shared secret derivation, and session token hashing.
  • Ensuring that the key exchange functions correctly update the DKTP connection state.

The function returns true if all internal tests pass, confirming the reliability and correctness of the key exchange implementation.

Returns
Returns true if the key exchange tests succeed; otherwise, false.
Note
This is an internal non-exportable API.