File: sig.go

package info (click to toggle)
golang-github-coreos-go-oidc 0.0~git20160926.0.16c5ecc-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 436 kB
  • sloc: sh: 40; makefile: 5
file content (24 lines) | stat: -rwxr-xr-x 374 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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) {
	if jwk.Type != "RSA" {
		return nil, fmt.Errorf("unsupported key type %q", jwk.Type)
	}

	return NewVerifierRSA(jwk)
}