Expand description
lib-Q FN-DSA - Post-Quantum Digital Signatures
This crate provides a libQ-compatible wrapper around the FN-DSA (FIPS 206) post-quantum digital signature algorithm, which is based on FALCON with enhanced performance and compact signature sizes.
§Features
- NIST-Approved: Implements NIST FIPS 206 (FN-DSA)
- High Performance: Optimized for both x86_64 and ARM64 architectures
- Compact Signatures: Smaller signature sizes compared to other post-quantum schemes
- Security Levels: Supports Level 1 (128-bit) and Level 5 (256-bit) security
- Memory Safe: Zero unsafe code, automatic memory zeroization
- Constant-Time: Operations designed to prevent timing attacks
§Security Levels
FN-DSA provides two main security levels:
- Level 1 (128-bit security): n=512, suitable for most applications
- Level 5 (256-bit security): n=1024, for high-security applications
§Example Usage
use lib_q_core::{
SigKeypair,
SigPublicKey,
SigSecretKey,
Signature,
};
use lib_q_fn_dsa::{
FnDsa,
FnDsa512,
FnDsa1024,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create an FN-DSA instance
let fn_dsa = FnDsa512::new();
// Generate a keypair
let keypair = fn_dsa.generate_keypair()?;
// Sign a message
let message = b"Hello, FN-DSA!";
let signature = fn_dsa.sign(&keypair.secret_key, message)?;
// Verify the signature
let is_valid =
fn_dsa.verify(&keypair.public_key, message, &signature)?;
assert!(is_valid);
Ok(())
}Modules§
- utils
- Utility functions for FN-DSA
Structs§
- FnDsa
- Generic FN-DSA implementation that can work with any security level
- FnDsa512
- FN-DSA Level 1 (128-bit security) implementation
- FnDsa1024
- FN-DSA Level 5 (256-bit security) implementation
- KeyPair
Generator Standard - Key pair generator for degrees (
logn) 9 to 10 only. - SigKeypair
- Signature keypair with automatic memory zeroization
- SigPublic
Key - Signature public key
- SigSecret
Key - Signature secret key with automatic memory zeroization
- Signing
KeyStandard - Signature generator for degrees (
logn) 9 to 10 only. - Verifying
KeyStandard - Signature verifier for degrees (
logn) 9 to 10 only.
Enums§
- Error
- The error type for lib-Q operations
- FnDsa
Security Level - FN-DSA security level enumeration
Constants§
- DOMAIN_
NONE - Empty domain separation context.
- FN_
DSA_ LOGN_ 512 - Symbolic constant for FN-DSA with degree 512 (
logn = 9). - FN_
DSA_ LOGN_ 1024 - Symbolic constant for FN-DSA with degree 1024 (
logn = 10). - HASH_
ID_ RAW - Hash function identifier: none.
Traits§
- FnDsa
Impl - Base FN-DSA implementation trait
- KeyPair
Generator - Key pair generator and temporary buffers.
- Signature
- Trait for digital signatures
- Signing
Key - Signing key handler and temporary buffers.
- Verifying
Key - Verifying key handler.
Functions§
- sign_
key_ size - Get the size (in bytes) of a signing key for the provided degree
(degree is
n = 2^logn, with2 <= logn <= 10). - signature_
size - Get the size (in bytes) of a signature for the provided degree
(degree is
n = 2^logn, with2 <= logn <= 10). - vrfy_
key_ size - Get the size (in bytes) of a verifying key for the provided degree
(degree is
n = 2^logn, with2 <= logn <= 10).
Type Aliases§
- Result
- Result type for lib-Q operations