You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow selecting algorithm subsets via Cargo features in reqsign-crypto-rustcrypto (and drop unused rsa/pkcs5) #1069
During Apache OpenDAL's integration trial against reqsign 0.21, adding reqsign-crypto-rustcrypto 1.0.0 revealed two dependency-graph issues in crypto/rustcrypto/Cargo.toml:
All algorithms are unconditional dependencies: reqsign-crypto-rustcrypto pulls sha1, sha2, hmac, md-5, p256 = "0.14.0", rsa = "0.10.0", aes-gcm = "0.11", and getrandom = "0.4" with no Cargo features.
Hash/HMAC-only consumers (such as OpenDAL's S3, OSS, COS, OBS, and TOS services) pull in the full 106-crate dependency tree of reqsign-crypto-rustcrypto, including p256/ecdsa/primeorder, rsa/crypto-primes/pkcs1/pkcs8, and aes-gcm.
In multi-crate workspaces, unconditional p256 = "0.14.0" and rsa = "0.10.0" also widen SemVer collision surface with ecosystem crates that still pin pre-releases on those lines (for example, in OpenDAL's workspace, opendal-service-smb -> smb 0.12.1 -> sspi = "=0.21.3" pins p256 = "=0.14.0-rc.14" and rsa = "=0.10.0-rc.18", blocking Cargo.lock resolution even for crates that never use SigV4a).
Unused pkcs5 feature on rsa: crypto/rustcrypto/Cargo.toml:41 specifies:
rsa = { version = "0.10.0", features = ["pkcs1v15", "pkcs5"] }
docs/crypto-provider.md specifies that rsa_pkcs1v15_sha256_sign only accepts unencrypted PKCS#8 (PRIVATE KEY) or PKCS#1 (RSA PRIVATE KEY) PEM documents, and crypto/rustcrypto/src/lib.rs never uses pkcs5 decryption. Enabling pkcs5 pulls in pkcs5, scrypt, salsa20, cbc, and pbkdf2 unnecessarily.
Proposal
Drop the unused pkcs5 feature from rsa in crypto/rustcrypto/Cargo.toml (verifying that encrypted PKCS#8 PEM fixtures are still rejected with CredentialInvalid).
Consider adding additive Cargo features in reqsign-crypto-rustcrypto (enabled by default for out-of-the-box ergonomics) so callers with default-features = false can opt out of asymmetric/AEAD dependencies they do not need—e.g. separating mandatory hash/HMAC from optional md5, hmac-sha512, rsa, p256, and aes-gcm (falling back to CryptoProvider's default ConfigInvalid methods when disabled, matching the existing wasm32 behavior).
AI-assisted issue filed from Apache OpenDAL's reqsign 0.21 integration trial.
Activity
build(crypto): drop unused rsa pkcs5 feature (#1071)
feat(crypto): add selectable RustCrypto algorithm features (#1075)