Skip to content

Security: doomhammerhell/pqc-iiot

Security

docs/security.md

Security Guide

This document provides detailed information about the security features and considerations of the PQC-IIoT crate.

Table of Contents

Cryptographic Primitives

Key Encapsulation

CRYSTALS-Kyber

  • NIST Round 3 finalist
  • Security levels:
    • Kyber512 (Level 1)
    • Kyber768 (Level 3, recommended)
    • Kyber1024 (Level 5)
  • Based on Module-LWE
  • Constant-time implementation
  • Side-channel resistant

SABER

  • NIST Round 3 finalist
  • Security levels:
    • LightSaber (Level 1)
    • Saber (Level 3, recommended)
    • FireSaber (Level 5)
  • Based on Module-LWR
  • Optimized for embedded systems
  • Constant-time implementation

BIKE (Experimental)

  • Code-based KEM
  • Security levels:
    • Level 1 (experimental)
    • Level 3 (experimental)
    • Level 5 (experimental)
  • For research purposes
  • Not recommended for production use

Digital Signatures

Falcon

  • NIST Round 3 finalist
  • Security levels:
    • Falcon-512 (Level 1)
    • Falcon-1024 (Level 5)
  • Based on NTRU lattices
  • Compact signatures
  • Fast verification

Dilithium

  • NIST Round 3 finalist
  • Security levels:
    • Dilithium2 (Level 2)
    • Dilithium3 (Level 3, recommended)
    • Dilithium5 (Level 5)
  • Based on Module-LWE
  • Balanced performance
  • Robust implementation

Protocol Security

MQTT Security

  • Post-quantum key exchange
  • Message authentication
  • Replay protection
  • Topic validation
  • Access control

CoAP Security

  • Post-quantum key exchange
  • Message authentication
  • Resource protection
  • Path validation
  • Access control

Implementation Security

Memory Safety

  • Stack allocation where possible
  • Zeroization of sensitive data
  • Bounds checking
  • No undefined behavior

Side-Channel Resistance

  • Constant-time operations
  • Memory access patterns
  • Branch-free code
  • Cache timing protection

Error Handling

  • Secure error reporting
  • No information leakage
  • Graceful failure
  • Recovery mechanisms

Best Practices

Key Management

  1. Generation

    // Use recommended security levels
    let kyber = Kyber::new(KyberSecurityLevel::Kyber768);
    let falcon = Falcon::new(FalconSecurityLevel::Falcon512);
  2. Storage

    // Store keys securely
    key_storage.store_public_key(&pk)?;
    key_storage.store_secret_key(&sk)?;
  3. Rotation

    // Configure key rotation
    kyber.with_key_rotation_interval(Duration::from_secs(3600));

Protocol Usage

  1. MQTT

    // Configure secure client
    let client = SecureMqttClient::new("localhost", 1883, "client_id")?
        .with_tls_config(tls_config)?
        .with_acl(acl_rules)?;
  2. CoAP

    // Configure secure client
    let client = SecureCoapClient::new()?
        .with_dtls_config(dtls_config)?
        .with_acl(acl_rules)?;

Threat Model

Cryptographic Attacks

  • Quantum computing attacks
  • Classical cryptanalysis
  • Side-channel attacks
  • Fault injection

Network Attacks

  • Man-in-the-middle
  • Replay attacks
  • Denial of service
  • Eavesdropping

Implementation Attacks

  • Memory corruption
  • Timing attacks
  • Power analysis
  • Fault injection

Security Considerations

Hardware Requirements

  • 32-bit processor
  • 32KB RAM minimum
  • 128KB Flash minimum
  • Hardware RNG

Performance Impact

  • Key generation time
  • Encryption/decryption time
  • Signature/verification time
  • Memory usage

Deployment Guidelines

  1. Assessment

    • Evaluate security requirements
    • Choose appropriate algorithms
    • Configure security levels
  2. Implementation

    • Follow best practices
    • Enable security features
    • Configure monitoring
  3. Maintenance

    • Regular updates
    • Key rotation
    • Security audits

Update Process

Vulnerability Assessment

  1. Monitor security advisories
  2. Evaluate impact
  3. Plan updates
  4. Test changes

Patch Management

  1. Review patches
  2. Test updates
  3. Deploy changes
  4. Verify security

Incident Response

  1. Detect incidents
  2. Assess impact
  3. Contain threat
  4. Recover systems
  5. Learn from incident

There aren’t any published security advisories