func VerifySignature(jwt jose.JWT, keys []key.PublicKey) (bool, error) { jwtBytes := []byte(jwt.Data()) for _, k := range keys { v, err := k.Verifier() if err != nil { return false, err } if v.Verify(jwt.Signature, jwtBytes) == nil { return true, nil } } return false, nil }
func validateJWTSignature(jwt *jose.JWT, jwkSet *jwkSet) (bool, error) { for _, jwk := range jwkSet.Keys { v, err := jose.NewVerifier(jwk) if err != nil { return false, err } if err := v.Verify(jwt.Signature, []byte(jwt.Data())); err == nil { return true, nil } } return false, nil }