Crate quantacore

Crate quantacore 

Source
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.
DeviceInfo
Device information.
DeviceStatus
Device status.
EncapsulationResult
Result of KEM encapsulation.
EntropyStatus
Entropy pool status.
Hash
Hash subsystem.
HashContext
Hash context for incremental hashing.
InitFlags
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.
LibraryContext
RAII guard for library initialization.
Random
Random number generator subsystem.
Sign
Signature subsystem.
SignatureKeyPair
Signature key pair.

Enums§

ErrorCode
Error codes returned by QUAC 100 operations.
HashAlgorithm
Hash algorithms.
KemAlgorithm
Key Encapsulation Mechanism algorithms.
KeyType
Key types for HSM storage.
QuacError
Main error type for QUAC 100 operations.
SignAlgorithm
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.