-
Notifications
You must be signed in to change notification settings - Fork 157
Use Tink key APIs in tinkca.KeyHandleToSigner
#2024
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
Conversation
Tink v2.3.0 [1] added the ability to extract individual keys from a Tink `keyset.Handle` as key objects. This PR modifies `KeyHandleToSigner` to use such APIs, significantly simplifying it. Note that there is no need to validate keys because they are validated when the `keyset.Handle` is created [2],[3],[4]. Also refactoring `signer_test.go` and adding a test case for an invalid key type. [1] https://github.com/tink-crypto/tink-go/releases/tag/v2.3.0 [2] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ecdsa/key.go#L380 [3] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ecdsa/key.go#L167 [4] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ed25519/key.go#L206-L209 Signed-off-by: Moreno Ambrosin <ambrosin@google.com>
This is just #1981 rebased against main, and fixing a lint error. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2024 +/- ##
===========================================
- Coverage 57.93% 43.75% -14.19%
===========================================
Files 50 73 +23
Lines 3119 5696 +2577
===========================================
+ Hits 1807 2492 +685
- Misses 1154 2983 +1829
- Partials 158 221 +63 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
From sigstore/fulcio#2024. Will update Fulcio and other Sigstore repos to use this shared implementation. Signed-off-by: Hayden B <8418760+haydentherapper@users.noreply.github.com>
encodingName := ecdsapb.EcdsaSignatureEncoding_name[int32(params.GetEncoding())] | ||
return hashName, curveName, encodingName | ||
} | ||
curve, err := curveFromTinkECDSACurveType(ecdsaPublicKey.Parameters().(*tinkecdsa.Parameters).CurveType()) |
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.
not sure if a defensive check for ecdsaPublicKey.Parameters()
being nil
is worth it here
Going to hold on this and replace this with the impl in sigstore/sigstore |
* Update to use Tink v2.3.0 API From sigstore/fulcio#2024. Will update Fulcio and other Sigstore repos to use this shared implementation. Signed-off-by: Hayden B <8418760+haydentherapper@users.noreply.github.com> * Fix linting errors Signed-off-by: Hayden B <8418760+haydentherapper@users.noreply.github.com> --------- Signed-off-by: Hayden B <8418760+haydentherapper@users.noreply.github.com> Co-authored-by: Hayden B <8418760+haydentherapper@users.noreply.github.com>
The signer in this PR has been moved to sigstore/sigstore, #2026 instead |
Tink v2.3.0 [1] added the ability to extract individual keys from a Tink
keyset.Handle
as key objects. This PR modifiesKeyHandleToSigner
to use such APIs, significantly simplifying it. Note that there is no need to validate keys because they are validated when thekeyset.Handle
is created [2],[3],[4].Also refactoring
signer_test.go
and adding a test case for an invalid key type.[1] https://github.com/tink-crypto/tink-go/releases/tag/v2.3.0
[2] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ecdsa/key.go#L380
[3] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ecdsa/key.go#L167
[4] https://github.com/tink-crypto/tink-go/blob/v2.3.0/signature/ed25519/key.go#L206-L209
Summary
Release Note
Documentation