/** * Cryptographic primitives — Browser version. * * Uses pure JavaScript for synchronous operations (SHA-256, MD5, AES-CBC, RC4) * since Web Crypto API is async-only and cannot replace synchronous call sites. * * Uses Web Crypto API for: * - `randomBytes` (crypto.getRandomValues — truly random) * - `rsaVerify` / `rsaSign` (SubtleCrypto — hardware-accelerated) * * Exports the same API as `crypto.ts` (Node.js version). */ export declare function aesCbcEncrypt(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array; export declare function aesCbcDecrypt(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array; export declare function aesCbcDecryptRaw(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array; export declare function aesCbcEncryptRaw(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array; export declare function aesEcbEncrypt(block: Uint8Array, key: Uint8Array): Uint8Array; export declare function sha256(input: Uint8Array): Uint8Array; export declare function md5(input: Uint8Array): Uint8Array; /** * RC4 stream cipher. * * Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm * (PDF 1.4 standard handler V=1/V=2). */ export declare function rc4(key: Uint8Array, data: Uint8Array): Uint8Array; /** * Generate cryptographically secure random bytes. * Uses crypto.getRandomValues (available in all modern browsers). */ export declare function randomBytes(length: number): Uint8Array; /** * Compute a hash digest using Web Crypto API. * * NOTE: In the browser, this is async. The Node.js version is sync. * For callers that need sync hashing, use `sha256()` or `md5()` directly. * * @param algorithm - Hash algorithm name (e.g., "SHA-256", "SHA-512", "SHA-1"). * @param data - Data to hash * @returns The digest bytes */ export declare function hashAsync(algorithm: string, data: Uint8Array): Promise; /** * Compute a hash digest synchronously (pure JS — SHA-256 and MD5 only). * * @param algorithm - "SHA-256" or "MD5" (case-insensitive, hyphens optional) * @param data - Data to hash * @returns The digest bytes * @throws If algorithm is not SHA-256 or MD5 */ export declare function hash(algorithm: string, data: Uint8Array): Uint8Array; /** * Verify an RSA PKCS#1 v1.5 signature. * * @param publicKeyDer - DER-encoded SubjectPublicKeyInfo * @param signature - The signature bytes * @param data - The signed data (will be hashed with SHA-256) */ export declare function rsaVerify(publicKeyDer: Uint8Array, signature: Uint8Array, data: Uint8Array): Promise; /** * Create an RSA PKCS#1 v1.5 signature. * * @param privateKeyDer - DER-encoded PKCS#8 private key * @param data - The data to sign (will be hashed with SHA-256) */ export declare function rsaSign(privateKeyDer: Uint8Array, data: Uint8Array): Promise;