crypto

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Package crypto is a generated GoMock package.

Index

Constants

View Source
const (
	// ModuleName contains the name of this module
	ModuleName = "Crypto"
)

Variables

View Source
var ErrKeyUsageNotSupported = errors.New("the key store can't create a key that supports the requested key usage")

ErrKeyUsageNotSupported is returned when the configured key store backend can't create a key that backs the requested DIDKeyFlags, e.g. Azure Key Vault can't create keys usable for decryption/KeyAgreement. No key is created when this is returned.

View Source
var ErrPrivateKeyNotFound = errors.New("private key not found")

ErrPrivateKeyNotFound is returned when the private key doesn't exist

View Source
var ErrorInvalidNumberOfSignatures = errors.New("invalid number of signatures")

ErrorInvalidNumberOfSignatures indicates that the number of signatures present in the JWT is invalid.

Functions

func EciesDecrypt

func EciesDecrypt(privateKey *ecdsa.PrivateKey, cipherText []byte) ([]byte, error)

EciesDecrypt decrypts the `cipherText` using the Elliptic Curve Integrated Encryption Scheme

func EciesEncrypt

func EciesEncrypt(publicKey *ecdsa.PublicKey, plainText []byte) ([]byte, error)

EciesEncrypt encrypts the `plainText` using the Elliptic Curve Integrated Encryption Scheme

func EncryptJWE

func EncryptJWE(payload []byte, protectedHeaders map[string]interface{}, publicKey interface{}) (message string, err error)

func ExtractProtectedHeaders

func ExtractProtectedHeaders(jwt string) (map[string]interface{}, error)

ExtractProtectedHeaders extracts the protected headers from a JWT string. The function takes a JWT string as input and returns a map of the protected headers. Note that:

  • This method ignores any parsing errors and returns an empty map instead of an error.

func GenerateJWK

func GenerateJWK() (jwk.Key, error)

GenerateJWK a new in-memory key pair and returns it as JWK. It sets the alg field of the JWK.

func GenerateNonce

func GenerateNonce() string

GenerateNonce creates a 256 bit secure random

func JWTKidAlg

func JWTKidAlg(tokenString string) (string, jwa.SignatureAlgorithm, error)

JWTKidAlg parses a JWT, does not validate it and returns the 'kid' and 'alg' headers

func NewMemoryStorage

func NewMemoryStorage() spi.Storage

func ParseJWS

func ParseJWS(token []byte, f PublicKeyFunc) (payload []byte, err error)

ParseJWS parses a JWS byte array object, validates and verifies it. This method returns the value of the payload as byte array, or an error if the parsing fails at any level.

func ParseJWT

func ParseJWT(tokenString string, f PublicKeyFunc, options ...jwt.ParseOption) (jwt.Token, error)

ParseJWT parses a token, validates and verifies it.

func SignJWS

func SignJWS(ctx context.Context, payload []byte, protectedHeaders map[string]interface{}, privateKey crypto.Signer, detachedPayload bool) (string, error)

func SignJWT

func SignJWT(ctx context.Context, key crypto.Signer, alg jwa.SignatureAlgorithm, claims map[string]interface{}, headers map[string]interface{}) (token string, err error)

SignJWT signs claims with the signer and returns the compacted token. The headers param can be used to add additional headers

func SignatureAlgorithm

func SignatureAlgorithm(key crypto.PublicKey) (jwa.SignatureAlgorithm, error)

SignatureAlgorithm determines the jwa.SigningAlgorithm for ec/rsa/ed25519 keys.

func Thumbprint

func Thumbprint(key jwk.Key) (string, error)

Thumbprint generates a Nuts compatible thumbprint: Base58(SHA256(rfc7638-json))

Types

type Config

type Config struct {
	Storage       string          `koanf:"storage"`
	Vault         vault.Config    `koanf:"vault"`
	AzureKeyVault azure.Config    `koanf:"azurekv"`
	External      external.Config `koanf:"external"`
}

Config holds the values for the crypto engine

func DefaultCryptoConfig

func DefaultCryptoConfig() Config

DefaultCryptoConfig returns a Config with default settings for Vault and Azure keyVault

type Crypto

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

Crypto holds references to storage and needed config

func NewAzureKeyVaultLikeCryptoInstance

func NewAzureKeyVaultLikeCryptoInstance(db *gorm.DB) *Crypto

NewAzureKeyVaultLikeCryptoInstance returns a Crypto test instance configured as if it were using the Azure Key Vault backend, without needing a real Azure connection: it can back signing, but not KeyAgreement (decryption/ECDH).

func NewCryptoInstance

func NewCryptoInstance(storage storage.Engine) *Crypto

NewCryptoInstance creates a new instance of the crypto engine.

func NewDatabaseCryptoInstance

func NewDatabaseCryptoInstance(db *gorm.DB) *Crypto

NewDatabaseCryptoInstance returns a new Crypto instance to be used for tests, storing keys in-memory and the given DB.

func NewMemoryCryptoInstance

func NewMemoryCryptoInstance(t *testing.T) *Crypto

NewMemoryCryptoInstance returns a new Crypto instance to be used for tests, storing keys in-memory and creating a new SQL DB.

func NewTestCryptoInstance

func NewTestCryptoInstance(db *gorm.DB, storage spi.Storage) *Crypto

NewTestCryptoInstance returns a new Crypto instance to be used for tests, allowing to use of preconfigured backend.

func (*Crypto) CheckHealth

func (client *Crypto) CheckHealth() map[string]core.Health

func (*Crypto) Config

func (client *Crypto) Config() interface{}

func (*Crypto) Configure

func (client *Crypto) Configure(config core.ServerConfig) error

Configure loads the given configurations in the engine. Any wrong combination will return an error

func (*Crypto) Decrypt

func (client *Crypto) Decrypt(ctx context.Context, kid string, cipherText []byte) ([]byte, error)

Decrypt decrypts the `cipherText` with key `kid`

func (*Crypto) DecryptJWE

func (client *Crypto) DecryptJWE(ctx context.Context, message string) (body []byte, headers map[string]interface{}, err error)

DecryptJWE decrypts a message using the associated private key from the kid header.

func (*Crypto) Delete

func (client *Crypto) Delete(ctx context.Context, kid string) error

Delete removes the private key with the given KID from the KeyStore.

func (*Crypto) EncryptJWE

func (client *Crypto) EncryptJWE(ctx context.Context, payload []byte, headers map[string]interface{}, publicKey interface{}) (string, error)

EncryptJWE encrypts a payload using the provided public key and key identifier.

func (*Crypto) Exists

func (client *Crypto) Exists(ctx context.Context, kid string) (bool, error)

Exists checks storage for an entry for the given legal entity and returns true if it exists

func (client *Crypto) Link(ctx context.Context, kid string, keyName string, version string) error

func (*Crypto) List

func (client *Crypto) List(ctx context.Context) []string

List returns the KIDs of the private keys that are present in the key store.

func (*Crypto) Migrate

func (client *Crypto) Migrate() error

func (*Crypto) Name

func (client *Crypto) Name() string

func (*Crypto) New

func (client *Crypto) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error)

New generates a new key pair. Stores the private key, returns the public key and DB reference. requiredUsage is checked against supportedKeyUsage before any key is created: if the configured backend can't fully back it (e.g. Azure Key Vault can't back KeyAgreement, since it doesn't support decryption/ECDH), no key is created and ErrKeyUsageNotSupported is returned. It also returns an error when a key with the resulting ID already exists.

func (*Crypto) Resolve

func (client *Crypto) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error)

func (*Crypto) SignDPoP

func (client *Crypto) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error)

func (*Crypto) SignJWS

func (client *Crypto) SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, kid string, detached bool) (string, error)

SignJWS creates a signed JWS using the indicated key and map of headers and payload as bytes.

func (*Crypto) SignJWT

func (client *Crypto) SignJWT(ctx context.Context, claims map[string]interface{}, headers map[string]interface{}, kid string) (string, error)

SignJWT creates a JWT from the given claims and signs it with the given key.

type Decrypter

type Decrypter interface {
	// Decrypt decrypts the `cipherText` with key `kid`
	// The context is used to pass audit information.
	// Note: decryption isn't audit logged, because:
	// - it involved very deep context passing,
	// - it's called by the system itself, not triggered by a user.
	// - to be removed in near future when we switch to multi-chains, which eliminates private TXs and thus encryption altogether.
	Decrypt(ctx context.Context, kid string, ciphertext []byte) ([]byte, error)
}

Decrypter is the interface to support decryption

type JWTSigner

type JWTSigner interface {
	// SignJWT creates a signed JWT using the indicated key and map of claims and additional headers.
	// The KID is the external facing Key ID (eg: from the DID Document). the context is used to pass audit information.
	// The headers can be used to add/override headers in the JWT.
	// Returns ErrPrivateKeyNotFound when the private key is not present.
	SignJWT(ctx context.Context, claims map[string]interface{}, headers map[string]interface{}, kid string) (string, error)
	// SignJWS creates a signed JWS using the indicated key and map of headers and payload as bytes.
	// The detached boolean indicates if the body needs to be excluded from the response (detached mode).
	// The KID is the external facing Key ID (eg: from the DID Document).
	// context is used to pass audit information.
	// Returns ErrPrivateKeyNotFound when the private key is not present.
	SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, kid string, detached bool) (string, error)
	// SignDPoP signs a DPoP token for the given kid.
	// It adds the requested key as jwk header to the DPoP token.
	SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error)
}

JWTSigner is the interface used to sign authorization tokens.

type JsonWebEncryptor

type JsonWebEncryptor interface {
	// EncryptJWE encrypts a payload as bytes into a JWE message with the given key and kid.
	// The publicKey must be a public key
	// The kid must be the KeyID and will be placed in the header, if not set.
	EncryptJWE(ctx context.Context, payload []byte, headers map[string]interface{}, publicKey interface{}) (string, error)

	// DecryptJWE decrypts a message as bytes into a decrypted body and headers.
	// The corresponding private key must be located in the KeyID (kid) header.
	DecryptJWE(ctx context.Context, message string) (body []byte, headers map[string]interface{}, err error)
}

JsonWebEncryptor is the interface used to encrypt and decrypt JWE messages.

type KIDNamingFunc

type KIDNamingFunc func(key crypto.PublicKey) (string, error)

KIDNamingFunc is a function passed to New() which generates the kid for the pub/priv key

func ErrorNamingFunc

func ErrorNamingFunc(err error) KIDNamingFunc

func StringNamingFunc

func StringNamingFunc(name string) KIDNamingFunc

type KeyCreator

type KeyCreator interface {
	// New generates a keypair and returns a reference. The context is used to pass audit information.
	// It generates a key at the backend and stores its reference in the SQL DB.
	// A DB transaction may be passed through the context using `orm.TransactionKey`.
	// requiredUsage is checked against what the configured key store backend can actually back (e.g.
	// an Azure Key Vault EC key can't be used for KeyAgreement, since Azure Key Vault doesn't support
	// decryption/ECDH with it) before any key is created. If the backend can't fully satisfy it, no
	// key is created and ErrKeyUsageNotSupported is returned.
	New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error)
}

KeyCreator is the interface for creating key pairs.

type KeyResolver

type KeyResolver interface {
	// Exists returns if the specified private key exists.
	// If an error occurs, false is also returned
	Exists(ctx context.Context, kid string) (bool, error)
	// Resolve returns a Key for the given KID. ErrPrivateKeyNotFound is returned for an unknown KID.
	Resolve(ctx context.Context, kid string) (crypto.PublicKey, error)
	// List returns the KIDs of the private keys that are present in the KeyStore.
	List(ctx context.Context) []string
}

KeyResolver is the interface for resolving keys.

type KeyStore

type KeyStore interface {
	Decrypter
	JsonWebEncryptor
	KeyCreator
	KeyResolver
	JWTSigner

	// Delete removes the private key with the given KID from the KeyStore.
	Delete(ctx context.Context, kid string) error

	// Link links the key in the keystore to a kid
	// see https://github.com/nuts-foundation/nuts-node/issues/3292
	Link(ctx context.Context, kid string, keyName string, version string) error
}

KeyStore defines the functions for working with private keys.

type MemoryJWTSigner

type MemoryJWTSigner struct {
	Key jwk.Key
}

MemoryJWTSigner is a JWTSigner implementation that performs cryptographic operations on an in-memory JWK. This should only be used for low-assurance use cases, e.g. session-bound user keys.

func (MemoryJWTSigner) SignDPoP

func (m MemoryJWTSigner) SignDPoP(_ context.Context, _ dpop.DPoP, _ string) (string, error)

func (MemoryJWTSigner) SignJWS

func (m MemoryJWTSigner) SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, kid string, detached bool) (string, error)

func (MemoryJWTSigner) SignJWT

func (m MemoryJWTSigner) SignJWT(ctx context.Context, claims map[string]interface{}, headers map[string]interface{}, kid string) (string, error)

type MockDecrypter

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

MockDecrypter is a mock of Decrypter interface.

func NewMockDecrypter

func NewMockDecrypter(ctrl *gomock.Controller) *MockDecrypter

NewMockDecrypter creates a new mock instance.

func (*MockDecrypter) Decrypt

func (m *MockDecrypter) Decrypt(ctx context.Context, kid string, ciphertext []byte) ([]byte, error)

Decrypt mocks base method.

func (*MockDecrypter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockDecrypterMockRecorder

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

MockDecrypterMockRecorder is the mock recorder for MockDecrypter.

func (*MockDecrypterMockRecorder) Decrypt

func (mr *MockDecrypterMockRecorder) Decrypt(ctx, kid, ciphertext any) *gomock.Call

Decrypt indicates an expected call of Decrypt.

type MockJWTSigner

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

MockJWTSigner is a mock of JWTSigner interface.

func NewMockJWTSigner

func NewMockJWTSigner(ctrl *gomock.Controller) *MockJWTSigner

NewMockJWTSigner creates a new mock instance.

func (*MockJWTSigner) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJWTSigner) SignDPoP

func (m *MockJWTSigner) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error)

SignDPoP mocks base method.

func (*MockJWTSigner) SignJWS

func (m *MockJWTSigner) SignJWS(ctx context.Context, payload []byte, headers map[string]any, kid string, detached bool) (string, error)

SignJWS mocks base method.

func (*MockJWTSigner) SignJWT

func (m *MockJWTSigner) SignJWT(ctx context.Context, claims, headers map[string]any, kid string) (string, error)

SignJWT mocks base method.

type MockJWTSignerMockRecorder

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

MockJWTSignerMockRecorder is the mock recorder for MockJWTSigner.

func (*MockJWTSignerMockRecorder) SignDPoP

func (mr *MockJWTSignerMockRecorder) SignDPoP(ctx, token, kid any) *gomock.Call

SignDPoP indicates an expected call of SignDPoP.

func (*MockJWTSignerMockRecorder) SignJWS

func (mr *MockJWTSignerMockRecorder) SignJWS(ctx, payload, headers, kid, detached any) *gomock.Call

SignJWS indicates an expected call of SignJWS.

func (*MockJWTSignerMockRecorder) SignJWT

func (mr *MockJWTSignerMockRecorder) SignJWT(ctx, claims, headers, kid any) *gomock.Call

SignJWT indicates an expected call of SignJWT.

type MockJsonWebEncryptor

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

MockJsonWebEncryptor is a mock of JsonWebEncryptor interface.

func NewMockJsonWebEncryptor

func NewMockJsonWebEncryptor(ctrl *gomock.Controller) *MockJsonWebEncryptor

NewMockJsonWebEncryptor creates a new mock instance.

func (*MockJsonWebEncryptor) DecryptJWE

func (m *MockJsonWebEncryptor) DecryptJWE(ctx context.Context, message string) ([]byte, map[string]any, error)

DecryptJWE mocks base method.

func (*MockJsonWebEncryptor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJsonWebEncryptor) EncryptJWE

func (m *MockJsonWebEncryptor) EncryptJWE(ctx context.Context, payload []byte, headers map[string]any, publicKey any) (string, error)

EncryptJWE mocks base method.

type MockJsonWebEncryptorMockRecorder

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

MockJsonWebEncryptorMockRecorder is the mock recorder for MockJsonWebEncryptor.

func (*MockJsonWebEncryptorMockRecorder) DecryptJWE

func (mr *MockJsonWebEncryptorMockRecorder) DecryptJWE(ctx, message any) *gomock.Call

DecryptJWE indicates an expected call of DecryptJWE.

func (*MockJsonWebEncryptorMockRecorder) EncryptJWE

func (mr *MockJsonWebEncryptorMockRecorder) EncryptJWE(ctx, payload, headers, publicKey any) *gomock.Call

EncryptJWE indicates an expected call of EncryptJWE.

type MockKeyCreator

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

MockKeyCreator is a mock of KeyCreator interface.

func NewMockKeyCreator

func NewMockKeyCreator(ctrl *gomock.Controller) *MockKeyCreator

NewMockKeyCreator creates a new mock instance.

func (*MockKeyCreator) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockKeyCreator) New

func (m *MockKeyCreator) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error)

New mocks base method.

type MockKeyCreatorMockRecorder

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

MockKeyCreatorMockRecorder is the mock recorder for MockKeyCreator.

func (*MockKeyCreatorMockRecorder) New

func (mr *MockKeyCreatorMockRecorder) New(ctx, namingFunc, requiredUsage any) *gomock.Call

New indicates an expected call of New.

type MockKeyResolver

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

MockKeyResolver is a mock of KeyResolver interface.

func NewMockKeyResolver

func NewMockKeyResolver(ctrl *gomock.Controller) *MockKeyResolver

NewMockKeyResolver creates a new mock instance.

func (*MockKeyResolver) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockKeyResolver) Exists

func (m *MockKeyResolver) Exists(ctx context.Context, kid string) (bool, error)

Exists mocks base method.

func (*MockKeyResolver) List

func (m *MockKeyResolver) List(ctx context.Context) []string

List mocks base method.

func (*MockKeyResolver) Resolve

func (m *MockKeyResolver) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error)

Resolve mocks base method.

type MockKeyResolverMockRecorder

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

MockKeyResolverMockRecorder is the mock recorder for MockKeyResolver.

func (*MockKeyResolverMockRecorder) Exists

func (mr *MockKeyResolverMockRecorder) Exists(ctx, kid any) *gomock.Call

Exists indicates an expected call of Exists.

func (*MockKeyResolverMockRecorder) List

func (mr *MockKeyResolverMockRecorder) List(ctx any) *gomock.Call

List indicates an expected call of List.

func (*MockKeyResolverMockRecorder) Resolve

func (mr *MockKeyResolverMockRecorder) Resolve(ctx, kid any) *gomock.Call

Resolve indicates an expected call of Resolve.

type MockKeyStore

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

MockKeyStore is a mock of KeyStore interface.

func NewMockKeyStore

func NewMockKeyStore(ctrl *gomock.Controller) *MockKeyStore

NewMockKeyStore creates a new mock instance.

func (*MockKeyStore) Decrypt

func (m *MockKeyStore) Decrypt(ctx context.Context, kid string, ciphertext []byte) ([]byte, error)

Decrypt mocks base method.

func (*MockKeyStore) DecryptJWE

func (m *MockKeyStore) DecryptJWE(ctx context.Context, message string) ([]byte, map[string]any, error)

DecryptJWE mocks base method.

func (*MockKeyStore) Delete

func (m *MockKeyStore) Delete(ctx context.Context, kid string) error

Delete mocks base method.

func (*MockKeyStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockKeyStore) EncryptJWE

func (m *MockKeyStore) EncryptJWE(ctx context.Context, payload []byte, headers map[string]any, publicKey any) (string, error)

EncryptJWE mocks base method.

func (*MockKeyStore) Exists

func (m *MockKeyStore) Exists(ctx context.Context, kid string) (bool, error)

Exists mocks base method.

func (m *MockKeyStore) Link(ctx context.Context, kid, keyName, version string) error

Link mocks base method.

func (*MockKeyStore) List

func (m *MockKeyStore) List(ctx context.Context) []string

List mocks base method.

func (*MockKeyStore) New

func (m *MockKeyStore) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error)

New mocks base method.

func (*MockKeyStore) Resolve

func (m *MockKeyStore) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error)

Resolve mocks base method.

func (*MockKeyStore) SignDPoP

func (m *MockKeyStore) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error)

SignDPoP mocks base method.

func (*MockKeyStore) SignJWS

func (m *MockKeyStore) SignJWS(ctx context.Context, payload []byte, headers map[string]any, kid string, detached bool) (string, error)

SignJWS mocks base method.

func (*MockKeyStore) SignJWT

func (m *MockKeyStore) SignJWT(ctx context.Context, claims, headers map[string]any, kid string) (string, error)

SignJWT mocks base method.

type MockKeyStoreMockRecorder

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

MockKeyStoreMockRecorder is the mock recorder for MockKeyStore.

func (*MockKeyStoreMockRecorder) Decrypt

func (mr *MockKeyStoreMockRecorder) Decrypt(ctx, kid, ciphertext any) *gomock.Call

Decrypt indicates an expected call of Decrypt.

func (*MockKeyStoreMockRecorder) DecryptJWE

func (mr *MockKeyStoreMockRecorder) DecryptJWE(ctx, message any) *gomock.Call

DecryptJWE indicates an expected call of DecryptJWE.

func (*MockKeyStoreMockRecorder) Delete

func (mr *MockKeyStoreMockRecorder) Delete(ctx, kid any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockKeyStoreMockRecorder) EncryptJWE

func (mr *MockKeyStoreMockRecorder) EncryptJWE(ctx, payload, headers, publicKey any) *gomock.Call

EncryptJWE indicates an expected call of EncryptJWE.

func (*MockKeyStoreMockRecorder) Exists

func (mr *MockKeyStoreMockRecorder) Exists(ctx, kid any) *gomock.Call

Exists indicates an expected call of Exists.

func (mr *MockKeyStoreMockRecorder) Link(ctx, kid, keyName, version any) *gomock.Call

Link indicates an expected call of Link.

func (*MockKeyStoreMockRecorder) List

func (mr *MockKeyStoreMockRecorder) List(ctx any) *gomock.Call

List indicates an expected call of List.

func (*MockKeyStoreMockRecorder) New

func (mr *MockKeyStoreMockRecorder) New(ctx, namingFunc, requiredUsage any) *gomock.Call

New indicates an expected call of New.

func (*MockKeyStoreMockRecorder) Resolve

func (mr *MockKeyStoreMockRecorder) Resolve(ctx, kid any) *gomock.Call

Resolve indicates an expected call of Resolve.

func (*MockKeyStoreMockRecorder) SignDPoP

func (mr *MockKeyStoreMockRecorder) SignDPoP(ctx, token, kid any) *gomock.Call

SignDPoP indicates an expected call of SignDPoP.

func (*MockKeyStoreMockRecorder) SignJWS

func (mr *MockKeyStoreMockRecorder) SignJWS(ctx, payload, headers, kid, detached any) *gomock.Call

SignJWS indicates an expected call of SignJWS.

func (*MockKeyStoreMockRecorder) SignJWT

func (mr *MockKeyStoreMockRecorder) SignJWT(ctx, claims, headers, kid any) *gomock.Call

SignJWT indicates an expected call of SignJWT.

type PublicKeyFunc

type PublicKeyFunc func(kid string) (crypto.PublicKey, error)

PublicKeyFunc defines a function that resolves a public key based on a kid

type TestKey

type TestKey struct {
	KID        string
	PublicKey  crypto.PublicKey
	PrivateKey crypto.Signer
}

TestKey is a Key impl for testing purposes

func NewTestKey

func NewTestKey(kid string) *TestKey

NewTestKey creates a new TestKey with a given kid

func (TestKey) Private

func (t TestKey) Private() crypto.PrivateKey

func (TestKey) Signer

func (t TestKey) Signer() crypto.Signer

Directories

Path Synopsis
api
v1
Package v1 provides primitives to interact with the openapi HTTP API.
Package v1 provides primitives to interact with the openapi HTTP API.
Package storage provides secret storage for the Crypto module.
Package storage provides secret storage for the Crypto module.
azure
Package azure is a generated GoMock package.
Package azure is a generated GoMock package.
external
Package external provides primitives to interact with the openapi HTTP API.
Package external provides primitives to interact with the openapi HTTP API.
fs
spi
Package spi is a generated GoMock package.
Package spi is a generated GoMock package.

Jump to

Keyboard shortcuts

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