Expand description
§QuantaCore SDK for Rust
Rust bindings for the QUAC 100 Post-Quantum Cryptographic Accelerator.
§Features
- ML-KEM (Kyber): Post-quantum key encapsulation (512, 768, 1024)
- ML-DSA (Dilithium): Post-quantum digital signatures (44, 65, 87)
- QRNG: Quantum random number generation
- Hardware Hashing: SHA-2, SHA-3, SHAKE, HMAC, HKDF
- HSM Key Storage: Secure key management
§Quick Start
use quantacore::{initialize, cleanup, open_first_device, KemAlgorithm};
fn main() -> quantacore::Result<()> {
// Initialize library
initialize()?;
// Open device
let device = open_first_device()?;
// Get KEM subsystem
let kem = device.kem();
// Generate ML-KEM-768 key pair
let keypair = kem.generate_keypair(KemAlgorithm::MlKem768)?;
println!("Public key: {} bytes", keypair.public_key().len());
// Encapsulate
let (ciphertext, shared_secret) = kem.encapsulate(
keypair.public_key(),
KemAlgorithm::MlKem768
)?;
// Decapsulate
let decap_secret = kem.decapsulate(
keypair.secret_key(),
&ciphertext,
KemAlgorithm::MlKem768
)?;
assert_eq!(shared_secret, decap_secret);
// Cleanup
drop(device);
cleanup()?;
Ok(())
}§Error Handling
All fallible operations return quantacore::Result<T>, which is an alias
for std::result::Result<T, QuacError>.
§Thread Safety
The library is thread-safe. Multiple threads can use the same Device
instance concurrently.
Modules§
- prelude
- Crate prelude for convenient imports Convenient imports for common use cases.
- utils
- Utility functions for data manipulation.
Structs§
- Device
- Handle to an open QUAC 100 device.
- Device
Info - Device information.
- Device
Status - Device status.
- Encapsulation
Result - Result of KEM encapsulation.
- Entropy
Status - Entropy pool status.
- Hash
- Hash subsystem.
- Hash
Context - Hash context for incremental hashing.
- Init
Flags - Library initialization flags.
- Kem
- KEM (Key Encapsulation Mechanism) subsystem.
- KeyInfo
- Information about a stored key.
- KeyPair
- KEM key pair.
- KeyUsage
- Key usage flags.
- Keys
- Key storage (HSM) subsystem.
- Library
Context - RAII guard for library initialization.
- Random
- Random number generator subsystem.
- Sign
- Signature subsystem.
- Signature
KeyPair - Signature key pair.
Enums§
- Error
Code - Error codes returned by QUAC 100 operations.
- Hash
Algorithm - Hash algorithms.
- KemAlgorithm
- Key Encapsulation Mechanism algorithms.
- KeyType
- Key types for HSM storage.
- Quac
Error - Main error type for QUAC 100 operations.
- Sign
Algorithm - Digital Signature algorithms.
Constants§
- VERSION
- Library version
Functions§
- cleanup
- Clean up the QUAC 100 library.
- enumerate_
devices - Enumerate all available QUAC 100 devices.
- get_
build_ info - Get the library build information.
- get_
device_ count - Get the number of available QUAC 100 devices.
- get_
version - Get the library version string.
- initialize
- Initialize the QUAC 100 library with default flags.
- initialize_
with_ flags - Initialize the QUAC 100 library with custom flags.
- is_
initialized - Check if the library is initialized.
- open_
device - Open a QUAC 100 device by index.
- open_
first_ device - Open the first available QUAC 100 device.
Type Aliases§
- Result
- Result type alias for QUAC 100 operations.