|
UDIF: Universal Digital Identification Framework 1.0.0.0a (A1)
A quantum-secure cryptographic identification
|
UDIF treaty operations. More...
#include "udif.h"Go to the source code of this file.
Data Structures | |
| struct | udif_treaty |
| Cross-domain treaty. More... | |
Macros | |
| #define | UDIF_TREATY_SCOPE_ANALYTICS 1U |
| The treaty scope analytic. | |
| #define | UDIF_TREATY_SCOPE_INTRA_DOMAIN 2U |
| Intra-domain treaty scope. | |
| #define | UDIF_TREATY_SCOPE_LOCAL 4U |
| Local only treaty scope. | |
| #define | UDIF_TREATY_SCOPE_QUERY 8U |
| The intra-domain query scope. | |
| #define | UDIF_TREATY_SCOPE_TRANSFER 16U |
| The cross domain scope transfer. | |
| #define | UDIF_TREATY_SCOPE_TREATY 32U |
| Cross-domain treaty scope. | |
| #define | UDIF_TREATY_SCOPE_RESERVED1 64U |
| The reserved-1 scope setting. | |
| #define | UDIF_TREATY_SCOPE_RESERVED2 128U |
| The reserved-2 scope setting. | |
| #define | UDIF_TREATY_SCOPE_RESERVED3 256U |
| The reserved-3 scope setting. | |
| #define | UDIF_TREATY_SCOPE_MAX 256U |
| The maximum scope setting. | |
| #define | UDIF_TREATY_POLICY_VERSION_SIZE 4U |
| The policy version size. | |
| #define | UDIF_TREATY_SCOPE_QUERY_SIZE 4U |
| The query scope integer size. | |
| #define | UDIF_TREATY_DEFAULT_DURATION (365U * 24U * 3600U) |
| Default treaty duration (1 year). | |
| #define | UDIF_TREATY_MAX_DURATION (5U * 365U * 24U * 3600U) |
| Maximum treaty duration (5 years). | |
| #define | UDIF_TREATY_STRUCTURE_SIZE |
| The treaty structure byte size. | |
Typedefs | |
| typedef UDIF_EXPORT_API struct udif_treaty | udif_treaty |
Functions | |
| UDIF_EXPORT_API udif_errors | udif_treaty_accept (udif_treaty *treaty, const uint8_t *domsigkeyb, bool(*rng_generate)(uint8_t *, size_t)) |
| Accept a treaty proposal. | |
| UDIF_EXPORT_API bool | udif_treaty_allows_scope (const udif_treaty *treaty, uint32_t scope) |
| Check if treaty allows scope. | |
| UDIF_EXPORT_API void | udif_treaty_clear (udif_treaty *treaty) |
| Clear a treaty. | |
| UDIF_EXPORT_API bool | udif_treaty_compare (const udif_treaty *a, const udif_treaty *b) |
| Compare two treaties. | |
| UDIF_EXPORT_API udif_errors | udif_treaty_compute_digest (uint8_t *digest, const udif_treaty *treaty) |
| Compute treaty digest. | |
| UDIF_EXPORT_API udif_errors | udif_treaty_create_proposal (udif_treaty *treaty, const uint8_t *treatyid, const uint8_t *domsera, const uint8_t *domserb, uint32_t scopebitmap, uint64_t validfrom, uint64_t validto, uint32_t policy, const uint8_t *domsigkeya, bool(*rng_generate)(uint8_t *, size_t)) |
| Create a treaty proposal. | |
| UDIF_EXPORT_API udif_errors | udif_treaty_deserialize (udif_treaty *treaty, const uint8_t *input, size_t inplen) |
| Deserialize a treaty. | |
| UDIF_EXPORT_API size_t | udif_treaty_encoded_size (const udif_treaty *treaty) |
| Get treaty encoded size. | |
| UDIF_EXPORT_API uint64_t | udif_treaty_get_duration (const udif_treaty *treaty) |
| Get treaty duration. | |
| UDIF_EXPORT_API bool | udif_treaty_is_active (const udif_treaty *treaty, uint64_t ctime) |
| Check if treaty is active. | |
| UDIF_EXPORT_API bool | udif_treaty_is_expired (const udif_treaty *treaty, uint64_t ctime) |
| Check if treaty is expired. | |
| UDIF_EXPORT_API bool | udif_treaty_is_participant (const udif_treaty *treaty, const uint8_t *entityser) |
| Check if entity is treaty participant. | |
| UDIF_EXPORT_API bool | udif_treaty_is_pending (const udif_treaty *treaty) |
| Check if treaty is pending. | |
| UDIF_EXPORT_API udif_errors | udif_treaty_serialize (uint8_t *output, size_t outlen, const udif_treaty *treaty) |
| Serialize a treaty. | |
| UDIF_EXPORT_API udif_errors | udif_treaty_validate (const udif_treaty *treaty) |
| Validate treaty parameters. | |
| UDIF_EXPORT_API bool | udif_treaty_verify (const udif_treaty *treaty, const uint8_t *domverkeya, const uint8_t *domverkeyb) |
| Verify a treaty. | |
UDIF treaty operations.
This module implements bilateral treaties between UDIF domains. Treaties establish formal agreements for cross-domain operations, defining what information can be shared and under what conditions.
Treaty Features:
Treaty Lifecycle:
Treaties enable:
| #define UDIF_TREATY_STRUCTURE_SIZE |
The treaty structure byte size.
| UDIF_EXPORT_API udif_errors udif_treaty_accept | ( | udif_treaty * | treaty, |
| const uint8_t * | domsigkeyb, | ||
| bool(* | rng_generate )(uint8_t *, size_t) ) |
Accept a treaty proposal.
Signs a treaty proposal to accept and activate it.
| treaty | The treaty structure (will be updated) |
| domsigkeyb | [const] Domain B's private key |
| rng_generate | Random number generator function |
| UDIF_EXPORT_API bool udif_treaty_allows_scope | ( | const udif_treaty * | treaty, |
| uint32_t | scope ) |
Check if treaty allows scope.
Tests if a specific operation scope is permitted.
| treaty | [const] The treaty |
| scope | The scope to check |
| UDIF_EXPORT_API void udif_treaty_clear | ( | udif_treaty * | treaty | ) |
Clear a treaty.
Zeros out a treaty structure.
| treaty | The treaty to clear |
| UDIF_EXPORT_API bool udif_treaty_compare | ( | const udif_treaty * | a, |
| const udif_treaty * | b ) |
Compare two treaties.
Checks if two treaties are identical.
| a | [const] The first treaty |
| b | [const] The second treaty |
| UDIF_EXPORT_API udif_errors udif_treaty_compute_digest | ( | uint8_t * | digest, |
| const udif_treaty * | treaty ) |
Compute treaty digest.
Calculates the canonical digest of a treaty for signing.
| digest | The output digest (32 bytes) |
| treaty | [const] The treaty |
| UDIF_EXPORT_API udif_errors udif_treaty_create_proposal | ( | udif_treaty * | treaty, |
| const uint8_t * | treatyid, | ||
| const uint8_t * | domsera, | ||
| const uint8_t * | domserb, | ||
| uint32_t | scopebitmap, | ||
| uint64_t | validfrom, | ||
| uint64_t | validto, | ||
| uint32_t | policy, | ||
| const uint8_t * | domsigkeya, | ||
| bool(* | rng_generate )(uint8_t *, size_t) ) |
Create a treaty proposal.
Creates a treaty proposal for bilateral agreement.
| treaty | The output treaty structure |
| treatyid | [const] The treaty identifier (32 bytes) |
| domsera | [const] The first domain serial (16 bytes) |
| domserb | [const] The second domain serial (16 bytes) |
| scopebitmap | The allowed operation scopes |
| validfrom | The treaty start time (UTC seconds) |
| validto | The treaty end time (UTC seconds) |
| policy | The policy version number |
| domsigkeya | [const] Domain A's private key |
| rng_generate | Random number generator function |
| UDIF_EXPORT_API udif_errors udif_treaty_deserialize | ( | udif_treaty * | treaty, |
| const uint8_t * | input, | ||
| size_t | inplen ) |
Deserialize a treaty.
Decodes a treaty from canonical format.
| treaty | The output treaty structure |
| input | [const] The input buffer |
| inplen | The input buffer length |
| UDIF_EXPORT_API size_t udif_treaty_encoded_size | ( | const udif_treaty * | treaty | ) |
Get treaty encoded size.
Calculates the serialized size of a treaty.
| treaty | [const] The treaty |
| UDIF_EXPORT_API uint64_t udif_treaty_get_duration | ( | const udif_treaty * | treaty | ) |
Get treaty duration.
Calculates the treaty duration in seconds.
| treaty | [const] The treaty |
| UDIF_EXPORT_API bool udif_treaty_is_active | ( | const udif_treaty * | treaty, |
| uint64_t | ctime ) |
Check if treaty is active.
Verifies that a treaty is currently in effect.
| treaty | [const] The treaty |
| ctime | The current time (UTC seconds) |
| UDIF_EXPORT_API bool udif_treaty_is_expired | ( | const udif_treaty * | treaty, |
| uint64_t | ctime ) |
Check if treaty is expired.
Tests if a treaty has reached its end time.
| treaty | [const] The treaty |
| ctime | The current time (UTC seconds) |
| UDIF_EXPORT_API bool udif_treaty_is_participant | ( | const udif_treaty * | treaty, |
| const uint8_t * | entityser ) |
Check if entity is treaty participant.
Tests if an entity is one of the treaty parties.
| treaty | [const] The treaty |
| entityser | [const] The entity serial (16 bytes) |
| UDIF_EXPORT_API bool udif_treaty_is_pending | ( | const udif_treaty * | treaty | ) |
Check if treaty is pending.
Tests if a treaty is proposed but not yet accepted.
| treaty | [const] The treaty |
| UDIF_EXPORT_API udif_errors udif_treaty_serialize | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const udif_treaty * | treaty ) |
Serialize a treaty.
Encodes a treaty to canonical format.
| output | The output buffer |
| outlen | The output buffer length |
| treaty | [const] The treaty to serialize |
| UDIF_EXPORT_API udif_errors udif_treaty_validate | ( | const udif_treaty * | treaty | ) |
Validate treaty parameters.
Checks that treaty parameters are valid.
| treaty | [const] The treaty |
| UDIF_EXPORT_API bool udif_treaty_verify | ( | const udif_treaty * | treaty, |
| const uint8_t * | domverkeya, | ||
| const uint8_t * | domverkeyb ) |
Verify a treaty.
Verifies both signatures on a treaty.
| treaty | [const] The treaty to verify |
| domverkeya | [const] Domain A's public key |
| domverkeyb | [const] Domain B's public key |