mocks

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCCSP

type BCCSP struct {
	mock.Mock
}

BCCSP mocks a BCCSP to be used in the util package

func (*BCCSP) Decrypt

func (*BCCSP) Decrypt(k bccsp.Key, ciphertext []byte, opts bccsp.DecrypterOpts) (plaintext []byte, err error)

Decrypt decrypts ciphertext using key k. The opts argument should be appropriate for the algorithm used.

func (*BCCSP) Encrypt

func (*BCCSP) Encrypt(k bccsp.Key, plaintext []byte, opts bccsp.EncrypterOpts) (ciphertext []byte, err error)

Encrypt encrypts plaintext using key k. The opts argument should be appropriate for the algorithm used.

func (*BCCSP) GetHash

func (*BCCSP) GetHash(opts bccsp.HashOpts) (h hash.Hash, err error)

GetHash returns and instance of hash.Hash using options opts. If opts is nil, the default hash function will be returned.

func (*BCCSP) GetKey

func (*BCCSP) GetKey(ski []byte) (k bccsp.Key, err error)

GetKey returns the key this CSP associates to the Subject Key Identifier ski.

func (*BCCSP) Hash

func (*BCCSP) Hash(msg []byte, opts bccsp.HashOpts) (hash []byte, err error)

Hash hashes messages msg using options opts. If opts is nil, the default hash function will be used.

func (*BCCSP) KeyDeriv

func (*BCCSP) KeyDeriv(k bccsp.Key, opts bccsp.KeyDerivOpts) (dk bccsp.Key, err error)

KeyDeriv derives a key from k using opts. The opts argument should be appropriate for the primitive used.

func (*BCCSP) KeyGen

func (*BCCSP) KeyGen(opts bccsp.KeyGenOpts) (k bccsp.Key, err error)

KeyGen generates a key using opts.

func (*BCCSP) KeyImport

func (m *BCCSP) KeyImport(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error)

KeyImport imports a key from its raw representation using opts. The opts argument should be appropriate for the primitive used.

func (*BCCSP) Sign

func (*BCCSP) Sign(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) (signature []byte, 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).

func (*BCCSP) Verify

func (*BCCSP) Verify(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (valid bool, err error)

Verify verifies signature against key k and digest The opts argument should be appropriate for the algorithm used.

Jump to

Keyboard shortcuts

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