-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove unnecessary cbor marshal methods #155
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The alg parameter is unnecessary, and makes these functions more awkward to use. The input PublicKey/PrivateKey is now identified via a type switch, and the algorithm is derived from it. Signed-off-by: setrofim <setrofim@gmail.com>
RFC8152 allows for unregistered curves, therefore we should not fail key validation if a curve is not recognised when marshalling. We should only fail when a known curve is used with an incorrect key type. Signed-off-by: setrofim <setrofim@gmail.com>
Ensure that the KeyType is the expected one for the Curve when creating crypto.PublicKey or crypto.PrivateKey. Signed-off-by: setrofim <setrofim@gmail.com>
RFC8152 allows public parts to be omitted from private keys, as they could be derived (though it recommends that they are present). crypto.PrivateKey implementations require for them to be present. Signed-off-by: setrofim <setrofim@gmail.com>
Add test for String() calls not exercised by other test cases to placate Codecov. Signed-off-by: setrofim <setrofim@gmail.com>
Signed-off-by: setrofim <setrofim@gmail.com>
qmuntal
requested review from
setrofim,
thomas-fossati,
yogeshbdeshpande and
shizhMSFT
July 4, 2023 15:19
setrofim
approved these changes
Jul 4, 2023
Signed-off-by: qmuntal <qmuntaldiaz@microsoft.com>
Signed-off-by: qmuntal <qmuntaldiaz@microsoft.com>
Signed-off-by: qmuntal <qmuntaldiaz@microsoft.com>
Codecov Report
@@ Coverage Diff @@
## main #155 +/- ##
==========================================
- Coverage 91.48% 91.24% -0.25%
==========================================
Files 12 12
Lines 1633 1542 -91
==========================================
- Hits 1494 1407 -87
+ Misses 101 98 -3
+ Partials 38 37 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
yogeshbdeshpande
approved these changes
Jul 4, 2023
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.
LGTM!
thomas-fossati
approved these changes
Jul 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes a bunch of methods added in #146 which, in my opinion, shouldn't have been added.
This is the list and the reasoning for removing them:
Algorithm.UnmarshalCBOR
.Algorithm.UnmarshalCBOR
. Additionally, we should not error when the value is not supported by go-cose, as users might want to unmarshal a key using go-cose but create a signer/verifier using external code.KeyType.UnmarshalCBOR
.KeyType.UnmarshalCBOR
, also we shouldn't validate its value.Curve.UnmarshalCBOR
.Also, I've removed
KeyOpt.IsSupported
and its usage inKeyOpt.UnmarshalCBOR
. RFC 7517 Section 4.3 says that other values may be used.