import { IEncryptionStrategy, EncryptionResult, DecryptionParams } from '../encryption-strategy.interface'; /** * Kyber-KEM Hybrid Encryption Strategy * * SOLID Principles: * - Single Responsibility: Handles Kyber-based hybrid encryption/decryption * - Open/Closed: Implements IEncryptionStrategy interface * - Liskov Substitution: Can substitute any IEncryptionStrategy * - Interface Segregation: Focused interface * - Dependency Inversion: Depends on IEncryptionStrategy abstraction * * Algorithm Details: * - Kyber is a post-quantum Key Encapsulation Mechanism (KEM) * - NIST PQC standardization: CRYSTALS-Kyber (now ML-KEM) * - Quantum-resistant: Secure against attacks from quantum computers * - Hybrid encryption approach: * 1. Generate Kyber keypair (public/private) * 2. Encapsulation: Use public key to generate shared secret + ciphertext * 3. Use shared secret as symmetric key for XChaCha20-Poly1305 * 4. Decapsulation: Use private key + ciphertext to recover shared secret * 5. Decrypt using recovered shared secret * * Security Level: Kyber-768 (NIST Level 3 - equivalent to AES-192) * * NOTE: This implementation uses password-derived keypair for simplicity. * Production systems should use proper public-key infrastructure. */ export declare class KyberKemStrategy implements IEncryptionStrategy { readonly algorithmName = "Kyber-KEM"; readonly isSupported = true; readonly requiresExternalLibrary = true; private readonly IV_SIZE; private readonly SALT_SIZE; private readonly KYBER_CIPHER_TEXT_SIZE; /** * Get recommended IV (nonce) size */ getIvSize(): number; /** * Get recommended salt size */ getSaltSize(): number; /** * Encrypt data using Kyber-KEM hybrid encryption * * Process: * 1. Derive Kyber keypair from password (deterministic for decryption) * 2. Use public key to encapsulate a shared secret * 3. Use shared secret to encrypt data with XChaCha20-Poly1305 * 4. Prepend Kyber ciphertext to encrypted data */ encrypt(data: ArrayBuffer, password: string, saltHex: string, ivHex: string): Promise; /** * Decrypt data using Kyber-KEM hybrid encryption * * Process: * 1. Derive Kyber keypair from password (same as encryption) * 2. Extract Kyber ciphertext from beginning of encrypted blob * 3. Decapsulate using secret key to recover shared secret * 4. Use shared secret to decrypt data with XChaCha20-Poly1305 */ decrypt(params: DecryptionParams): Promise; /** * Derive Kyber keypair deterministically from password * * WARNING: This is a simplified approach for demonstration. * Production systems should: * - Use proper public-key infrastructure * - Store public keys separately * - Never derive private keys from passwords * * This implementation uses a hash of password + salt to deterministically * generate the keypair (same password = same keypair). */ private deriveKyberKeypair; /** * Convert hex string to Uint8Array */ private hexToUint8Array; } //# sourceMappingURL=kyber-kem-strategy.d.ts.map