core

package
v0.0.0-...-4514fd0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyValueNotFound indicates that a value for the key does not exist
	ErrKeyValueNotFound = errors.New("value for key not found")
)

Functions

This section is empty.

Types

type ConfigBackend

type ConfigBackend interface {
	Lookup(key string) (interface{}, bool)
}

ConfigBackend backend for all config types in SDK

type ConfigProvider

type ConfigProvider func() ([]ConfigBackend, error)

ConfigProvider provides config backend for SDK

type CryptoSuite

type CryptoSuite interface {

	// KeyGen generates a key using opts.
	KeyGen(opts KeyGenOpts) (k Key, err error)

	// KeyImport imports a key from its raw representation using opts.
	// The opts argument should be appropriate for the primitive used.
	KeyImport(raw interface{}, opts KeyImportOpts) (k Key, err error)

	// GetKey returns the key this CSP associates to
	// the Subject Key Identifier ski.
	GetKey(ski []byte) (k Key, err error)

	// Hash hashes messages msg using options opts.
	// If opts is nil, the default hash function will be used.
	Hash(msg []byte, opts HashOpts) (hash []byte, err error)

	// GetHash returns and instance of hash.Hash using options opts.
	// If opts is nil, the default hash function will be returned.
	GetHash(opts HashOpts) (h hash.Hash, err error)

	// Sign signs digest using key k.
	// The opts argument should be appropriate for the algorithm used.
	//
	// Note that when a signature of a hash of a larger message is needed,
	// the caller is responsible for hashing the larger message and passing
	// the hash (as digest).
	Sign(k Key, digest []byte, opts SignerOpts) (signature []byte, err error)

	// Verify verifies signature against key k and digest
	// The opts argument should be appropriate for the algorithm used.
	Verify(k Key, signature, digest []byte, opts SignerOpts) (valid bool, err error)
}

CryptoSuite adaptor for all bccsp functionalities used by SDK

type CryptoSuiteConfig

type CryptoSuiteConfig interface {
	IsSecurityEnabled() bool
	SecurityAlgorithm() string
	SecurityLevel() int
	SecurityProvider() string
	SoftVerify() bool
	SecurityProviderLibPath() string
	SecurityProviderPin() string
	SecurityProviderLabel() string
	KeyStorePath() string
}

CryptoSuiteConfig contains sdk configuration items for cryptosuite.

type HashOpts

type HashOpts interface {

	// Algorithm returns the hash algorithm identifier (to be used).
	Algorithm() string
}

HashOpts contains options for hashing with a CSP.

type KVStore

type KVStore interface {

	/**
	 * Store sets the value for the key.
	 */
	Store(key interface{}, value interface{}) error

	/**
	 * Load returns the value stored in the store for a key.
	 * If a value for the key was not found, returns (nil, ErrNotFound)
	 */
	Load(key interface{}) (interface{}, error)

	/**
	 * Delete deletes the value for a key.
	 */
	Delete(key interface{}) error
}

KVStore is a generic key-value store interface.

type Key

type Key interface {

	// Bytes converts this key to its byte representation,
	// if this operation is allowed.
	Bytes() ([]byte, error)

	// SKI returns the subject key identifier of this key.
	SKI() []byte

	// Symmetric returns true if this key is a symmetric key,
	// false is this key is asymmetric
	Symmetric() bool

	// Private returns true if this key is a private key,
	// false otherwise.
	Private() bool

	// PublicKey returns the corresponding public key part of an asymmetric public/private key pair.
	// This method returns an error in symmetric key schemes.
	PublicKey() (Key, error)
}

Key represents a cryptographic key

type KeyGenOpts

type KeyGenOpts interface {

	// Algorithm returns the key generation algorithm identifier (to be used).
	Algorithm() string

	// Ephemeral returns true if the key to generate has to be ephemeral,
	// false otherwise.
	Ephemeral() bool
}

KeyGenOpts contains options for key-generation with a CSP.

type KeyImportOpts

type KeyImportOpts interface {

	// Algorithm returns the key importation algorithm identifier (to be used).
	Algorithm() string

	// Ephemeral returns true if the key generated has to be ephemeral,
	// false otherwise.
	Ephemeral() bool
}

KeyImportOpts contains options for importing the raw material of a key with a CSP.

type Providers

type Providers interface {
	CryptoSuite() CryptoSuite
	SigningManager() SigningManager
}

Providers represents the SDK configured core providers context.

type SignerOpts

type SignerOpts interface {
	crypto.SignerOpts
}

SignerOpts contains options for signing with a CSP.

type SigningManager

type SigningManager interface {
	Sign([]byte, Key) ([]byte, error)
}

SigningManager signs object with provided key

Jump to

Keyboard shortcuts

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