cryptography

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	hash.Hash

	Hash([]byte) []byte
}

type KeyProcessor

type KeyProcessor interface {
	GeneratePrivateKey() (crypto.PrivateKey, error)
	ExtractPublicKey(crypto.PrivateKey) crypto.PublicKey

	ExportPublicKeyPEM(crypto.PublicKey) ([]byte, error)
	ImportPublicKeyPEM([]byte) (crypto.PublicKey, error)

	ExportPrivateKeyPEM(crypto.PrivateKey) ([]byte, error)
	ImportPrivateKeyPEM([]byte) (crypto.PrivateKey, error)

	ExportPublicKeyBinary(crypto.PublicKey) ([]byte, error)
	ImportPublicKeyBinary([]byte) (crypto.PublicKey, error)
}

type KeyStore

type KeyStore interface {
	GetPrivateKey(string) (crypto.PrivateKey, error)
}

type PlatformCryptographyScheme

type PlatformCryptographyScheme interface {
	PublicKeySize() int
	SignatureSize() int

	ReferenceHashSize() int
	ReferenceHasher() Hasher

	IntegrityHashSize() int
	IntegrityHasher() Hasher

	DataSigner(crypto.PrivateKey, Hasher) Signer
	DigestSigner(key crypto.PrivateKey) Signer
	DataVerifier(crypto.PublicKey, Hasher) Verifier
	DigestVerifier(crypto.PublicKey) Verifier
}

type Service

type Service interface {
	Signer
	GetPublicKey() (crypto.PublicKey, error)
	Verify(crypto.PublicKey, Signature, []byte) bool
}

type ServiceMock

type ServiceMock struct {
	GetPublicKeyMock mServiceMockGetPublicKey

	SignMock mServiceMockSign

	VerifyMock mServiceMockVerify
	// contains filtered or unexported fields
}

ServiceMock implements Service

func NewServiceMock

func NewServiceMock(t minimock.Tester) *ServiceMock

NewServiceMock returns a mock for Service

func (*ServiceMock) GetPublicKey

func (mmGetPublicKey *ServiceMock) GetPublicKey() (p1 crypto.PublicKey, err error)

GetPublicKey implements Service

func (*ServiceMock) GetPublicKeyAfterCounter

func (mmGetPublicKey *ServiceMock) GetPublicKeyAfterCounter() uint64

GetPublicKeyAfterCounter returns a count of finished ServiceMock.GetPublicKey invocations

func (*ServiceMock) GetPublicKeyBeforeCounter

func (mmGetPublicKey *ServiceMock) GetPublicKeyBeforeCounter() uint64

GetPublicKeyBeforeCounter returns a count of ServiceMock.GetPublicKey invocations

func (*ServiceMock) MinimockFinish

func (m *ServiceMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*ServiceMock) MinimockGetPublicKeyDone

func (m *ServiceMock) MinimockGetPublicKeyDone() bool

MinimockGetPublicKeyDone returns true if the count of the GetPublicKey invocations corresponds the number of defined expectations

func (*ServiceMock) MinimockGetPublicKeyInspect

func (m *ServiceMock) MinimockGetPublicKeyInspect()

MinimockGetPublicKeyInspect logs each unmet expectation

func (*ServiceMock) MinimockSignDone

func (m *ServiceMock) MinimockSignDone() bool

MinimockSignDone returns true if the count of the Sign invocations corresponds the number of defined expectations

func (*ServiceMock) MinimockSignInspect

func (m *ServiceMock) MinimockSignInspect()

MinimockSignInspect logs each unmet expectation

func (*ServiceMock) MinimockVerifyDone

func (m *ServiceMock) MinimockVerifyDone() bool

MinimockVerifyDone returns true if the count of the Verify invocations corresponds the number of defined expectations

func (*ServiceMock) MinimockVerifyInspect

func (m *ServiceMock) MinimockVerifyInspect()

MinimockVerifyInspect logs each unmet expectation

func (*ServiceMock) MinimockWait

func (m *ServiceMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*ServiceMock) Sign

func (mmSign *ServiceMock) Sign(ba1 []byte) (sp1 *Signature, err error)

Sign implements Service

func (*ServiceMock) SignAfterCounter

func (mmSign *ServiceMock) SignAfterCounter() uint64

SignAfterCounter returns a count of finished ServiceMock.Sign invocations

func (*ServiceMock) SignBeforeCounter

func (mmSign *ServiceMock) SignBeforeCounter() uint64

SignBeforeCounter returns a count of ServiceMock.Sign invocations

func (*ServiceMock) Verify

func (mmVerify *ServiceMock) Verify(p1 crypto.PublicKey, s1 Signature, ba1 []byte) (b1 bool)

Verify implements Service

func (*ServiceMock) VerifyAfterCounter

func (mmVerify *ServiceMock) VerifyAfterCounter() uint64

VerifyAfterCounter returns a count of finished ServiceMock.Verify invocations

func (*ServiceMock) VerifyBeforeCounter

func (mmVerify *ServiceMock) VerifyBeforeCounter() uint64

VerifyBeforeCounter returns a count of ServiceMock.Verify invocations

type ServiceMockGetPublicKeyExpectation

type ServiceMockGetPublicKeyExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ServiceMockGetPublicKeyExpectation specifies expectation struct of the Service.GetPublicKey

type ServiceMockGetPublicKeyResults

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

ServiceMockGetPublicKeyResults contains results of the Service.GetPublicKey

type ServiceMockSignExpectation

type ServiceMockSignExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ServiceMockSignExpectation specifies expectation struct of the Service.Sign

func (*ServiceMockSignExpectation) Then

Then sets up Service.Sign return parameters for the expectation previously defined by the When method

type ServiceMockSignParams

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

ServiceMockSignParams contains parameters of the Service.Sign

type ServiceMockSignResults

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

ServiceMockSignResults contains results of the Service.Sign

type ServiceMockVerifyExpectation

type ServiceMockVerifyExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ServiceMockVerifyExpectation specifies expectation struct of the Service.Verify

func (*ServiceMockVerifyExpectation) Then

Then sets up Service.Verify return parameters for the expectation previously defined by the When method

type ServiceMockVerifyParams

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

ServiceMockVerifyParams contains parameters of the Service.Verify

type ServiceMockVerifyResults

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

ServiceMockVerifyResults contains results of the Service.Verify

type Signature

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

func SignatureFromBytes

func SignatureFromBytes(raw []byte) Signature

func (*Signature) Bytes

func (s *Signature) Bytes() []byte

type Signer

type Signer interface {
	Sign([]byte) (*Signature, error)
}

type Verifier

type Verifier interface {
	Verify(Signature, []byte) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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