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

QSTP Client functions. More...

#include "qstp.h"
#include "../../QSC/QSC/rcs.h"
#include "../../QSC/QSC/socketclient.h"

Go to the source code of this file.

Functions

QSTP_EXPORT_API qstp_errors qstp_client_connect_ipv4 (const qstp_root_certificate *root, const qstp_server_certificate *cert, const qsc_ipinfo_ipv4_address *address, uint16_t port, void(*send_func)(qstp_connection_state *), void(*receive_callback)(qstp_connection_state *, const char *, size_t))
 Connect to the remote server using IPv4 and perform the key exchange.
 
QSTP_EXPORT_API qstp_errors qstp_client_connect_ipv6 (const qstp_root_certificate *root, const qstp_server_certificate *cert, const qsc_ipinfo_ipv6_address *address, uint16_t port, void(*send_func)(qstp_connection_state *), void(*receive_callback)(qstp_connection_state *, const char *, size_t))
 Connect to the remote server using IPv6 and perform the key exchange.
 

Detailed Description

QSTP Client functions.

This header defines functions used to implement the client in the Quantum Secure Tunneling Protocol (QSTP). The client connection functions enable a QSTP client to establish a secure connection to a remote QSTP server using the key exchange mechanism. In this process, the client authenticates the server by validating its certificate against a provided root certificate. The functions support both IPv4 and IPv6 network addresses.

The key exchange process performed by these functions includes:

  • Authenticating the server using the provided QSTP root certificate (as the trust anchor) and the server certificate.
  • Executing the key exchange protocol to establish a secure tunnel.
  • Invoking callback functions to manage outgoing messages and to process incoming data streams.

Upon successful completion, the QSTP connection state is established and returned through the callback functions. The return value is of type qstp_errors which indicates the success or failure of the connection attempt.

Function Documentation

◆ qstp_client_connect_ipv4()

QSTP_EXPORT_API qstp_errors qstp_client_connect_ipv4 ( const qstp_root_certificate * root,
const qstp_server_certificate * cert,
const qsc_ipinfo_ipv4_address * address,
uint16_t port,
void(* send_func )(qstp_connection_state *),
void(* receive_callback )(qstp_connection_state *, const char *, size_t) )

Connect to the remote server using IPv4 and perform the key exchange.

This function establishes a connection to a remote QSTP server over IPv4 and initiates the key exchange. It authenticates the server by verifying its certificate against the provided root certificate. After successful authentication and key exchange, a secure communication tunnel is established. The function then invokes the provided callback functions: one for managing the outgoing message send loop and another for processing the incoming server data stream.

Parameters
root[const] A pointer to the QSTP root certificate, serving as the trust anchor for server authentication.
cert[const] A pointer to the QSTP server certificate used for authenticating the server.
address[const] A pointer to the server's IPv4 network address.
portThe QSTP application port number (typically defined by QSTP_SERVER_PORT).
send_funcA pointer to the callback function responsible for the message send loop.
receive_callbackA pointer to the callback function used to process the server's incoming data stream.
Returns
Returns a value of type qstp_errors indicating the success or failure of the connection attempt.

◆ qstp_client_connect_ipv6()

QSTP_EXPORT_API qstp_errors qstp_client_connect_ipv6 ( const qstp_root_certificate * root,
const qstp_server_certificate * cert,
const qsc_ipinfo_ipv6_address * address,
uint16_t port,
void(* send_func )(qstp_connection_state *),
void(* receive_callback )(qstp_connection_state *, const char *, size_t) )

Connect to the remote server using IPv6 and perform the key exchange.

This function establishes a connection to a remote QSTP server over IPv6 and initiates the key exchange. The server is authenticated by validating its certificate against the provided QSTP root certificate. Following successful authentication and key exchange, a secure tunnel is established. The provided callback functions are then used to manage the outgoing message send loop and to process incoming server data.

Parameters
root[const] A pointer to the QSTP root certificate used as the trust anchor.
cert[const] A pointer to the QSTP server certificate.
address[const] A pointer to the server's IPv6 network address.
portThe QSTP application port number (typically defined by QSTP_SERVER_PORT).
send_funcA pointer to the callback function responsible for the message send loop.
receive_callbackA pointer to the callback function used to process the server's incoming data stream.
Returns
Returns a value of type qstp_errors representing the outcome of the connection and key exchange.