Versions in this module Expand all Collapse all v6 v6.2.13 Sep 22, 2026 v6.2.12 Sep 21, 2026 Changes in this version + const ModuleName + var ErrKeyUsageNotSupported = errors.New("the key store can't create a key that supports the requested key usage") + var ErrPrivateKeyNotFound = errors.New("private key not found") + var ErrorInvalidNumberOfSignatures = errors.New("invalid number of signatures") + func EciesDecrypt(privateKey *ecdsa.PrivateKey, cipherText []byte) ([]byte, error) + func EciesEncrypt(publicKey *ecdsa.PublicKey, plainText []byte) ([]byte, error) + func EncryptJWE(payload []byte, protectedHeaders map[string]interface{}, publicKey interface{}) (message string, err error) + func ExtractProtectedHeaders(jwt string) (map[string]interface{}, error) + func GenerateJWK() (jwk.Key, error) + func GenerateNonce() string + func JWTKidAlg(tokenString string) (string, jwa.SignatureAlgorithm, error) + func NewMemoryStorage() spi.Storage + func ParseJWS(token []byte, f PublicKeyFunc) (payload []byte, err error) + func ParseJWT(tokenString string, f PublicKeyFunc, options ...jwt.ParseOption) (jwt.Token, error) + func SignJWS(ctx context.Context, payload []byte, protectedHeaders map[string]interface{}, ...) (string, error) + func SignJWT(ctx context.Context, key crypto.Signer, alg jwa.SignatureAlgorithm, ...) (token string, err error) + func SignatureAlgorithm(key crypto.PublicKey) (jwa.SignatureAlgorithm, error) + func Thumbprint(key jwk.Key) (string, error) + type Config struct + AzureKeyVault azure.Config + External external.Config + Storage string + Vault vault.Config + func DefaultCryptoConfig() Config + type Crypto struct + func NewAzureKeyVaultLikeCryptoInstance(db *gorm.DB) *Crypto + func NewCryptoInstance(storage storage.Engine) *Crypto + func NewDatabaseCryptoInstance(db *gorm.DB) *Crypto + func NewMemoryCryptoInstance(t *testing.T) *Crypto + func NewTestCryptoInstance(db *gorm.DB, storage spi.Storage) *Crypto + func (client *Crypto) CheckHealth() map[string]core.Health + func (client *Crypto) Config() interface{} + func (client *Crypto) Configure(config core.ServerConfig) error + func (client *Crypto) Decrypt(ctx context.Context, kid string, cipherText []byte) ([]byte, error) + func (client *Crypto) DecryptJWE(ctx context.Context, message string) (body []byte, headers map[string]interface{}, err error) + func (client *Crypto) Delete(ctx context.Context, kid string) error + func (client *Crypto) EncryptJWE(ctx context.Context, payload []byte, headers map[string]interface{}, ...) (string, error) + func (client *Crypto) Exists(ctx context.Context, kid string) (bool, error) + func (client *Crypto) Link(ctx context.Context, kid string, keyName string, version string) error + func (client *Crypto) List(ctx context.Context) []string + func (client *Crypto) Migrate() error + func (client *Crypto) Name() string + func (client *Crypto) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error) + func (client *Crypto) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error) + func (client *Crypto) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error) + func (client *Crypto) SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, ...) (string, error) + func (client *Crypto) SignJWT(ctx context.Context, claims map[string]interface{}, ...) (string, error) + type Decrypter interface + Decrypt func(ctx context.Context, kid string, ciphertext []byte) ([]byte, error) + type JWTSigner interface + SignDPoP func(ctx context.Context, token dpop.DPoP, kid string) (string, error) + SignJWS func(ctx context.Context, payload []byte, headers map[string]interface{}, ...) (string, error) + SignJWT func(ctx context.Context, claims map[string]interface{}, ...) (string, error) + type JsonWebEncryptor interface + DecryptJWE func(ctx context.Context, message string) (body []byte, headers map[string]interface{}, err error) + EncryptJWE func(ctx context.Context, payload []byte, headers map[string]interface{}, ...) (string, error) + type KIDNamingFunc func(key crypto.PublicKey) (string, error) + func ErrorNamingFunc(err error) KIDNamingFunc + func StringNamingFunc(name string) KIDNamingFunc + type KeyCreator interface + New func(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error) + type KeyResolver interface + Exists func(ctx context.Context, kid string) (bool, error) + List func(ctx context.Context) []string + Resolve func(ctx context.Context, kid string) (crypto.PublicKey, error) + type KeyStore interface + Delete func(ctx context.Context, kid string) error + Link func(ctx context.Context, kid string, keyName string, version string) error + type MemoryJWTSigner struct + Key jwk.Key + func (m MemoryJWTSigner) SignDPoP(_ context.Context, _ dpop.DPoP, _ string) (string, error) + func (m MemoryJWTSigner) SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, ...) (string, error) + func (m MemoryJWTSigner) SignJWT(ctx context.Context, claims map[string]interface{}, ...) (string, error) + type MockDecrypter struct + func NewMockDecrypter(ctrl *gomock.Controller) *MockDecrypter + func (m *MockDecrypter) Decrypt(ctx context.Context, kid string, ciphertext []byte) ([]byte, error) + func (m *MockDecrypter) EXPECT() *MockDecrypterMockRecorder + type MockDecrypterMockRecorder struct + func (mr *MockDecrypterMockRecorder) Decrypt(ctx, kid, ciphertext any) *gomock.Call + type MockJWTSigner struct + func NewMockJWTSigner(ctrl *gomock.Controller) *MockJWTSigner + func (m *MockJWTSigner) EXPECT() *MockJWTSignerMockRecorder + func (m *MockJWTSigner) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error) + func (m *MockJWTSigner) SignJWS(ctx context.Context, payload []byte, headers map[string]any, kid string, ...) (string, error) + func (m *MockJWTSigner) SignJWT(ctx context.Context, claims, headers map[string]any, kid string) (string, error) + type MockJWTSignerMockRecorder struct + func (mr *MockJWTSignerMockRecorder) SignDPoP(ctx, token, kid any) *gomock.Call + func (mr *MockJWTSignerMockRecorder) SignJWS(ctx, payload, headers, kid, detached any) *gomock.Call + func (mr *MockJWTSignerMockRecorder) SignJWT(ctx, claims, headers, kid any) *gomock.Call + type MockJsonWebEncryptor struct + func NewMockJsonWebEncryptor(ctrl *gomock.Controller) *MockJsonWebEncryptor + func (m *MockJsonWebEncryptor) DecryptJWE(ctx context.Context, message string) ([]byte, map[string]any, error) + func (m *MockJsonWebEncryptor) EXPECT() *MockJsonWebEncryptorMockRecorder + func (m *MockJsonWebEncryptor) EncryptJWE(ctx context.Context, payload []byte, headers map[string]any, publicKey any) (string, error) + type MockJsonWebEncryptorMockRecorder struct + func (mr *MockJsonWebEncryptorMockRecorder) DecryptJWE(ctx, message any) *gomock.Call + func (mr *MockJsonWebEncryptorMockRecorder) EncryptJWE(ctx, payload, headers, publicKey any) *gomock.Call + type MockKeyCreator struct + func NewMockKeyCreator(ctrl *gomock.Controller) *MockKeyCreator + func (m *MockKeyCreator) EXPECT() *MockKeyCreatorMockRecorder + func (m *MockKeyCreator) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error) + type MockKeyCreatorMockRecorder struct + func (mr *MockKeyCreatorMockRecorder) New(ctx, namingFunc, requiredUsage any) *gomock.Call + type MockKeyResolver struct + func NewMockKeyResolver(ctrl *gomock.Controller) *MockKeyResolver + func (m *MockKeyResolver) EXPECT() *MockKeyResolverMockRecorder + func (m *MockKeyResolver) Exists(ctx context.Context, kid string) (bool, error) + func (m *MockKeyResolver) List(ctx context.Context) []string + func (m *MockKeyResolver) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error) + type MockKeyResolverMockRecorder struct + func (mr *MockKeyResolverMockRecorder) Exists(ctx, kid any) *gomock.Call + func (mr *MockKeyResolverMockRecorder) List(ctx any) *gomock.Call + func (mr *MockKeyResolverMockRecorder) Resolve(ctx, kid any) *gomock.Call + type MockKeyStore struct + func NewMockKeyStore(ctrl *gomock.Controller) *MockKeyStore + func (m *MockKeyStore) Decrypt(ctx context.Context, kid string, ciphertext []byte) ([]byte, error) + func (m *MockKeyStore) DecryptJWE(ctx context.Context, message string) ([]byte, map[string]any, error) + func (m *MockKeyStore) Delete(ctx context.Context, kid string) error + func (m *MockKeyStore) EXPECT() *MockKeyStoreMockRecorder + func (m *MockKeyStore) EncryptJWE(ctx context.Context, payload []byte, headers map[string]any, publicKey any) (string, error) + func (m *MockKeyStore) Exists(ctx context.Context, kid string) (bool, error) + func (m *MockKeyStore) Link(ctx context.Context, kid, keyName, version string) error + func (m *MockKeyStore) List(ctx context.Context) []string + func (m *MockKeyStore) New(ctx context.Context, namingFunc KIDNamingFunc, requiredUsage orm.DIDKeyFlags) (*orm.KeyReference, crypto.PublicKey, error) + func (m *MockKeyStore) Resolve(ctx context.Context, kid string) (crypto.PublicKey, error) + func (m *MockKeyStore) SignDPoP(ctx context.Context, token dpop.DPoP, kid string) (string, error) + func (m *MockKeyStore) SignJWS(ctx context.Context, payload []byte, headers map[string]any, kid string, ...) (string, error) + func (m *MockKeyStore) SignJWT(ctx context.Context, claims, headers map[string]any, kid string) (string, error) + type MockKeyStoreMockRecorder struct + func (mr *MockKeyStoreMockRecorder) Decrypt(ctx, kid, ciphertext any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) DecryptJWE(ctx, message any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) Delete(ctx, kid any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) EncryptJWE(ctx, payload, headers, publicKey any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) Exists(ctx, kid any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) Link(ctx, kid, keyName, version any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) List(ctx any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) New(ctx, namingFunc, requiredUsage any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) Resolve(ctx, kid any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) SignDPoP(ctx, token, kid any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) SignJWS(ctx, payload, headers, kid, detached any) *gomock.Call + func (mr *MockKeyStoreMockRecorder) SignJWT(ctx, claims, headers, kid any) *gomock.Call + type PublicKeyFunc func(kid string) (crypto.PublicKey, error) + type TestKey struct + KID string + PrivateKey crypto.Signer + PublicKey crypto.PublicKey + func NewTestKey(kid string) *TestKey + func (t TestKey) Private() crypto.PrivateKey + func (t TestKey) Signer() crypto.Signer Other modules containing this package github.com/nuts-foundation/nuts-node github.com/nuts-foundation/nuts-node/v5