Skip to main content

Module crypto

Module crypto 

Source
Expand description

Pluggable cryptographic architecture using the strategy pattern.

This module provides a flexible crypto system that allows switching between different signature algorithms (RSA-SHA256, Ed25519, and post-quantum algorithms).

§Classical Algorithms

  • RSA-SHA256: Traditional RSA signatures with SHA-256 hashing
  • Ed25519: Fast, modern elliptic curve signatures

§Post-Quantum Algorithms (feature: post-quantum)

  • ML-DSA-65: NIST FIPS 204 lattice-based signatures
  • ML-KEM-768: NIST FIPS 203 key encapsulation mechanism

§Hybrid Algorithms (feature: post-quantum)

  • Hybrid-RSA-ML-DSA-65: RSA + ML-DSA-65 dual signatures
  • Hybrid-Ed25519-ML-DSA-65: Ed25519 + ML-DSA-65 dual signatures

Hybrid modes require BOTH signatures to verify, providing security even if one algorithm is compromised (defense in depth).

§Example

use licenz_core::crypto::{SignatureAlgorithm, CryptoRegistry};

// Get an algorithm by ID
let algorithm = CryptoRegistry::get_signature_algorithm("RSA-SHA256").unwrap();
println!("Using algorithm: {}", algorithm.algorithm_id());

// List all supported algorithms
for alg_id in CryptoRegistry::supported_signature_algorithms() {
    println!("Supported: {}", alg_id);
}

Re-exports§

pub use crate::keys::CryptoKeyPair;

Modules§

algorithm_ids
Algorithm identifiers for signature algorithms
ed25519
Ed25519 signature algorithm implementation.
rsa
RSA-SHA256 signature algorithm implementation.

Structs§

CryptoRegistry
Registry for cryptographic algorithms

Traits§

EncryptionAlgorithm
Trait for symmetric encryption algorithms
SignatureAlgorithm
Trait for signature algorithms (strategy pattern)

Type Aliases§

BoxedEncryptionAlgorithm
A boxed encryption algorithm for dynamic dispatch
BoxedSignatureAlgorithm
A boxed signature algorithm for dynamic dispatch