opa: github.com/open-policy-agent/opa/topdown/internal/jwx/jws/sign Index | Files

package sign

import "github.com/open-policy-agent/opa/topdown/internal/jwx/jws/sign"

Index

Package Files

ecdsa.go hmac.go interface.go rsa.go sign.go

type ECDSASigner Uses

type ECDSASigner struct {
    // contains filtered or unexported fields
}

ECDSASigner uses crypto/ecdsa to sign the payloads.

func (ECDSASigner) Algorithm Uses

func (s ECDSASigner) Algorithm() jwa.SignatureAlgorithm

Algorithm returns the signer algorithm

func (ECDSASigner) Sign Uses

func (s ECDSASigner) Sign(payload []byte, key interface{}) ([]byte, error)

Sign signs payload with a ECDSA private key

type HMACSigner Uses

type HMACSigner struct {
    // contains filtered or unexported fields
}

HMACSigner uses crypto/hmac to sign the payloads.

func (HMACSigner) Algorithm Uses

func (s HMACSigner) Algorithm() jwa.SignatureAlgorithm

Algorithm returns the signer algorithm

func (HMACSigner) Sign Uses

func (s HMACSigner) Sign(payload []byte, key interface{}) ([]byte, error)

Sign signs payload with a Symmetric key

type RSASigner Uses

type RSASigner struct {
    // contains filtered or unexported fields
}

RSASigner uses crypto/rsa to sign the payloads.

func (RSASigner) Algorithm Uses

func (s RSASigner) Algorithm() jwa.SignatureAlgorithm

Algorithm returns the signer algorithm

func (RSASigner) Sign Uses

func (s RSASigner) Sign(payload []byte, key interface{}) ([]byte, error)

Sign creates a signature using crypto/rsa. key must be a non-nil instance of `*"crypto/rsa".PrivateKey`.

type Signer Uses

type Signer interface {
    // Sign creates a signature for the given `payload`.
    // `key` is the key used for signing the payload, and is usually
    // the private key type associated with the signature method. For example,
    // for `jwa.RSXXX` and `jwa.PSXXX` types, you need to pass the
    // `*"crypto/rsa".PrivateKey` type.
    // Check the documentation for each signer for details
    Sign(payload []byte, key interface{}) ([]byte, error)

    Algorithm() jwa.SignatureAlgorithm
}

Signer provides a common interface for supported alg signing methods

func New Uses

func New(alg jwa.SignatureAlgorithm) (Signer, error)

New creates a signer that signs payloads using the given signature algorithm.

Package sign imports 10 packages (graph) and is imported by 2 packages. Updated 2019-11-03. Refresh now. Tools for package owners.