-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add SHA3 support #44
base: master
Are you sure you want to change the base?
Add SHA3 support #44
Conversation
Thanks for the PR. Which HSM/libraries have you tested this with? |
I tested using SoftHSM2 v2.5 and my company uses the Thales nShield Connect XC HSM in production. We have been running this patchset on our production HSMs for over 8 months now without any issues. |
Sorry for the out of hand PR. This change is now based ontop of PR #41 to prevent merge conflict. However, there is no local branch so it looks like this change is pulling in additional commits from #41. Please ignore these additional commits and just focus on the following 2 commits:
This will get cleaned up once PR #41 gets merged. I created a local PR that will show just the 2 commits in my forked repo: |
334d6e4
to
9393ba1
Compare
That's helpful. I will add some comments there. |
SHA3 is not yet supported by most HSM solutions and probably wont be for a few more years. This change adds a hybrid solution that performs the EMSA-PSS and RSAES-OAEP encoding/decoding schemes in software and uses the HSM for raw encryption/decryption support. This allows the keys to continue to be protected by the HSM but still have access to newer hash algorithms.
Native RSA currently does not support SHA3 hash algorithms. This change skips the SHA3 tests when performing the native unit tests.
This commit adds SHA3 support for use with the RSA PKCS#1 crypto algorithms. This is an odd PR as SoftHSM2 does not yet support SHA3 and Thales HSMs only support PKCS#1 v1.5 (no PSS support).
My company makes hardware devices that will support SHA3 hash algorithms with RSASSA-PSS to be future compatible. This change adds native support for RSASSA-PKCS1-v1_5 since the algorithm IDs are prefixed to the hash before sending to request to the HSM.
However, RSASSA-PSS is a little more involved. The solution I came up with is a hybrid approach where the EMSA-PSS encoding is done in solftware but the encryption/decryption of the encrypted message is performed by the HSM.
I validated this change using SoftHSM and Go 1.12.5 and all of the test cases passed locally.