SIAP: Secure Infrastructure Access Protocol 1.0.0.0a (A1)
A post-quantum secure user verification system and access control mechanism
server.h
Go to the documentation of this file.
1/* 2025 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE: This software and all accompanying materials are the exclusive
5 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
6 * The intellectual and technical concepts contained within this implementation
7 * are proprietary to QRCS and its authorized licensors and are protected under
8 * applicable U.S. and international copyright, patent, and trade secret laws.
9 *
10 * CRYPTOGRAPHIC STANDARDS:
11 * - This software includes implementations of cryptographic algorithms such as
12 * SHA3, AES, and others. These algorithms are public domain or standardized
13 * by organizations such as NIST and are NOT the property of QRCS.
14 * - However, all source code, optimizations, and implementations in this library
15 * are original works of QRCS and are protected under this license.
16 *
17 * RESTRICTIONS:
18 * - Redistribution, modification, or unauthorized distribution of this software,
19 * in whole or in part, is strictly prohibited.
20 * - This software is provided for non-commercial, educational, and research
21 * purposes only. Commercial use in any form is expressly forbidden.
22 * - Licensing and authorized distribution are solely at the discretion of QRCS.
23 * - Any use of this software implies acceptance of these restrictions.
24 *
25 * DISCLAIMER:
26 * This software is provided "as is," without warranty of any kind, express or
27 * implied, including but not limited to warranties of merchantability or fitness
28 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
29 * incidental, or consequential damages resulting from the use or misuse of this software.
30 *
31 * FULL LICENSE:
32 * This software is subject to the **Quantum Resistant Cryptographic Solutions
33 * Proprietary License (QRCS-PL)**. The complete license terms are included
34 * in the LICENSE.txt file distributed with this software.
35 *
36 * Written by: John G. Underhill
37 * Contact: john.underhill@protonmail.com
38 */
39
40#ifndef SIAP_SERVER_H
41#define SIAP_SERVER_H
42
43#include "siap.h"
44
49
61SIAP_EXPORT_API siap_errors siap_server_authenticate_device(uint8_t* dtok, siap_device_key* dkey, siap_device_tag* dtag, const siap_server_key* skey, const uint8_t* phash);
62
71SIAP_EXPORT_API bool siap_server_decrypt_device_key(siap_device_key* dkey, const siap_server_key* skey, const uint8_t* phash);
72
81SIAP_EXPORT_API void siap_server_encrypt_device_key(siap_device_key* dkey, const siap_server_key* skey, const uint8_t* phash);
82
91SIAP_EXPORT_API bool siap_server_extract_authentication_token(uint8_t* token, siap_device_key* dkey, const siap_server_key* skey);
92
101SIAP_EXPORT_API bool siap_server_generate_authentication_token(uint8_t* token, const siap_device_tag* dtag, const siap_server_key* skey);
102
112SIAP_EXPORT_API void siap_server_generate_device_key(siap_device_key* dkey, const siap_server_key* skey, const uint8_t* did);
113
123SIAP_EXPORT_API void siap_server_generate_device_tag(siap_device_tag* dtag, const siap_device_key* dkey, const uint8_t* phash);
124
135SIAP_EXPORT_API bool siap_server_generate_server_key(siap_server_key* skey, const uint8_t* sid);
136
143SIAP_EXPORT_API void siap_server_passphrase_generate(char* passphrase, size_t length);
144
152SIAP_EXPORT_API void siap_server_passphrase_hash_generate(uint8_t* phash, const char* passphrase, size_t passlen);
153
163SIAP_EXPORT_API bool siap_server_passphrase_hash_verify(const uint8_t* phash, const char* passphrase, size_t passlen);
164
173SIAP_EXPORT_API bool siap_server_verify_device_tag(siap_device_tag* dtag, const siap_device_key* dkey);
174
175#endif
SIAP_EXPORT_API bool siap_server_extract_authentication_token(uint8_t *token, siap_device_key *dkey, const siap_server_key *skey)
Extract an authentication token. This function extracts an authentication token and erases it on the ...
Definition server.c:225
SIAP_EXPORT_API bool siap_server_generate_authentication_token(uint8_t *token, const siap_device_tag *dtag, const siap_server_key *skey)
Generate an authentication token that matches the device tags token index. This function generates an...
Definition server.c:113
SIAP_EXPORT_API bool siap_server_verify_device_tag(siap_device_tag *dtag, const siap_device_key *dkey)
Hash the key tree and compare it with the value stored in the device tag.
Definition server.c:405
SIAP_EXPORT_API void siap_server_passphrase_hash_generate(uint8_t *phash, const char *passphrase, size_t passlen)
Generate the passphrase hash.
Definition server.c:375
SIAP_EXPORT_API void siap_server_passphrase_generate(char *passphrase, size_t length)
Generate a readable pseudo-random passphrase.
Definition server.c:341
SIAP_EXPORT_API bool siap_server_passphrase_hash_verify(const uint8_t *phash, const char *passphrase, size_t passlen)
Verify a passphrase against the hash.
Definition server.c:390
SIAP_EXPORT_API siap_errors siap_server_authenticate_device(uint8_t *dtok, siap_device_key *dkey, siap_device_tag *dtag, const siap_server_key *skey, const uint8_t *phash)
Authenticate a device. This function hashes a passphrase, decrypts a device keys token-tree,...
Definition server.c:13
SIAP_EXPORT_API bool siap_server_generate_server_key(siap_server_key *skey, const uint8_t *sid)
Generate a server key-set. This function generates a new SIAP server key-set based on the provided ma...
Definition server.c:307
SIAP_EXPORT_API void siap_server_generate_device_key(siap_device_key *dkey, const siap_server_key *skey, const uint8_t *did)
Generate a device key. This function generates a new SIAP device key using the provided server key....
Definition server.c:255
SIAP_EXPORT_API bool siap_server_decrypt_device_key(siap_device_key *dkey, const siap_server_key *skey, const uint8_t *phash)
Decrypt a device key. This function decrypts a device keys token-tree.
Definition server.c:143
SIAP_EXPORT_API void siap_server_generate_device_tag(siap_device_tag *dtag, const siap_device_key *dkey, const uint8_t *phash)
Generate a device tag. This function generates a new SIAP device tag structure. It populates the prov...
Definition server.c:285
SIAP_EXPORT_API void siap_server_encrypt_device_key(siap_device_key *dkey, const siap_server_key *skey, const uint8_t *phash)
Encrypt a device key. This function encrypts a device keys token-tree.
Definition server.c:190
SIAP support header Common defined parameters and functions of the SIAP client and server implementat...
siap_errors
The SIAP error values. This enumeration defines the error codes returned by SIAP functions.
Definition siap.h:326
The SIAP device key structure. This structure contains the SIAP device key, the device key identity,...
Definition siap.h:347
Definition siap.h:359
The SIAP server key structure. This structure contains the SIAP server key, the server's domain ident...
Definition siap.h:371