verify

package
v0.70.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

New creates a new JWS verifier using the specified algorithm and the public key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL