Skip to content

Allow selecting algorithm subsets via Cargo features in reqsign-crypto-rustcrypto (and drop unused rsa/pkcs5) #1069

Backlog

Description

@Xuanwo

Context

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:

  1. 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).
  2. 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

  1. Drop the unused pkcs5 feature from rsa in crypto/rustcrypto/Cargo.toml (verifying that encrypted PKCS#8 PEM fixtures are still rejected with CredentialInvalid).
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions