Quantum Secure Tunneling Protocol 1.0.0.0a (A1)
A three-party quantum secure encrypted tunneling protocol
kex.h File Reference

QSTP key exchange functions. More...

#include "common.h"
#include "../QSTP/qstp.h"

Go to the source code of this file.

Data Structures

struct  qstp_kex_client_state
 The QSTP client state structure. More...
 
struct  qstp_kex_server_state
 The QSTP server state structure. More...
 

Typedefs

typedef struct qstp_kex_client_state qstp_kex_client_state
 
typedef struct qstp_kex_server_state qstp_kex_server_state
 

Functions

qstp_errors qstp_kex_server_key_exchange (qstp_kex_server_state *kss, qstp_connection_state *cns)
 Run the network server version of the key exchange.
 
qstp_errors qstp_kex_client_key_exchange (qstp_kex_client_state *kcs, qstp_connection_state *cns)
 Run the network client version of the key exchange.
 

Detailed Description

QSTP key exchange functions.

This header defines internal functions and state structures used for performing the key exchange in the Quantum Secure Tunneling Protocol (QSTP). The key exchange is a one-way process in which the client receives cryptographic parameters from the server that are used to establish a secure tunnel.

The key exchange mechanism in QSTP is responsible for:

  • Verifying the server's certificate serial number and public verification key.
  • Validating a session token hash to ensure the integrity of the key exchange.
  • Establishing an expiration time for the key exchange session.

The following state structures are defined:

  • qstp_kex_client_state: Used by the client during the key exchange, it stores the session token hash, the server certificate serial number, the server's asymmetric signature verification key, and an expiration timestamp.
  • qstp_kex_server_state: Used by the server during the key exchange, it holds pointers to the server's private and public asymmetric cipher keys, a certificate serial number (serving as the key identity), a session token hash, the server's private signing key, the local public verification key, and an expiration timestamp.

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

  • qstp_kex_server_key_exchange: Executes the server-side operations of the key exchange by processing the client's request, verifying the cryptographic parameters, and updating the connection state.
  • qstp_kex_client_key_exchange: Executes the client-side operations of the key exchange by processing the server's response, extracting the cryptographic parameters, and ensuring the key exchange completes successfully.
Note
These functions and structures are internal to QSTP and are not part of the public API.

Function Documentation

◆ qstp_kex_client_key_exchange()

qstp_errors qstp_kex_client_key_exchange ( qstp_kex_client_state * kcs,
qstp_connection_state * cns )

Run the network client version of the key exchange.

This internal function executes the client-side key exchange. It processes the response from the server, extracts the session token hash, server certificate serial number, and the server's public verification key, and verifies the expiration timestamp to ensure the key exchange is valid.

Note
This is an internal non-exportable API.
Parameters
kcsA pointer to the client key exchange state structure (qstp_kex_client_state).
cnsA pointer to the QSTP connection state structure.
Returns
Returns a value of type qstp_errors indicating the success or failure of the key exchange.

◆ qstp_kex_server_key_exchange()

qstp_errors qstp_kex_server_key_exchange ( qstp_kex_server_state * kss,
qstp_connection_state * cns )

Run the network server version of the key exchange.

This internal function performs the server-side key exchange. It processes the client's key exchange request by using the server key exchange state. The function validates the received session token hash, certificate serial number, and updates the QSTP connection state accordingly.

Note
This is an internal non-exportable API.
Parameters
kssA pointer to the server key exchange state structure (qstp_kex_server_state).
cnsA pointer to the QSTP connection state structure.
Returns
Returns a value of type qstp_errors indicating the outcome of the key exchange.