-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support for wrapping EC keys + RSA wrapping fixes/comments/questions #5
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.
I left some suggestions/comments, the general changes look good to me.
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.
Thanks most of the work looks really nice.
There are a few things I think would be beneficial to do slightly differently though.
c738707
to
2982d52
Compare
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Fixes also unwrapping for RSA keys, but we might need better solution.
I think the
DerEncBigUint
ensures the BN is unsigned and starts with zero byte, which is something we do not want when we import the BN as a modulus as you are using the modulus size to enforce the buffer size. Without stripping the null byte from the modulus, the operation requires 257 B buffer for signature and verification of this signature does not work.The RSA wrapping is also using the
RSAPrivateKey
ASN1 directly, but from my reading of the PKCS#11 specification, we should usePrivateKeyInfo
. This not obvious for RSA keys as everything needed is in the inner object, but EC keys needs theprivateKeyAlgorithm
field to learn what curve is used, if I read it right.Keeping it as a draft as there is more quesitons to resolve before merging.