1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 Craton Software Company
//! Craton HSM — a PKCS#11 v3.0-compliant Software HSM in pure Rust.
//!
//! This crate provides a complete software HSM implementation with classical
//! and post-quantum cryptography, FIPS 140-3 readiness, and a C ABI compatible
//! with any PKCS#11 consumer.
/// Tamper-evident audit logging with chained SHA-256.
/// Configuration — TOML-based `HsmConfig` with algorithm policy.
/// Core HSM state — the central `HsmCore` struct shared by all entry points.
/// Cryptographic operations — keygen, sign, encrypt, digest, PQC, DRBG, self-tests, backends.
/// Error types — `HsmError` enum with `CK_RV` mapping.
/// PKCS#11 C ABI layer — types, constants, and 70+ `#[no_mangle]` function exports.
///
/// This module uses PKCS#11 naming conventions (e.g., `CK_RV`, `CKR_OK`, `C_Initialize`)
/// which require `non_camel_case_types`, `non_snake_case`, and `non_upper_case_globals`.
/// Platform-specific file ACL helpers (Windows DACL restriction).
pub
/// Session management — `SessionManager`, session state machine, handle allocation.
/// Object storage — in-memory `ObjectStore`, encrypted persistence, key material, backups.
/// Token and slot management — PIN hashing, login state, multi-slot support.