-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add PSS signing and verifying #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
Have you checked for memory leaks?
@billabt Would you be able to have a look at this and if you are happy squash merge and tag the change? |
We tested for Memory leaks and there aren't any in the new PSS paths. We did find one in make keys and have added a Deallocate to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@Andrew-Lees11 Had to change your available statements for using PSS. The correct iOS version is 11.0 not 10. It showed up here when I built the package for iOS something we don't do for CI. I fixed it after the merge. Just an FYI. |
@Andrew-Lees11 Had to make another change to the tests. They were generating warning on Swift 4.0.3. |
PSS is only supported from Swift 4.1 onwards which must be iOS 11. Thank you for spotting and fixing this. |
Description
This pull request adds
usePSS
flag to sign and verify. This allows you to use RSA-PSS for signing and verifying. If the flag is set to true the functions will useRSA_PKCS1_PSS_PADDING
, a salt the length of the digest and MGF1 mask generation function to sign or verify.Motivation and Context
This change is required because "In general, RSA-PSS should be used as a replacement for RSA-PKCS#1 v1.5".
It also allows us to support PS256 and PS384 signing/verifying with JWTs as requested by SwiftJWT issue #55
How Has This Been Tested?
Tests have been added covering the new algorithms and the produced signatures have been tested against JWT.io both that one we create is valid and we can verify a valid one created by JWT.io.
Checklist: