AERN: Authenticated Encrypted Relay Network 1.0.0.0a (A1)
A post quantum authenticated and encrypted proxy chain network
aern.h File Reference

AERN Common Definitions and Protocol Configuration. More...

#include "aerncommon.h"
#include "sha3.h"
#include "socketbase.h"
#include "rcs.h"

Go to the source code of this file.

Data Structures

struct  aern_certificate_expiration
 The certificate expiration time structure. More...
struct  aern_child_certificate
 The child certificate structure. More...
struct  aern_idg_hint
 The IDG hint structure. More...
struct  aern_idg_certificate
 The IDG certificate structure. More...
struct  aern_connection_state
 The AERN socket connection state structure. More...
struct  aern_keep_alive_state
 The AERN keep alive state structure. More...
struct  aern_mfkey_state
 The AERN master fragment key structure. More...
struct  aern_network_packet
 The AERN packet structure. More...
struct  aern_root_certificate
 The root certificate structure. More...
struct  aern_serialized_symmetric_key
 The structure for a serialized symmetric key. More...
struct  aern_signature_keypair
 The AERN asymmetric signature scheme key container. More...
struct  aern_cipher_keypair
 The AERN asymmetric cipher key container. More...

Macros

#define AERN_USE_RCS_ENCRYPTION
 If the RCS encryption option is chosen SKDP uses the more modern RCS stream cipher with KMAC/QMAC authentication. The default symmetric cipher/authenticator is AES-256/GCM (GMAC Counter Mode) NIST standardized per SP800-38a.
#define aern_cipher_state   qsc_rcs_state
#define aern_cipher_dispose   qsc_rcs_dispose
#define aern_cipher_initialize   qsc_rcs_initialize
#define aern_cipher_keyparams   qsc_rcs_keyparams
#define aern_cipher_set_associated   qsc_rcs_set_associated
#define aern_cipher_transform   qsc_rcs_transform
#define AERN_ACTIVE_VERSION   1U
 The AERN active version.
#define AERN_ACTIVE_VERSION_SIZE   2U
 The AERN active version size.
#define AERN_APS_FULL_TRUST   1000001U
 The full trust designation number.
#define AERN_APS_MINIMUM_TRUST   1U
 The minimum trust designation number.
#define AERN_APS_NAME_MAX_SIZE   256U
 The maximum aps name string length in characters. The last character must be a string terminator.
#define AERN_APS_TWOWAY_TRUST   1000002U
 The two-way trust designation number.
#define AERN_APPLICATION_ADC_PORT   38762U
 The default ADC port number.
#define AERN_APPLICATION_APS_PORT   38766U
 The default APS port number.
#define AERN_APPLICATION_ARS_PORT   38764U
 The default ARS port number.
#define AERN_APPLICATION_CLIENT_PORT   37761U
 The default AERN Client port number.
#define AERN_APPLICATION_IDG_PORT   38763U
 The default AERN IDG port number.
#define AERN_CANONICAL_NAME_MINIMUM_SIZE   3U
 The minimum canonical name size.
#define AERN_CERTIFICATE_ADDRESS_SIZE   22U
 The maximum IP address length.
#define AERN_CERTIFICATE_ALGORITHM_SIZE   1U
 The algorithm type.
#define AERN_CERTIFICATE_DEFAULT_PERIOD   ((uint64_t)365U * 24U * 60U * 60U)
 The default certificate validity period in milliseconds.
#define AERN_CERTIFICATE_DESIGNATION_SIZE   1U
 The size of the child certificate designation field.
#define AERN_CERTIFICATE_EXPIRATION_SIZE   16U
 The certificate expiration date length.
#define AERN_CERTIFICATE_HASH_SIZE   32U
 The size of the certificate hash in bytes.
#define AERN_CERTIFICATE_ISSUER_SIZE   256U
 The maximum certificate issuer string length. The last character must be a string terminator.
#define AERN_CERTIFICATE_LINE_LENGTH   64U
 The line length of the printed AERN certificate.
#define AERN_CERTIFICATE_MAXIMUM_PERIOD   (AERN_CERTIFICATE_DEFAULT_PERIOD * 2U)
 The maximum certificate validity period in milliseconds.
#define AERN_CERTIFICATE_MINIMUM_PERIOD   ((uint64_t)1U * 24U * 60U * 60U)
 The minimum certificate validity period in milliseconds.
#define AERN_CERTIFICATE_SERIAL_SIZE   16U
 The certificate serial number field length.
#define AERN_CERTIFICATE_HINT_SIZE   (AERN_CERTIFICATE_HASH_SIZE + AERN_CERTIFICATE_SERIAL_SIZE)
 The topological hint.
#define AERN_CERTIFICATE_SIGNED_HASH_SIZE   (AERN_ASYMMETRIC_SIGNATURE_SIZE + AERN_CERTIFICATE_HASH_SIZE)
 The size of the signature and hash field in a certificate.
#define AERN_CERTIFICATE_VERSION_SIZE   1U
 The version id.
#define AERN_CERTIFICATE_CHILD_SIZE
 The length of a child certificate.
#define AERN_CERTIFICATE_IDG_SIZE
 The length of an IDG certificate.
#define AERN_CERTIFICATE_ROOT_SIZE
 The length of the root certificate.
#define AERN_CRYPTO_SYMMETRIC_KEY_SIZE   32U
 The byte length of the symmetric cipher key.
#define AERN_CRYPTO_SYMMETRIC_NONCE_SIZE   32U
 The byte length of the symmetric cipher nonce.
#define AERN_CRYPTO_SEED_SIZE   64U
 The seed array byte size.
#define AERN_CRYPTO_SYMMETRIC_TOKEN_SIZE   32U
 The byte length of the symmetric token.
#define AERN_CRYPTO_SYMMETRIC_HASH_SIZE   32U
 The hash function output byte size.
#define AERN_CRYPTO_SYMMETRIC_MAC_SIZE   32U
 The MAC function output byte size.
#define AERN_CRYPTO_SYMMETRIC_SECRET_SIZE   32U
 The shared secret byte size.
#define AERN_CRYPTO_SYMMETRIC_SESSION_KEY_SIZE   32U
 The session key security size.
#define AERN_ADC_CONVERGENCE_INTERVAL   (60U * 60U * 24U)
 The interval between aps convergence checks (default is 24 hours).
#define AERN_ADC_IP_MAX   0x41U
 The maximum ip address length.
#define AERN_ADC_PENALTY_MAX   0x100U
 The maximum unreachable penalty before the ADC is deemed unreliable.
#define AERN_ADC_REDUCTION_INTERVAL   1000000UL
 The time before a penalty is reduced for a flapping ADC in milliseconds.
#define AERN_ADC_UPDATE_WAIT_TIME   (7U * 24U * 60U * 60U)
 The interval in milliseconds between topology full updates.
#define AERN_ERROR_STRING_DEPTH   26U
 The number of error strings.
#define AERN_ERROR_STRING_WIDTH   128U
 The maximum size in characters of an error string.
#define AERN_MESSAGE_MAX_SIZE   1400000UL
 The maximum message size (max signature + max certificate sizes).
#define AERN_MFK_EXPIRATION_PERIOD   ((uint64_t)60U * 24U * 60U * 60U)
 The MFK validity period in milliseconds.
#define AERN_MINIMUM_PATH_LENGTH   9U
 The minimum file path length.
#define AERN_NETWORK_CONNECTION_MTU   1500U
 The AERN packet buffer size.
#define AERN_NETWORK_DOMAIN_NAME_MAX_SIZE   256U
 The maximum domain name length in characters. The last character must be a string terminator.
#define AERN_NETWORK_MAX_APSS   1000000UL
 The maximum number of aps connections in a network.
#define AERN_NETWORK_NODE_ID_SIZE   16
 The node identification string length.
#define AERN_PERIOD_DAY_TO_SECONDS   (24U * 60U * 60U)
 A period of one day in seconds.
#define AERN_SOCKET_TERMINATOR_SIZE   1U
 The packet delimiter byte size.
#define AERN_PACKET_ERROR_SIZE   1U
 The packet error message byte size.
#define AERN_PACKET_HEADER_SIZE   22U
 The AERN packet header size.
#define AERN_PACKET_SUBHEADER_SIZE   16U
 The AERN packet sub-header size.
#define AERN_PACKET_SEQUENCE_TERMINATOR   0xFFFFFFFFUL
 The sequence number of a packet that closes a connection.
#define AERN_PACKET_TIME_SIZE   8U
 The byte size of the serialized packet time parameter.
#define AERN_PACKET_TIME_THRESHOLD   60U
 The maximum number of seconds a packet is valid.
#define AERN_NETWORK_TERMINATION_MESSAGE_SIZE   1U
 The network termination message size.
#define AERN_NETWORK_TERMINATION_PACKET_SIZE   (AERN_PACKET_HEADER_SIZE + AERN_NETWORK_TERMINATION_MESSAGE_SIZE)
 The network termination packet size.
#define AERN_X509_CERTIFICATE_SIZE   4096U
 x509 implementation where algorithm/signature output size is stored.
#define AERN_IDG_HINT_SIZE   (AERN_CERTIFICATE_HASH_SIZE + AERN_CERTIFICATE_SERIAL_SIZE)
 Hint query; certificate hash, root serial number hi=(H(cert) | rsn) idg query asks if a peer knows of the root security server for a domain; if the peer does know the root of the other domain, it sends back information about that rds (address, certificate hash, root serial number, and trust metric).
#define AERN_PROTOCOL_SET_SIZE   41U
 The size of the protocol configuration string.
#define AERN_NETWORK_ERROR_STRING_DEPTH   28U
#define AERN_NETWORK_ERROR_STRING_SIZE   128U

Typedefs

typedef AERN_EXPORT_API enum aern_configuration_sets aern_configuration_sets
typedef AERN_EXPORT_API enum aern_network_designations aern_network_designations
typedef AERN_EXPORT_API enum aern_network_errors aern_network_errors
typedef AERN_EXPORT_API enum aern_network_flags aern_network_flags
typedef AERN_EXPORT_API enum aern_protocol_errors aern_protocol_errors
typedef AERN_EXPORT_API enum aern_version_sets aern_version_sets
typedef AERN_EXPORT_API struct aern_certificate_expiration aern_certificate_expiration
typedef AERN_EXPORT_API struct aern_child_certificate aern_child_certificate
typedef AERN_EXPORT_API struct aern_idg_hint aern_idg_hint
typedef AERN_EXPORT_API struct aern_idg_certificate aern_idg_certificate
typedef AERN_EXPORT_API struct aern_connection_state aern_connection_state
typedef AERN_EXPORT_API struct aern_keep_alive_state aern_keep_alive_state
typedef struct aern_mfkey_state aern_mfkey_state
typedef AERN_EXPORT_API struct aern_network_packet aern_network_packet
typedef AERN_EXPORT_API struct aern_root_certificate aern_root_certificate
typedef AERN_EXPORT_API struct aern_serialized_symmetric_key aern_serialized_symmetric_key
typedef AERN_EXPORT_API struct aern_signature_keypair aern_signature_keypair
typedef AERN_EXPORT_API struct aern_cipher_keypair aern_cipher_keypair

Enumerations

enum  aern_configuration_sets {
  aern_configuration_set_none = 0x00U , aern_configuration_set_dilithium1_kyber1_rcs256_shake256 = 0x01U , aern_configuration_set_dilithium3_kyber3_rcs256_shake256 = 0x02U , aern_configuration_set_dilithium5_kyber5_rcs256_shake256 = 0x03U ,
  aern_configuration_set_dilithium5_kyber6_rcs512_shake256 = 0x04U , aern_configuration_set_sphincsplus1f_mceliece1_rcs256_shake256 = 0x05U , aern_configuration_set_sphincsplus1s_mceliece1_rcs256_shake256 = 0x06U , aern_configuration_set_sphincsplus3f_mceliece3_rcs256_shake256 = 0x07U ,
  aern_configuration_set_sphincsplus3s_mceliece3_rcs256_shake256 = 0x08U , aern_configuration_set_sphincsplus5f_mceliece5_rcs256_shake256 = 0x09U , aern_configuration_set_sphincsplus5s_mceliece5_rcs256_shake256 = 0x0AU , aern_configuration_set_sphincsplus5f_mceliece6_rcs256_shake256 = 0x0BU ,
  aern_configuration_set_sphincsplus5s_mceliece6_rcs256_shake256 = 0x0CU , aern_configuration_set_sphincsplus5f_mceliece7_rcs256_shake256 = 0x0DU , aern_configuration_set_sphincsplus5s_mceliece7_rcs256_shake256 = 0x0EU
}
 The AERN algorithm configuration sets. More...
enum  aern_network_designations {
  aern_network_designation_none = 0x00U , aern_network_designation_aps = 0x01U , aern_network_designation_client = 0x02U , aern_network_designation_ads = 0x03U ,
  aern_network_designation_remote = 0x04U , aern_network_designation_ars = 0x05U , aern_network_designation_revoked = 0x06U , aern_network_designation_idg = 0x07U ,
  aern_network_designation_all = 0xFFU
}
 The AERN device designation. More...
enum  aern_network_errors {
  aern_network_error_none = 0x00U , aern_network_error_accept_fail = 0x01U , aern_network_error_auth_failure = 0x02U , aern_network_error_bad_keep_alive = 0x03U ,
  aern_network_error_channel_down = 0x04U , aern_network_error_connection_failure = 0x05U , aern_network_error_decryption_failure = 0x06U , aern_network_error_establish_failure = 0x07U ,
  aern_network_error_general_failure = 0x08U , aern_network_error_hosts_exceeded = 0x09U , aern_network_error_identity_unknown = 0x10U , aern_network_error_invalid_input = 0x1AU ,
  aern_network_error_invalid_request = 0x1BU , aern_network_error_keep_alive_expired = 0x1CU , aern_network_error_keep_alive_timeout = 0x1DU , aern_network_error_kex_auth_failure = 0x1EU ,
  aern_network_error_key_not_recognized = 0x1FU , aern_network_error_key_has_expired = 0x20U , aern_network_error_listener_fail = 0x21U , aern_network_error_memory_allocation = 0x22U ,
  aern_network_error_packet_unsequenced = 0x23U , aern_network_error_random_failure = 0x24U , aern_network_error_ratchet_fail = 0x25U , aern_network_error_receive_failure = 0x26U ,
  aern_network_error_transmit_failure = 0x27U , aern_network_error_unknown_protocol = 0x28U , aern_network_error_unsequenced = 0x29U , aern_network_error_verify_failure = 0x2AU
}
 The AERN network error values. More...
enum  aern_network_flags {
  aern_network_flag_none = 0x00U , aern_network_flag_connection_terminate_request = 0x01U , aern_network_flag_error_condition = 0x02U , aern_network_flag_fragment_collection_request = 0x03U ,
  aern_network_flag_fragment_collection_response = 0x04U , aern_network_flag_fragment_request = 0x05U , aern_network_flag_fragment_response = 0x06U , aern_network_flag_fragment_query_request = 0x07U ,
  aern_network_flag_fragment_query_response = 0x08U , aern_network_flag_incremental_update_request = 0x09U , aern_network_flag_incremental_update_response = 0x0AU , aern_network_flag_register_request = 0x0BU ,
  aern_network_flag_register_response = 0x0CU , aern_network_flag_register_update_request = 0x0DU , aern_network_flag_register_update_response = 0x0EU , aern_network_flag_keep_alive_request = 0x0FU ,
  aern_network_flag_keep_alive_response = 0x10U , aern_network_flag_mfk_establish = 0x11U , aern_network_flag_mfk_request = 0x12U , aern_network_flag_mfk_response = 0x13U ,
  aern_network_flag_mfk_verify = 0x14U , aern_network_flag_network_announce_broadcast = 0x15U , aern_network_flag_network_converge_request = 0x16U , aern_network_flag_network_converge_response = 0x17U ,
  aern_network_flag_network_converge_update = 0x18U , aern_network_flag_network_resign_request = 0x19U , aern_network_flag_network_resign_response = 0x1AU , aern_network_flag_network_revocation_broadcast = 0x1BU ,
  aern_network_flag_network_signature_request = 0x1CU , aern_network_flag_system_error_condition = 0x1DU , aern_network_flag_tunnel_connection_terminate = 0x1EU , aern_network_flag_tunnel_encrypted_message = 0x1FU ,
  aern_network_flag_tunnel_session_established = 0x20U , aern_network_flag_tunnel_transfer_request = 0x21U , aern_network_flag_topology_query_request = 0x22U , aern_network_flag_topology_query_response = 0x23U ,
  aern_network_flag_topology_status_request = 0x24U , aern_network_flag_topology_status_response = 0x25U , aern_network_flag_topology_status_available = 0x26U , aern_network_flag_topology_status_synchronized = 0x27U ,
  aern_network_flag_topology_status_unavailable = 0x28U , aern_network_flag_network_remote_signing_request = 0x29U , aern_network_flag_network_remote_signing_response = 0x2AU
}
 The AERN network flags. More...
enum  aern_protocol_errors {
  aern_protocol_error_none = 0x00U , aern_protocol_error_authentication_failure = 0x01U , aern_protocol_error_certificate_not_found = 0x02U , aern_protocol_error_channel_down = 0x03U ,
  aern_protocol_error_connection_failure = 0x04U , aern_protocol_error_connect_failure = 0x05U , aern_protocol_error_convergence_failure = 0x06U , aern_protocol_error_convergence_synchronized = 0x07U ,
  aern_protocol_error_decapsulation_failure = 0x08U , aern_protocol_error_decoding_failure = 0x09U , aern_protocol_error_decryption_failure = 0x0AU , aern_protocol_error_establish_failure = 0x0BU ,
  aern_protocol_error_exchange_failure = 0x0CU , aern_protocol_error_file_not_deleted = 0x0DU , aern_protocol_error_file_not_found = 0x0EU , aern_protocol_error_file_not_written = 0x0FU ,
  aern_protocol_error_hash_invalid = 0x10U , aern_protocol_error_hosts_exceeded = 0x11U , aern_protocol_error_invalid_request = 0x12U , aern_protocol_error_certificate_expired = 0x13U ,
  aern_protocol_error_key_expired = 0x14U , aern_protocol_error_key_unrecognized = 0x15U , aern_protocol_error_listener_fail = 0x16U , aern_protocol_error_memory_allocation = 0x17U ,
  aern_protocol_error_message_time_invalid = 0x18U , aern_protocol_error_message_verification_failure = 0x19U , aern_protocol_error_no_usable_address = 0x1AU , aern_protocol_error_node_not_available = 0x1BU ,
  aern_protocol_error_node_not_found = 0x1CU , aern_protocol_error_node_was_registered = 0x1DU , aern_protocol_error_operation_cancelled = 0x1EU , aern_protocol_error_packet_header_invalid = 0x1FU ,
  aern_protocol_error_packet_unsequenced = 0x20U , aern_protocol_error_receive_failure = 0x21U , aern_protocol_error_root_signature_invalid = 0x22U , aern_protocol_error_serialization_failure = 0x23U ,
  aern_protocol_error_signature_failure = 0x24U , aern_protocol_error_signing_failure = 0x25U , aern_protocol_error_socket_binding = 0x26U , aern_protocol_error_socket_creation = 0x27U ,
  aern_protocol_error_transmit_failure = 0x28U , aern_protocol_error_topology_no_aps = 0x29U , aern_protocol_error_unknown_protocol = 0x2AU , aern_protocol_error_verification_failure = 0x2BU
}
 The AERN protocol error values. More...
enum  aern_version_sets { aern_version_set_none = 0x00U , aern_version_set_one_zero = 0x01U }
 The AERN version sets. More...

Functions

AERN_EXPORT_API void aern_connection_close (qsc_socket *rsock, aern_network_errors err, bool notify)
 Close the network connection between hosts.
AERN_EXPORT_API aern_protocol_errors aern_decrypt_packet (aern_connection_state *cns, uint8_t *message, size_t *msglen, const aern_network_packet *packetin)
 Decrypt a message and copy it to the output buffer.
AERN_EXPORT_API aern_protocol_errors aern_encrypt_packet (aern_connection_state *cns, aern_network_packet *packetout, const uint8_t *message, size_t msglen)
 Encrypt a message and build an output packet.
AERN_EXPORT_API void aern_connection_state_dispose (aern_connection_state *cns)
 Dispose of the tunnel connection state.
AERN_EXPORT_API const char * aern_network_error_to_string (aern_network_errors error)
 Return a pointer to a string description of a network error code.
AERN_EXPORT_API const char * aern_protocol_error_to_string (aern_protocol_errors error)
 Return a pointer to a string description of a protocol error code.
AERN_EXPORT_API void aern_packet_clear (aern_network_packet *packet)
 Clear the state of a network packet.
AERN_EXPORT_API void aern_packet_error_message (aern_network_packet *packet, aern_protocol_errors error)
 Populate a packet structure with an error message.
AERN_EXPORT_API void aern_packet_header_deserialize (const uint8_t *header, aern_network_packet *packet)
 Deserialize a byte array into a packet header.
AERN_EXPORT_API void aern_packet_header_serialize (const aern_network_packet *packet, uint8_t *header)
 Serialize a packet header into a byte array.
AERN_EXPORT_API void aern_packet_set_utc_time (aern_network_packet *packet)
 Set the local UTC time in the packet header.
AERN_EXPORT_API bool aern_packet_time_valid (const aern_network_packet *packet)
 Check if the packet's UTC time is within the valid time threshold.
AERN_EXPORT_API size_t aern_packet_to_stream (const aern_network_packet *packet, uint8_t *pstream)
 Serialize a network packet to a byte stream.
AERN_EXPORT_API void aern_stream_to_packet (const uint8_t *pstream, aern_network_packet *packet)
 Deserialize a byte stream into a network packet.

Detailed Description

AERN Common Definitions and Protocol Configuration.

This header defines the common constants, macros, enumerations, structures, and function prototypes for the Anonymous Encrypted Relay Network (AERN). It provides configuration for the cryptographic parameter sets, certificate handling, network protocol operations, and socket communication required to implement the AERN protocol.

The AERN protocol leverages a combination of asymmetric cipher and signature schemes from the QSC library. The parameter sets can be configured in the QSC library's common.h file. For maximum security, the McEliece/SPHINCS+ parameter set is recommended; for a balance of performance and security, the Dilithium/Kyber parameter set is advised.

Key components defined in this header include:

  • Function Mapping Macros: Aliases that map AERN high-level cryptographic operations (key generation, encapsulation/decapsulation, signing, and verification) to the corresponding functions in the QSC library, based on the selected configuration.
  • Modifiable Constants: Preprocessor definitions that enable or disable protocol features (e.g., client-to-client encrypted tunneling, master fragment key cycling, IPv6 networking, and extended session security).
  • Parameter Macros: Definitions for key sizes, certificate field sizes, network settings, and timing values that ensure consistency across the AERN protocol implementation.
  • Enumerations: Enumerated types for AERN configuration sets, network designations, network and protocol error codes, and version sets.
  • Structures: Data structures representing various certificates (ADC, APS, ROOT), connection and keep alive states, network packets, and cryptographic key pairs. These structures are central to protocol operations such as certificate management and secure message exchange.
  • Static Constants: Predefined strings for certificate header/footer information and network designation labels.
  • Public API Functions: Prototypes for functions handling connection management, packet encryption/decryption, packet serialization/deserialization, and error string conversion.
Note
When using the McEliece/SPHINCS+ configuration in Visual Studio, it is recommended to increase the maximum stack size (for example, to 200KB) to accommodate the larger key sizes.
Test
Although this header does not directly implement test routines, it underpins multiple test modules that validate:
  • The correct mapping of AERN high-level function calls to the underlying QSC library routines.
  • The consistency and accuracy of defined constants (e.g., key sizes, certificate sizes, network parameters).
  • The proper serialization/deserialization of packet headers and full packets (via aern_packet_header_serialize and aern_stream_to_packet).
  • The correct conversion of error codes to descriptive strings (using aern_network_error_to_string and aern_protocol_error_to_string).

These tests collectively ensure the robustness, consistency, and security of the AERN protocol configuration.

Macro Definition Documentation

◆ AERN_ADC_UPDATE_WAIT_TIME

#define AERN_ADC_UPDATE_WAIT_TIME   (7U * 24U * 60U * 60U)

The interval in milliseconds between topology full updates.

Note: Default is 7 days.

◆ AERN_CERTIFICATE_CHILD_SIZE

#define AERN_CERTIFICATE_CHILD_SIZE
Value:
AERN_ASYMMETRIC_VERIFICATION_KEY_SIZE + \
#define AERN_CERTIFICATE_EXPIRATION_SIZE
The certificate expiration date length.
Definition aern.h:800
#define AERN_CERTIFICATE_ISSUER_SIZE
The maximum certificate issuer string length. The last character must be a string terminator.
Definition aern.h:813
#define AERN_CERTIFICATE_ALGORITHM_SIZE
The algorithm type.
Definition aern.h:782
#define AERN_CERTIFICATE_SIGNED_HASH_SIZE
The size of the signature and hash field in a certificate.
Definition aern.h:849
#define AERN_CERTIFICATE_DESIGNATION_SIZE
The size of the child certificate designation field.
Definition aern.h:794
#define AERN_CERTIFICATE_VERSION_SIZE
The version id.
Definition aern.h:855
#define AERN_CERTIFICATE_SERIAL_SIZE
The certificate serial number field length.
Definition aern.h:837

The length of a child certificate.

◆ AERN_CERTIFICATE_IDG_SIZE

#define AERN_CERTIFICATE_IDG_SIZE
Value:
(AERN_ASYMMETRIC_SIGNATURE_SIZE + \
AERN_ASYMMETRIC_VERIFICATION_KEY_SIZE + \
#define AERN_CERTIFICATE_ADDRESS_SIZE
The maximum IP address length.
Definition aern.h:776
#define AERN_CERTIFICATE_HASH_SIZE
The size of the certificate hash in bytes.
Definition aern.h:806

The length of an IDG certificate.

◆ AERN_CERTIFICATE_ROOT_SIZE

#define AERN_CERTIFICATE_ROOT_SIZE

Enumeration Type Documentation

◆ aern_configuration_sets

The AERN algorithm configuration sets.

Enumerator
aern_configuration_set_none 

No algorithm identifier is set

aern_configuration_set_dilithium1_kyber1_rcs256_shake256 

The Dilithium-S1/Kyber-S1/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_dilithium3_kyber3_rcs256_shake256 

The Dilithium-S3/Kyber-S3/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_dilithium5_kyber5_rcs256_shake256 

The Dilithium-S5/Kyber-S5/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_dilithium5_kyber6_rcs512_shake256 

The Dilithium-S5/Kyber-S6/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus1f_mceliece1_rcs256_shake256 

The SPHINCS+-S1F/McEliece-S1/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus1s_mceliece1_rcs256_shake256 

The SPHINCS+-S1S/McEliece-S1/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus3f_mceliece3_rcs256_shake256 

The SPHINCS+-S3F/McEliece-S3/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus3s_mceliece3_rcs256_shake256 

The SPHINCS+-S3S/McEliece-S3/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5f_mceliece5_rcs256_shake256 

The SPHINCS+-S5F/McEliece-S5a/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5s_mceliece5_rcs256_shake256 

The SPHINCS+-S5S/McEliece-S5a/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5f_mceliece6_rcs256_shake256 

The SPHINCS+-S5F/McEliece-S5b/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5s_mceliece6_rcs256_shake256 

The SPHINCS+-S5S/McEliece-S5b/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5f_mceliece7_rcs256_shake256 

The SPHINCS+-S5F/McEliece-S5c/RCS-256/SHAKE-256 algorithm set

aern_configuration_set_sphincsplus5s_mceliece7_rcs256_shake256 

The SPHINCS+-S5S/McEliece-S5c/RCS-256/SHAKE-256 algorithm set

◆ aern_network_designations

The AERN device designation.

Enumerator
aern_network_designation_none 

No designation was selected

aern_network_designation_aps 

The device is an APS

aern_network_designation_client 

The device is a client

aern_network_designation_ads 

The device is the ADC

aern_network_designation_remote 

The device is a remote aps

aern_network_designation_ars 

The device is an ARS security server

aern_network_designation_revoked 

The device has been revoked

aern_network_designation_idg 

The device is the IDG

aern_network_designation_all 

Every server and client device on the network

◆ aern_network_errors

The AERN network error values.

Enumerator
aern_network_error_none 

No error was detected

aern_network_error_accept_fail 

The socket accept function returned an error

aern_network_error_auth_failure 

The cipher authentication has failed

aern_network_error_bad_keep_alive 

The keep alive check failed

aern_network_error_channel_down 

The communications channel has failed

aern_network_error_connection_failure 

The device could not make a connection to the remote host

aern_network_error_decryption_failure 

The decryption authentication has failed

aern_network_error_establish_failure 

The transmission failed at the kex establish phase

aern_network_error_general_failure 

The connection experienced an unexpected error

aern_network_error_hosts_exceeded 

The server has run out of socket connections

aern_network_error_identity_unknown 

The random generator experienced a failure

aern_network_error_invalid_input 

The input is invalid

aern_network_error_invalid_request 

The request is invalid

aern_network_error_keep_alive_expired 

The keep alive has expired with no response

aern_network_error_keep_alive_timeout 

The keepalive failure counter has exceeded maximum

aern_network_error_kex_auth_failure 

The kex authentication has failed

aern_network_error_key_not_recognized 

The key-id is not recognized

aern_network_error_key_has_expired 

The certificate has expired

aern_network_error_listener_fail 

The listener function failed to initialize

aern_network_error_memory_allocation 

The server has run out of memory

aern_network_error_packet_unsequenced 

The random generator experienced a failure

aern_network_error_random_failure 

The random generator experienced a failure

aern_network_error_ratchet_fail 

The ratchet operation has failed

aern_network_error_receive_failure 

The receiver failed at the network layer

aern_network_error_transmit_failure 

The transmitter failed at the network layer

aern_network_error_unknown_protocol 

The protocol version is unknown

aern_network_error_unsequenced 

The packet was received out of sequence

aern_network_error_verify_failure 

The expected data could not be verified

◆ aern_network_flags

The AERN network flags.

Enumerator
aern_network_flag_none 

No flag was selected

aern_network_flag_connection_terminate_request 

The packet contains a connection termination message

aern_network_flag_error_condition 

The connection experienced an error message

aern_network_flag_fragment_collection_request 

The packet contains a server fragment collection request message

aern_network_flag_fragment_collection_response 

The packet contains an aps fragment collection response message

aern_network_flag_fragment_request 

The packet contains a server fragment key request message

aern_network_flag_fragment_response 

The packet contains an aps fragment key response message

aern_network_flag_fragment_query_request 

The packet contains a server fragment key request message

aern_network_flag_fragment_query_response 

The packet contains an aps fragment key response message

aern_network_flag_incremental_update_request 

The packet contains an incremental update request message

aern_network_flag_incremental_update_response 

The packet contains an incremental update response message

aern_network_flag_register_request 

The packet contains a join request message

aern_network_flag_register_response 

The packet contains a join response message

aern_network_flag_register_update_request 

The packet contains a join update request message

aern_network_flag_register_update_response 

The packet contains a join update response message

aern_network_flag_keep_alive_request 

The packet contains a keep alive request

aern_network_flag_keep_alive_response 

The packet contains a keep alive response

aern_network_flag_mfk_establish 

The packet contains a server master fragment key establish message

aern_network_flag_mfk_request 

The packet contains a server master fragment key request message

aern_network_flag_mfk_response 

The packet contains a client mfk exchange response message

aern_network_flag_mfk_verify 

The packet contains a server master fragment key verify message

aern_network_flag_network_announce_broadcast 

The packet contains a topology announce broadcast

aern_network_flag_network_converge_request 

The packet contains a network converge request message

aern_network_flag_network_converge_response 

The packet contains a network converge response message

aern_network_flag_network_converge_update 

The packet contains a network converge update message

aern_network_flag_network_resign_request 

The packet contains a network resignation request message

aern_network_flag_network_resign_response 

The packet contains a network resignation response message

aern_network_flag_network_revocation_broadcast 

The packet contains a certificate revocation broadcast

aern_network_flag_network_signature_request 

The packet contains a certificate signing request

aern_network_flag_system_error_condition 

The packet contains an error condition message

aern_network_flag_tunnel_connection_terminate 

The packet contains a socket close message

aern_network_flag_tunnel_encrypted_message 

The packet contains an encrypted message

aern_network_flag_tunnel_session_established 

The exchange is in the established state

aern_network_flag_tunnel_transfer_request 

Reserved - The host has received a transfer request

aern_network_flag_topology_query_request 

The packet contains a topology query request message

aern_network_flag_topology_query_response 

The packet contains a topology query response message

aern_network_flag_topology_status_request 

The packet contains a topology status request message

aern_network_flag_topology_status_response 

The packet contains a topology status response message

aern_network_flag_topology_status_available 

The packet contains a topology status available message

aern_network_flag_topology_status_synchronized 

The packet contains a topology status synchronized message

aern_network_flag_topology_status_unavailable 

The packet contains a topology status unavailable message

aern_network_flag_network_remote_signing_request 

The packet contains a remote signing request message

aern_network_flag_network_remote_signing_response 

The packet contains a remote signing response message

◆ aern_protocol_errors

The AERN protocol error values.

Enumerator
aern_protocol_error_none 

No error was detected

aern_protocol_error_authentication_failure 

The symmetric cipher had an authentication failure

aern_protocol_error_certificate_not_found 

The node certificate could not be found

aern_protocol_error_channel_down 

The communications channel has failed

aern_protocol_error_connection_failure 

The device could not make a connection to the remote host

aern_protocol_error_connect_failure 

The transmission failed at the KEX connection phase

aern_protocol_error_convergence_failure 

The convergence call has returned an error

aern_protocol_error_convergence_synchronized 

The database is already synchronized

aern_protocol_error_decapsulation_failure 

The asymmetric cipher failed to decapsulate the shared secret

aern_protocol_error_decoding_failure 

The node or certificate decoding failed

aern_protocol_error_decryption_failure 

The decryption authentication has failed

aern_protocol_error_establish_failure 

The transmission failed at the KEX establish phase

aern_protocol_error_exchange_failure 

The transmission failed at the KEX exchange phase

aern_protocol_error_file_not_deleted 

The application could not delete a local file

aern_protocol_error_file_not_found 

The file could not be found

aern_protocol_error_file_not_written 

The file could not be written to storage

aern_protocol_error_hash_invalid 

The public-key hash is invalid

aern_protocol_error_hosts_exceeded 

The server has run out of socket connections

aern_protocol_error_invalid_request 

The packet flag was unexpected

aern_protocol_error_certificate_expired 

The certificate has expired

aern_protocol_error_key_expired 

The AERN public key has expired

aern_protocol_error_key_unrecognized 

The key identity is unrecognized

aern_protocol_error_listener_fail 

The listener function failed to initialize

aern_protocol_error_memory_allocation 

The server has run out of memory

aern_protocol_error_message_time_invalid 

The network time is invalid or has substantial delay

aern_protocol_error_message_verification_failure 

The expected data could not be verified

aern_protocol_error_no_usable_address 

The server has no usable IP address, assign in configuration

aern_protocol_error_node_not_available 

The node is not available for a session

aern_protocol_error_node_not_found 

The node could not be found in the database

aern_protocol_error_node_was_registered 

The node was previously registered in the database

aern_protocol_error_operation_cancelled 

The operation was cancelled by the user

aern_protocol_error_packet_header_invalid 

The packet header received was invalid

aern_protocol_error_packet_unsequenced 

The packet was received out of sequence

aern_protocol_error_receive_failure 

The receiver failed at the network layer

aern_protocol_error_root_signature_invalid 

The root signature failed authentication

aern_protocol_error_serialization_failure 

The certificate could not be serialized

aern_protocol_error_signature_failure 

The signature scheme could not sign a message

aern_protocol_error_signing_failure 

The transmission failed to sign the data

aern_protocol_error_socket_binding 

The socket could not be bound to an IP address

aern_protocol_error_socket_creation 

The socket could not be created

aern_protocol_error_transmit_failure 

The transmitter failed at the network layer

aern_protocol_error_topology_no_aps 

The topological database has no aps entries

aern_protocol_error_unknown_protocol 

The protocol string was not recognized

aern_protocol_error_verification_failure 

The transmission failed at the KEX verify phase

◆ aern_version_sets

The AERN version sets.

Enumerator
aern_version_set_none 

No version identifier is set

aern_version_set_one_zero 

The 1.0 version identifier

Function Documentation

◆ aern_connection_close()

AERN_EXPORT_API void aern_connection_close ( qsc_socket * rsock,
aern_network_errors err,
bool notify )

Close the network connection between hosts.

Parameters
rsockA pointer to the socket structure representing the connection.
errThe network error code to report.
notifyIf true, notify the remote host that the connection is closing.

◆ aern_connection_state_dispose()

AERN_EXPORT_API void aern_connection_state_dispose ( aern_connection_state * cns)

Dispose of the tunnel connection state.

Parameters
cnsA pointer to the connection state structure to dispose.

◆ aern_decrypt_packet()

AERN_EXPORT_API aern_protocol_errors aern_decrypt_packet ( aern_connection_state * cns,
uint8_t * message,
size_t * msglen,
const aern_network_packet * packetin )

Decrypt a message and copy it to the output buffer.

Parameters
cnsA pointer to the connection state structure.
messageThe output array for the decrypted message.
msglenA pointer to a variable that will receive the length of the decrypted message.
packetin[const] A pointer to the input packet structure.
Returns
Returns the network error state.

◆ aern_encrypt_packet()

AERN_EXPORT_API aern_protocol_errors aern_encrypt_packet ( aern_connection_state * cns,
aern_network_packet * packetout,
const uint8_t * message,
size_t msglen )

Encrypt a message and build an output packet.

Parameters
cnsA pointer to the connection state structure.
packetoutA pointer to the output packet structure.
message[const] The input message array.
msglenThe length of the input message.
Returns
Returns the network error state.

◆ aern_network_error_to_string()

AERN_EXPORT_API const char * aern_network_error_to_string ( aern_network_errors error)

Return a pointer to a string description of a network error code.

Parameters
errorThe network error code.
Returns
Returns a pointer to an error string or NULL if the code is unrecognized.

◆ aern_packet_clear()

AERN_EXPORT_API void aern_packet_clear ( aern_network_packet * packet)

Clear the state of a network packet.

Parameters
packetA pointer to the packet structure to clear.

◆ aern_packet_error_message()

AERN_EXPORT_API void aern_packet_error_message ( aern_network_packet * packet,
aern_protocol_errors error )

Populate a packet structure with an error message.

Parameters
packetA pointer to the packet structure.
errorThe protocol error code to embed in the packet.

◆ aern_packet_header_deserialize()

AERN_EXPORT_API void aern_packet_header_deserialize ( const uint8_t * header,
aern_network_packet * packet )

Deserialize a byte array into a packet header.

Parameters
header[const] The header byte array to deserialize.
packetA pointer to the packet structure that will be populated.

◆ aern_packet_header_serialize()

AERN_EXPORT_API void aern_packet_header_serialize ( const aern_network_packet * packet,
uint8_t * header )

Serialize a packet header into a byte array.

Parameters
packet[const] A pointer to the packet structure to serialize.
headerThe byte array that will receive the serialized header.

◆ aern_packet_set_utc_time()

AERN_EXPORT_API void aern_packet_set_utc_time ( aern_network_packet * packet)

Set the local UTC time in the packet header.

Parameters
packetA pointer to the network packet.

◆ aern_packet_time_valid()

AERN_EXPORT_API bool aern_packet_time_valid ( const aern_network_packet * packet)

Check if the packet's UTC time is within the valid time threshold.

Parameters
packet[const] A pointer to the network packet.
Returns
Returns true if the packet was received within the valid time threshold.

◆ aern_packet_to_stream()

AERN_EXPORT_API size_t aern_packet_to_stream ( const aern_network_packet * packet,
uint8_t * pstream )

Serialize a network packet to a byte stream.

Parameters
packet[const] A pointer to the packet.
pstreamA pointer to the output byte stream.
Returns
Returns the size of the serialized byte stream.

◆ aern_protocol_error_to_string()

AERN_EXPORT_API const char * aern_protocol_error_to_string ( aern_protocol_errors error)

Return a pointer to a string description of a protocol error code.

Parameters
errorThe protocol error code.
Returns
Returns a pointer to an error string or NULL if the code is unrecognized.

◆ aern_stream_to_packet()

AERN_EXPORT_API void aern_stream_to_packet ( const uint8_t * pstream,
aern_network_packet * packet )

Deserialize a byte stream into a network packet.

Parameters
pstream[const] The byte stream containing the packet data.
packetA pointer to the packet structure to populate.