dex/vendor/github.com/coreos/go-oidc/jose/sig.go

25 lines
374 B
Go
Raw Normal View History

2015-08-18 05:57:27 +05:30
package jose
import (
"fmt"
)
type Verifier interface {
ID() string
Alg() string
Verify(sig []byte, data []byte) error
}
type Signer interface {
Verifier
Sign(data []byte) (sig []byte, err error)
}
func NewVerifier(jwk JWK) (Verifier, error) {
2016-05-10 02:59:14 +05:30
if jwk.Type != "RSA" {
2015-08-18 05:57:27 +05:30
return nil, fmt.Errorf("unsupported key type %q", jwk.Type)
}
return NewVerifierRSA(jwk)
}