mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 18:47:22 -06:00
* M9: harden .p12 digital IDs (#1847) New digital IDs are written with 600,000 PBKDF2-HMAC-SHA-256 rounds (OWASP) for both encrypted parts and the MAC, instead of 2048. The MAC gets the same count because checking it alone tells whether a guessed password is right. Opening a .p12 now spends at most 10 million rounds of key derivation across the whole file, charged before any hashing. The file chose its own iteration counts unchecked (`u64 as u32`), so a crafted file could hang the password check for about an hour, or wrap 2^32+1 to one round. Creating an ID needs at least 8 characters (NIST SP 800-63B), from one constant, pkcs12::MIN_PASSWORD_CHARS, shared by the app, sign_id_create and its MCP schema. Opening an existing ID takes any password. * Refresh catalog hashes after merging main --------- Co-authored-by: Brandon Thomas <echelon@gmail.com>