package verify
import "github.com/open-policy-agent/opa/internal/jwx/jws/verify"
Index ¶
- func GetSigningKey(key string, alg jwa.SignatureAlgorithm) (interface{}, error)
- type ECDSAVerifier
- type HMACVerifier
- type RSAVerifier
- type Verifier
Functions ¶
func GetSigningKey ¶
func GetSigningKey(key string, alg jwa.SignatureAlgorithm) (interface{}, error)
GetSigningKey returns a *rsa.PublicKey or *ecdsa.PublicKey typically encoded in PEM blocks of type "PUBLIC KEY", for RSA and ECDSA family of algorithms. For HMAC family, it return a []byte value
Types ¶
type ECDSAVerifier ¶
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
ECDSAVerifier implements the Verifier interface
func (ECDSAVerifier) Verify ¶
func (v ECDSAVerifier) Verify(payload []byte, signature []byte, key interface{}) error
Verify checks whether the signature for a given input and key is correct
type HMACVerifier ¶
type HMACVerifier struct {
// contains filtered or unexported fields
}
HMACVerifier implements the Verifier interface
func (HMACVerifier) Verify ¶
func (v HMACVerifier) Verify(signingInput, signature []byte, key interface{}) (err error)
Verify checks whether the signature for a given input and key is correct
type RSAVerifier ¶
type RSAVerifier struct {
// contains filtered or unexported fields
}
RSAVerifier implements the Verifier interface
func (RSAVerifier) Verify ¶
func (v RSAVerifier) Verify(payload, signature []byte, key interface{}) error
Verify checks if a JWS is valid.
type Verifier ¶
type Verifier interface { // Verify checks whether the payload and signature are valid for // the given key. // `key` is the key used for verifying the payload, and is usually // the public key associated with the signature method. For example, // for `jwa.RSXXX` and `jwa.PSXXX` types, you need to pass the // `*"crypto/rsa".PublicKey` type. // Check the documentation for each verifier for details Verify(payload []byte, signature []byte, key interface{}) error }
Verifier provides a common interface for supported alg verification methods
func New ¶
func New(alg jwa.SignatureAlgorithm) (Verifier, error)
New creates a new JWS verifier using the specified algorithm and the public key
Source Files ¶
ecdsa.go hmac.go interface.go rsa.go verify.go
- Version
- v1.4.2 (latest)
- Published
- May 2, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 2 weeks ago –
Tools for package owners.