Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Native support for key rotation in verifications #372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fishy
Copy link

@fishy fishy commented Jan 9, 2020

Add native support for key rotation for ES*, HS*, RS*, and PS*
verifications.

In those SigningMethod's Verify implementations, also allow the key to
be the type of the slice of the supported key type, so that the caller
can implement the KeyFunc to return all the accepted keys together to
support key rotation.

While key rotation verification can be done on the callers' side without
this change, this change provides better performance because:

  • When trying the next key, the steps before actually using the key do
    not need to be performed again.

  • If a verification process failed for non-key reasons (for example,
    because it's already expired), it saves the effort to try the next
    key.

@fishy fishy changed the title Support key-rotation for ES*, HS*, RS*, and PS* verifications Native support for key rotation in verifications Jan 9, 2020
@fishy fishy requested a review from dgrijalva January 15, 2020 22:52
@fishy fishy force-pushed the key-rotation branch 4 times, most recently from 320829c to 50e63e0 Compare February 22, 2020 00:40
Add native support for key rotation for ES*, HS*, RS*, and PS*
verifications.

In those SigningMethod's Verify implementations, also allow the key to
be the type of the slice of the supported key type, so that the caller
can implement the KeyFunc to return all the accepted keys together to
support key rotation.

While key rotation verification can be done on the callers' side without
this change, this change provides better performance because:

- When trying the next key, the steps before actually using the key do
  not need to be performed again.

- If a verification process failed for non-key reasons (for example,
  because it's already expired), it saves the effort to try the next
  key.
@fishy
Copy link
Author

fishy commented Mar 22, 2020

Here is an example of how it's used: reddit/baseplate.go@0bd3365

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant