|
UDIF: Universal Digital Identification Framework 1.0.0.0a (A1)
A quantum-secure cryptographic identification
|
UDIF Common Definitions and Core Library Configuration. More...
#include "udifcommon.h"#include "sha3.h"#include "socketbase.h"#include "rcs.h"Go to the source code of this file.
Macros | |
| #define | UDIF_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 | udif_cipher_state qsc_rcs_state |
| #define | udif_cipher_dispose qsc_rcs_dispose |
| #define | udif_cipher_initialize qsc_rcs_initialize |
| #define | udif_cipher_keyparams qsc_rcs_keyparams |
| #define | udif_cipher_set_associated qsc_rcs_set_associated |
| #define | udif_cipher_transform qsc_rcs_transform |
| #define | UDIF_CLAIM_ANCHOR_SIZE 32U |
| The size of a claim anchor or merkle root in bytes. | |
| #define | UDIF_POLICY_HASH_SIZE 32U |
| The size of a policy identifier hash in bytes. | |
| #define | UDIF_PERMISSION_MASK_SIZE 8U |
| The size of a permission mask in bytes. | |
| #define | UDIF_CAPABILITY_MASK_SIZE 8U |
| The size of a capability mask in hex characters. | |
| #define | UDIF_CAPABILITY_TOKEN_MAX_SIZE 2048U |
| The maximum size of a serialized capability token. | |
| #define | UDIF_SUITEID_SIZE 1U |
| The UDIF suite id parameter size. | |
| #define | UDIF_ROLE_SIZE 1U |
| The UDIF role parameter size. | |
| #define | UDIF_MINIMUM_TRUST 1U |
| The minimum trust designation number. | |
| #define | UDIF_NAME_MAX_SIZE 256U |
| The maximum aps name string length in characters. The last character must be a string terminator. | |
| #define | UDIF_TWOWAY_TRUST 1000002U |
| The two-way trust designation number. | |
| #define | UDIF_APPLICATION_CLIENT_PORT 39761U |
| The default UDIF Client port number. | |
| #define | UDIF_APPLICATION_IDG_PORT 39762U |
| The default UDIF IDG port number. | |
| #define | UDIF_APPLICATION_UBC_PORT 39763U |
| The default UBC port number. | |
| #define | UDIF_APPLICATION_UGC_PORT 39764U |
| The default UGC port number. | |
| #define | UDIF_APPLICATION_URA_PORT 39765U |
| The default UUA port number. | |
| #define | UDIF_APPLICATION_UUA_PORT 39766U |
| The default UUA port number. | |
| #define | UDIF_CANONICAL_NAME_MINIMUM_SIZE 3U |
| The minimum canonical name size. | |
| #define | UDIF_CERTIFICATE_ADDRESS_SIZE 22U |
| The maximum IP address length. | |
| #define | UDIF_CERTIFICATE_ALGORITHM_SIZE 1U |
| The algorithm type. | |
| #define | UDIF_CERTIFICATE_DEFAULT_PERIOD ((uint64_t)365U * 24U * 60U * 60U) |
| The default certificate validity period in milliseconds. | |
| #define | UDIF_CERTIFICATE_DESIGNATION_SIZE 1U |
| The size of the child certificate designation field. | |
| #define | UDIF_CERTIFICATE_EXPIRATION_SIZE 16U |
| The certificate expiration date length. | |
| #define | UDIF_CERTIFICATE_HASH_SIZE 32U |
| The size of the certificate hash in bytes. | |
| #define | UDIF_CERTIFICATE_ISSUER_SIZE 256U |
| The maximum certificate issuer string length. The last character must be a string terminator. | |
| #define | UDIF_CERTIFICATE_LINE_LENGTH 64U |
| The line length of the printed UDIF certificate. | |
| #define | UDIF_CERTIFICATE_MAXIMUM_PERIOD (UDIF_CERTIFICATE_DEFAULT_PERIOD * 2U) |
| The maximum certificate validity period in milliseconds. | |
| #define | UDIF_CERTIFICATE_MINIMUM_PERIOD ((uint64_t)1U * 24U * 60U * 60U) |
| The minimum certificate validity period in milliseconds. | |
| #define | UDIF_CERTIFICATE_SERIAL_SIZE 16U |
| The certificate serial number field length. | |
| #define | UDIF_CERTIFICATE_HINT_SIZE (UDIF_CERTIFICATE_HASH_SIZE + UDIF_CERTIFICATE_SERIAL_SIZE) |
| The topological hint. | |
| #define | UDIF_CERTIFICATE_SIGNED_HASH_SIZE (UDIF_ASYMMETRIC_SIGNATURE_SIZE + UDIF_CERTIFICATE_HASH_SIZE) |
| The size of the signature and hash field in a certificate. | |
| #define | UDIF_CERTIFICATE_VERSION_SIZE 1U |
| The version id. | |
| #define | UDIF_CERTIFICATE_CHILD_SIZE |
| The length of a child certificate. | |
| #define | UDIF_CERTIFICATE_IDG_SIZE |
| The length of an IDG certificate. | |
| #define | UDIF_CERTIFICATE_ROOT_SIZE |
| The length of the root certificate. | |
| #define | UDIF_CRYPTO_SYMMETRIC_KEY_SIZE 32U |
| The byte length of the symmetric cipher key. | |
| #define | UDIF_MESSAGE_MAX_SIZE 1400000UL |
| The maximum message size (max signature + max certificate sizes). | |
| #define | UDIF_MFK_EXPIRATION_PERIOD ((uint64_t)60U * 24U * 60U * 60U) |
| The MFK validity period in milliseconds. | |
| #define | UDIF_MINIMUM_PATH_LENGTH 9U |
| The minimum file path length. | |
| #define | UDIF_NETWORK_CONNECTION_MTU 1500U |
| The UDIF packet buffer size. | |
| #define | UDIF_NETWORK_DOMAIN_NAME_MAX_SIZE 256U |
| The maximum domain name length in characters. The last character must be a string terminator. | |
| #define | UDIF_NETWORK_MAX_APSS 1000000UL |
| The maximum number of aps connections in a network. | |
| #define | UDIF_NETWORK_NODE_ID_SIZE 16 |
| The node identification string length. | |
| #define | UDIF_PERIOD_DAY_TO_SECONDS (24U * 60U * 60U) |
| A period of one day in seconds. | |
| #define | UDIF_SOCKET_TERMINATOR_SIZE 1U |
| The packet delimiter byte size. | |
| #define | UDIF_PACKET_ERROR_SIZE 1U |
| The packet error message byte size. | |
| #define | UDIF_PACKET_HEADER_SIZE 22U |
| The UDIF packet header size. | |
| #define | UDIF_PACKET_SUBHEADER_SIZE 16U |
| The UDIF packet sub-header size. | |
| #define | UDIF_PACKET_SEQUENCE_TERMINATOR 0xFFFFFFFFUL |
| The sequence number of a packet that closes a connection. | |
| #define | UDIF_PACKET_TIME_SIZE 8U |
| The byte size of the serialized packet time parameter. | |
| #define | UDIF_PACKET_TIME_THRESHOLD 60U |
| The maximum number of seconds a packet is valid. | |
| #define | UDIF_NETWORK_TERMINATION_MESSAGE_SIZE 1U |
| The network termination message size. | |
| #define | UDIF_NETWORK_TERMINATION_PACKET_SIZE (UDIF_PACKET_HEADER_SIZE + UDIF_NETWORK_TERMINATION_MESSAGE_SIZE) |
| The network termination packet size. | |
| #define | UDIF_ACTIVE_VERSION 1U |
| The UDIF active version identifier. | |
| #define | UDIF_ACTIVE_VERSION_SIZE 2U |
| The UDIF version field size in bytes. | |
| #define | UDIF_NAMESPACE_CODE_SIZE 8U |
| The size of a namespace code (short string or numeric). | |
| #define | UDIF_ISSUER_DOMAIN_CODE_SIZE 8U |
| The size of an issuer domain code (unique identifier). | |
| #define | UDIF_IDENTITY_ID_SIZE 32U |
| The size of a subject identity identifier in bytes. | |
| #define | UDIF_IDENTITY_MAX_SIZE 512U |
| Maximum encoded identity blob size. | |
| #define | UDIF_PERIOD_DAY_TO_SECONDS (24U * 60U * 60U) |
| A period of one day in seconds. | |
| #define | UDIF_CERTIFICATE_ROLE_SIZE 1U |
| The certificate role field size. | |
| #define | UDIF_CERTIFICATE_SERIAL_SIZE 16U |
| The certificate serial number field length. | |
| #define | UDIF_CERTIFICATE_VERSION_SIZE 1U |
| The version id. | |
| #define | UDIF_CERTIFICATE_HASH_SIZE 32U |
| The size of the certificate hash in bytes. | |
| #define | UDIF_CERTIFICATE_SIGNED_HASH_SIZE (UDIF_ASYMMETRIC_SIGNATURE_SIZE + UDIF_CERTIFICATE_HASH_SIZE) |
| The size of the signature and hash field in a certificate. | |
| #define | UDIF_CERTIFICATE_DEFAULT_PERIOD ((uint64_t)365U * 24U * 60U * 60U) |
| The default certificate validity period in milliseconds. | |
| #define | UDIF_CERTIFICATE_MINIMUM_PERIOD ((uint64_t)1U * 24U * 60U * 60U) |
| The minimum certificate validity period in milliseconds. | |
| #define | UDIF_CERTIFICATE_MAXIMUM_PERIOD (UDIF_CERTIFICATE_DEFAULT_PERIOD * 2U) |
| The maximum certificate validity period in milliseconds. | |
| #define | UDIF_CRYPTO_SYMMETRIC_KEY_SIZE 32U |
| The byte length of the symmetric cipher key. | |
| #define | UDIF_CRYPTO_SYMMETRIC_MAC_SIZE 32U |
| Symmetric cipher authentication tag size in bytes. | |
| #define | UDIF_CRYPTO_SYMMETRIC_HASH_SIZE 32U |
| Hash output size in bytes (SHA3-256). | |
| #define | UDIF_CRYPTO_SYMMETRIC_NONCE_SIZE 32U |
| The byte length of the symmetric cipher nonce. | |
| #define | UDIF_CRYPTO_SEED_SIZE 64U |
| The seed array byte size. | |
| #define | UDIF_CRYPTO_SYMMETRIC_TOKEN_SIZE 32U |
| The byte length of the symmetric token. | |
| #define | UDIF_CRYPTO_SYMMETRIC_HASH_SIZE 32U |
| Hash output size in bytes (SHA3-256). | |
| #define | UDIF_CRYPTO_SYMMETRIC_MAC_SIZE 32U |
| Symmetric cipher authentication tag size in bytes. | |
| #define | UDIF_CRYPTO_SYMMETRIC_SECRET_SIZE 32U |
| The shared secret byte size. | |
| #define | UDIF_CERTIFICATE_HEADER_SIZE 64U |
| The UDIF certificate header string length. | |
| #define | UDIF_CERTIFICATE_FOOTER_SIZE 64U |
| The UDIF certificate footer string length. | |
| #define | UDIF_CERTIFICATE_ISSUER_PREFIX_SIZE 9U |
| The certificate issuer prefix length. | |
| #define | UDIF_CERTIFICATE_SERIAL_PREFIX_SIZE 9U |
| The certificate serial prefix length. | |
| #define | UDIF_CERTIFICATE_VALID_FROM_PREFIX_SIZE 13U |
| The "valid from" field prefix length. | |
| #define | UDIF_CERTIFICATE_EXPIRATION_TO_PREFIX_SIZE 6U |
| The "valid to" field prefix length. | |
| #define | UDIF_CERTIFICATE_ALGORITHM_PREFIX_SIZE 12U |
| The algorithm field prefix length. | |
| #define | UDIF_CERTIFICATE_VERSION_PREFIX_SIZE 10U |
| The version field prefix length. | |
| #define | UDIF_CERTIFICATE_ROLE_PREFIX_SIZE 6U |
| The role field prefix length. | |
| #define | UDIF_ROOT_CERTIFICATE_HEADER_SIZE 64U |
| #define | UDIF_ROOT_CERTIFICATE_HASH_PREFIX_SIZE 19U |
| #define | UDIF_ROOT_CERTIFICATE_PUBLICKEY_PREFIX_SIZE 13U |
| #define | UDIF_ROOT_CERTIFICATE_ISSUER_PREFIX_SIZE 9U |
| #define | UDIF_ROOT_CERTIFICATE_NAME_PREFIX_SIZE 7U |
| #define | UDIF_ROOT_CERTIFICATE_SERIAL_PREFIX_SIZE 9U |
| #define | UDIF_ROOT_CERTIFICATE_FOOTER_SIZE 64U |
| #define | UDIF_ROOT_CERTIFICATE_VALID_FROM_PREFIX_SIZE 13U |
| #define | UDIF_ROOT_CERTIFICATE_EXPIRATION_TO_PREFIX_SIZE 6U |
| #define | UDIF_ROOT_CERTIFICATE_ALGORITHM_PREFIX_SIZE 12U |
| #define | UDIF_ROOT_CERTIFICATE_VERSION_PREFIX_SIZE 10U |
| #define | UDIF_ROOT_CERTIFICATE_CAPABILITY_MASK_PREFIX_SIZE 18U |
| #define | UDIF_ROOT_CERTIFICATE_DEFAULT_NAME_SIZE 18U |
| #define | UDIF_ACTIVE_VERSION_STRING_SIZE 5U |
Typedefs | |
| typedef UDIF_EXPORT_API enum udif_configuration_sets | udif_configuration_sets |
| typedef UDIF_EXPORT_API enum udif_network_designations | udif_network_designations |
| typedef UDIF_EXPORT_API enum udif_network_errors | udif_network_errors |
| typedef UDIF_EXPORT_API enum udif_network_flags | udif_network_flags |
| typedef UDIF_EXPORT_API enum udif_protocol_errors | udif_protocol_errors |
| typedef UDIF_EXPORT_API enum udif_claim_type | udif_claim_type |
| typedef UDIF_EXPORT_API enum udif_token_type | udif_token_type |
| typedef UDIF_EXPORT_API enum udif_capability_id | udif_capability_id |
| typedef UDIF_EXPORT_API enum udif_permission_class | udif_permission_class |
| typedef UDIF_EXPORT_API enum udif_policy_decision | udif_policy_decision |
| typedef UDIF_EXPORT_API enum udif_verify_policy | udif_verify_policy |
| typedef UDIF_EXPORT_API enum udif_time_validation | udif_time_validation |
| typedef UDIF_EXPORT_API enum udif_status | udif_status |
| typedef UDIF_EXPORT_API enum udif_error_identity | udif_error_identity |
| typedef UDIF_EXPORT_API enum udif_error_certificate | udif_error_certificate |
| typedef UDIF_EXPORT_API enum udif_error_claims | udif_error_claims |
| typedef UDIF_EXPORT_API enum udif_error_capability | udif_error_capability |
| typedef UDIF_EXPORT_API enum udif_error_policy | udif_error_policy |
| typedef UDIF_EXPORT_API enum udif_error_encoding | udif_error_encoding |
UDIF Common Definitions and Core Library Configuration.
UDIF Common Definitions and Protocol Configuration.
This header defines the common constants, macros, enumerations, structures, and public API prototypes for the Universal Digital Identity Framework (UDIF). It provides the core library configuration used by UDIF components (controllers, proxies, institutional servers, and clients), including certificate and claim handling, capability tokens, identity encoding, permission masks, and secure transport primitives sourced from the QSC library.
UDIF composes standardized post-quantum asymmetric schemes with SHAKE-based hashing/KDF and an AEAD stream cipher for confidentiality and integrity. Algorithm families are selected through build-time configuration, mapping UDIF high-level operations (key generation, encapsulation/decapsulation, signing, verification, hashing, KDF, AEAD) to corresponding QSC library implementations. This style follows the MPDC design pattern (function-mapping macros, configurable parameter sets, and protocol-wide constants) to ensure portability across deployments and security levels.
Key elements defined in this header include: Function-Mapping Macros: Aliases that bind UDIF cryptographic operations (KEM, signature, hash/KDF, AEAD) to QSC implementations selected via compile-time parameter sets. Modifiable Constants: Preprocessor options to enable/disable library features (e.g., certificate extensions, epoch/valid-time enforcement, extended MAC length, strict claim validation, IPv6). Parameter Macros: Canonical byte lengths and field sizes for identities, serials, certificate fields, capability tokens, claim encodings, network packet framing, timing windows, and maximum message sizes. Enumerations: Configuration sets, entity designations (UDC, UIP, UIS, Client), error/status codes for library and protocol operations, certificate and claim types, capability and permission classes, and versioning. Structures: Root, domain, and entity certificates; identity descriptors; capability/permission masks; claim sets; encoded identity blobs; network packet headers; and cipher/key parameter aggregates. Static Constants: Canonical strings (PEM-like headers/footers), OID/label tags, human-readable error text, and curve/parameter labels aligned to the active configuration set.
Public API Prototypes: Core routines for certificate/claim encode-decode, identity/capability validation, token issue/verify, packet header (de)serialization and time-window checks, AEAD context management, and error-to-string conversion.
UDIF adopts the MPDC header organization to maximize reuse and consistency across projects: function-mapping macros for cryptographic agility; tightly scoped, centrally defined size constants; strict packet header format with time-validity windows; and compact error enums with string tables. Implementations SHOULD mirror MPDC’s packet-associated-data practice (adding serialized headers as AEAD associated data) and sequence/time checks when applicable to UDIF transport wrappers.
This header defines the common constants, macros, enumerations, structures, and function prototypes for the Anonymous Encrypted Relay Network (UDIF). It provides configuration for the cryptographic parameter sets, certificate handling, network protocol operations, and socket communication required to implement the UDIF protocol.
The UDIF 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:
These tests collectively ensure the robustness, consistency, and security of the UDIF protocol configuration.
| #define UDIF_CERTIFICATE_CHILD_SIZE |
The length of a child certificate.
| #define UDIF_CERTIFICATE_DEFAULT_PERIOD ((uint64_t)365U * 24U * 60U * 60U) |
The default certificate validity period in milliseconds.
Default certificate validity period in seconds (1 year).
| #define UDIF_CERTIFICATE_DEFAULT_PERIOD ((uint64_t)365U * 24U * 60U * 60U) |
The default certificate validity period in milliseconds.
Default certificate validity period in seconds (1 year).
| #define UDIF_CERTIFICATE_HASH_SIZE 32U |
The size of the certificate hash in bytes.
The size of the certificate hash in bytes (SHA3-256).
| #define UDIF_CERTIFICATE_HASH_SIZE 32U |
The size of the certificate hash in bytes.
The size of the certificate hash in bytes (SHA3-256).
| #define UDIF_CERTIFICATE_IDG_SIZE |
The length of an IDG certificate.
| #define UDIF_CERTIFICATE_MAXIMUM_PERIOD (UDIF_CERTIFICATE_DEFAULT_PERIOD * 2U) |
The maximum certificate validity period in milliseconds.
Maximum certificate validity period in seconds (2 years).
| #define UDIF_CERTIFICATE_MAXIMUM_PERIOD (UDIF_CERTIFICATE_DEFAULT_PERIOD * 2U) |
The maximum certificate validity period in milliseconds.
Maximum certificate validity period in seconds (2 years).
| #define UDIF_CERTIFICATE_MINIMUM_PERIOD ((uint64_t)1U * 24U * 60U * 60U) |
The minimum certificate validity period in milliseconds.
Minimum certificate validity period in seconds (1 day).
| #define UDIF_CERTIFICATE_MINIMUM_PERIOD ((uint64_t)1U * 24U * 60U * 60U) |
The minimum certificate validity period in milliseconds.
Minimum certificate validity period in seconds (1 day).
| #define UDIF_CERTIFICATE_ROOT_SIZE |
The length of the root certificate.
| #define UDIF_CERTIFICATE_SIGNED_HASH_SIZE (UDIF_ASYMMETRIC_SIGNATURE_SIZE + UDIF_CERTIFICATE_HASH_SIZE) |
The size of the signature and hash field in a certificate.
The combined size of a signature and certificate hash.
| #define UDIF_CERTIFICATE_SIGNED_HASH_SIZE (UDIF_ASYMMETRIC_SIGNATURE_SIZE + UDIF_CERTIFICATE_HASH_SIZE) |
The size of the signature and hash field in a certificate.
The combined size of a signature and certificate hash.
| #define UDIF_CERTIFICATE_VERSION_SIZE 1U |
The version id.
The certificate version field size.
| #define UDIF_CERTIFICATE_VERSION_SIZE 1U |
The version id.
The certificate version field size.
| #define UDIF_CRYPTO_SYMMETRIC_HASH_SIZE 32U |
Hash output size in bytes (SHA3-256).
The hash function output byte size.
| #define UDIF_CRYPTO_SYMMETRIC_HASH_SIZE 32U |
Hash output size in bytes (SHA3-256).
The hash function output byte size.
| #define UDIF_CRYPTO_SYMMETRIC_KEY_SIZE 32U |
The byte length of the symmetric cipher key.
Symmetric cipher key length in bytes.
| #define UDIF_CRYPTO_SYMMETRIC_KEY_SIZE 32U |
The byte length of the symmetric cipher key.
Symmetric cipher key length in bytes.
| #define UDIF_CRYPTO_SYMMETRIC_MAC_SIZE 32U |
Symmetric cipher authentication tag size in bytes.
The MAC function output byte size.
| #define UDIF_CRYPTO_SYMMETRIC_MAC_SIZE 32U |
Symmetric cipher authentication tag size in bytes.
The MAC function output byte size.
| enum udif_capability_id |
Canonical capability identifiers (bit positions map to the mask).
| enum udif_claim_type |
Claim type identifiers (deterministic canonicalization required).
The UDIF algorithm configuration sets.
Certificate-specific error codes.
| enum udif_error_claims |
Claim/claim-set error codes.
| enum udif_error_encoding |
| enum udif_error_identity |
Identity-specific error codes.
| enum udif_error_policy |
The UDIF device designation.
| enum udif_network_errors |
The UDIF network error values.
| enum udif_network_flags |
The UDIF network flags.
Permission classes whose bits populate the permission mask.
| enum udif_policy_decision |
| enum udif_protocol_errors |
The UDIF protocol error values.
| enum udif_status |
Generic status codes for UDIF operations.
| enum udif_time_validation |
| enum udif_token_type |
| enum udif_verify_policy |