deno
f79eedcf - fix(ext/node): improve sign/verify crypto compat with Node.js (#33083)

Commit
122 days ago
fix(ext/node): improve sign/verify crypto compat with Node.js (#33083) ## Summary Sign/verify fixes extracted from #32745 for easier review: - **DSA private key PEM**: Parse traditional "DSA PRIVATE KEY" format (ASN.1 sequence with p, q, g, pub_key, priv_key) - **Private-to-public key derivation**: When verify receives a private key (pkcs8, sec1), derive the public key from it instead of failing - **RSA-PSS salt length constants**: Support `-1` (RSA_PSS_SALTLEN_DIGEST) and `-2` (RSA_PSS_SALTLEN_MAX_SIGN/AUTO) via `resolve_pss_salt_length()` helper; changed `pss_salt_length` type from `u32` to `i32` - **Better error messages**: `rsa::Error::MessageTooLong` → "digest too big for rsa key" - **DSA verify**: Return `false` for invalid signature format instead of throwing - **Callback error handling**: Wrap `signOneShot`/`verifyOneShot` in try-catch to pass errors to callbacks - **Key type validation**: Reject x25519, x448, dh keys in verify with "operation not supported for this keytype" Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading