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)
|
|
|
|
}
|