PQS: Post Quantum Shell Protocol 1.1.0.0a (A2)
A quantum secure secure shell protocol
pqsshell.h
Go to the documentation of this file.
1/* 2025-2026 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE:
5 * This software and all accompanying materials are the exclusive property of
6 * Quantum Resistant Cryptographic Solutions Corporation (QRCS). The intellectual
7 * and technical concepts contained herein are proprietary to QRCS and are
8 * protected under applicable Canadian, U.S., and international copyright,
9 * patent, and trade secret laws.
10 *
11 * CRYPTOGRAPHIC ALGORITHMS AND IMPLEMENTATIONS:
12 * - This software includes implementations of cryptographic primitives and
13 * algorithms that are standardized or in the public domain, such as AES
14 * and SHA-3, which are not proprietary to QRCS.
15 * - This software also includes cryptographic primitives, constructions, and
16 * algorithms designed by QRCS, including but not limited to RCS, SCB, CSX, QMAC, and
17 * related components, which are proprietary to QRCS.
18 * - All source code, implementations, protocol compositions, optimizations,
19 * parameter selections, and engineering work contained in this software are
20 * original works of QRCS and are protected under this license.
21 *
22 * LICENSE AND USE RESTRICTIONS:
23 * - This software is licensed under the Quantum Resistant Cryptographic Solutions
24 * Public Research and Evaluation License (QRCS-PREL), 2025-2026.
25 * - Permission is granted solely for non-commercial evaluation, academic research,
26 * cryptographic analysis, interoperability testing, and feasibility assessment.
27 * - Commercial use, production deployment, commercial redistribution, or
28 * integration into products or services is strictly prohibited without a
29 * separate written license agreement executed with QRCS.
30 * - Licensing and authorized distribution are solely at the discretion of QRCS.
31 *
32 * EXPERIMENTAL CRYPTOGRAPHY NOTICE:
33 * Portions of this software may include experimental, novel, or evolving
34 * cryptographic designs. Use of this software is entirely at the user's risk.
35 *
36 * DISCLAIMER:
37 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38 * IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS
39 * FOR A PARTICULAR PURPOSE, SECURITY, OR NON-INFRINGEMENT. QRCS DISCLAIMS ALL
40 * LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
41 * ARISING FROM THE USE OR MISUSE OF THIS SOFTWARE.
42 *
43 * FULL LICENSE:
44 * This software is subject to the Quantum Resistant Cryptographic Solutions
45 * Public Research and Evaluation License (QRCS-PREL), 2025-2026. The complete license terms
46 * are provided in the accompanying LICENSE file or at https://www.qrcscorp.ca.
47 *
48 * Written by: John G. Underhill
49 * Contact: contact@qrcscorp.ca
50 */
51
52#ifndef PQS_SHELL_H
53#define PQS_SHELL_H
54
55#include "pqs.h"
56
61
65#define PQS_SHELL_DATABASE_MAGIC "PQSSHELLDB1"
66
70#define PQS_SHELL_PRIVILEGE_GUEST 0x01U
71
75#define PQS_SHELL_PRIVILEGE_USER 0x02U
76
80#define PQS_SHELL_PRIVILEGE_ADMIN 0x04U
81
85#define PQS_SHELL_PRIVILEGE_ALL (PQS_SHELL_PRIVILEGE_GUEST | PQS_SHELL_PRIVILEGE_USER | PQS_SHELL_PRIVILEGE_ADMIN)
86
90PQS_EXPORT_API typedef struct pqs_shell_profile
91{
92 char name[PQS_SHELL_PROFILE_NAME_MAX];
93 char type[PQS_SHELL_PROFILE_TYPE_MAX];
94 char path[PQS_SHELL_PROFILE_PATH_MAX];
95 uint32_t privilege_mask;
96 bool enabled;
97 bool isdefault;
99
103PQS_EXPORT_API typedef struct pqs_shell_store
104{
105 pqs_shell_profile profiles[PQS_SHELL_PROFILE_DATABASE_MAX];
106 char path[QSC_SYSTEM_MAX_PATH];
107 size_t count;
110
124PQS_EXPORT_API bool pqs_shell_store_add(pqs_shell_store* store, const char* name, const char* type, const char* path, uint32_t privilege_mask, bool enabled);
125
136PQS_EXPORT_API bool pqs_shell_store_enable(pqs_shell_store* store, const char* name, bool enabled);
137
147PQS_EXPORT_API const pqs_shell_profile* pqs_shell_store_find(const pqs_shell_store* store, const char* name);
148
158PQS_EXPORT_API pqs_shell_profile* pqs_shell_store_find_mutable(pqs_shell_store* store, const char* name);
159
168PQS_EXPORT_API const pqs_shell_profile* pqs_shell_store_default(const pqs_shell_store* store);
169
179PQS_EXPORT_API bool pqs_shell_store_initialize(pqs_shell_store* store, const char* path);
180
190PQS_EXPORT_API bool pqs_shell_store_remove(pqs_shell_store* store, const char* name);
191
200PQS_EXPORT_API bool pqs_shell_store_save(const pqs_shell_store* store);
201
211PQS_EXPORT_API bool pqs_shell_store_set_default(pqs_shell_store* store, const char* name);
212
224PQS_EXPORT_API bool pqs_shell_store_set_privilege(pqs_shell_store* store, const char* name, pqs_user_privileges privilege, bool allowed);
225
234PQS_EXPORT_API uint32_t pqs_shell_privilege_to_mask(pqs_user_privileges privilege);
235
245PQS_EXPORT_API bool pqs_shell_profile_allows_privilege(const pqs_shell_profile* profile, pqs_user_privileges privilege);
246
247#endif
PQS_EXPORT_API pqs_shell_profile * pqs_shell_store_find_mutable(pqs_shell_store *store, const char *name)
Find a mutable shell profile record by name.
Definition pqsshell.c:327
PQS_EXPORT_API bool pqs_shell_store_set_privilege(pqs_shell_store *store, const char *name, pqs_user_privileges privilege, bool allowed)
Enable or disable shell profile access for a specific PQS user privilege level.
Definition pqsshell.c:549
PQS_EXPORT_API bool pqs_shell_store_enable(pqs_shell_store *store, const char *name, bool enabled)
Enable or disable an existing shell profile record.
Definition pqsshell.c:284
PQS_EXPORT_API bool pqs_shell_store_add(pqs_shell_store *store, const char *name, const char *type, const char *path, uint32_t privilege_mask, bool enabled)
Add or replace a shell profile record in a PQS shell profile store.
Definition pqsshell.c:256
PQS_EXPORT_API bool pqs_shell_store_save(const pqs_shell_store *store)
Save a PQS shell profile store to its persistent database file.
Definition pqsshell.c:481
PQS_EXPORT_API const pqs_shell_profile * pqs_shell_store_find(const pqs_shell_store *store, const char *name)
Find a shell profile record by name.
Definition pqsshell.c:303
PQS_EXPORT_API bool pqs_shell_store_remove(pqs_shell_store *store, const char *name)
Remove a shell profile record from a PQS shell profile store.
Definition pqsshell.c:440
PQS_EXPORT_API bool pqs_shell_profile_allows_privilege(const pqs_shell_profile *profile, pqs_user_privileges privilege)
Test whether a shell profile permits access for a specified PQS user privilege level.
Definition pqsshell.c:600
PQS_EXPORT_API bool pqs_shell_store_set_default(pqs_shell_store *store, const char *name)
Set the default shell profile for a PQS shell profile store.
Definition pqsshell.c:524
PQS_EXPORT_API const pqs_shell_profile * pqs_shell_store_default(const pqs_shell_store *store)
Find the default shell profile in a PQS shell profile store.
Definition pqsshell.c:351
PQS_EXPORT_API bool pqs_shell_store_initialize(pqs_shell_store *store, const char *path)
Initialize a PQS shell profile store and load or create its persistent database file.
Definition pqsshell.c:380
PQS_EXPORT_API uint32_t pqs_shell_privilege_to_mask(pqs_user_privileges privilege)
Convert a PQS user privilege value to the corresponding shell profile privilege-mask bit.
Definition pqsshell.c:578
A PQS server shell profile record.
Definition pqsshell.h:91
bool isdefault
Definition pqsshell.h:97
char path[PQS_SHELL_PROFILE_PATH_MAX]
Definition pqsshell.h:94
uint32_t privilege_mask
Definition pqsshell.h:95
bool enabled
Definition pqsshell.h:96
char type[PQS_SHELL_PROFILE_TYPE_MAX]
Definition pqsshell.h:93
char name[PQS_SHELL_PROFILE_NAME_MAX]
Definition pqsshell.h:92
The fixed-size PQS server shell profile database.
Definition pqsshell.h:104
size_t count
Definition pqsshell.h:107
char path[QSC_SYSTEM_MAX_PATH]
Definition pqsshell.h:106
pqs_shell_profile profiles[PQS_SHELL_PROFILE_DATABASE_MAX]
Definition pqsshell.h:105
bool initialized
Definition pqsshell.h:108