mirror of
https://github.com/apple/swift-crypto
synced 2026-11-22 04:30:39 +00:00
Add RSA PKCSv1.5 padding support for legacy compat ### Checklist - [X] I've run tests to see all new and existing tests pass - [X] I've followed the code style of the rest of the project - [X] I've read the [Contribution Guidelines](CONTRIBUTING.md) - [X] I've updated the documentation if necessary #### If you've made changes to `gyb` files - [n/a] I've run `./scripts/generate_boilerplate_files_with_gyb.sh` and included updated generated files in a commit of this pull request ### Motivation: I have a scenario that requires me to be able to encrypt and decrypt values that use RSA PKCSv1.5 padding. This is known to be a weak algorithm, so we explicitly want to discourage its use, but there are scenarios where you need the algorithm for legacy compatibility, so we want to provide the capability, even if we strongly discourage its use. ### Modifications: Added a new enum + constant + passthrough to allow users to specify RSA PKCSv1.5. From the internal review, we thought it would be best to explicitly name the constants in a way that discouraged use without very intentional needs, hence the "weak" and "insecure" references in all of the naming. ### Result: You can now specify PKCSv1.5 padding for use in encryption and decryption. This is only adding constants, and the enums are not public, so there should not be any impact on compatibility (source or binary). Co-authored-by: Mike Schrag <schrag@apple.com>