entities

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCCSPEncrypterEntity

type BCCSPEncrypterEntity struct {
	BCCSPEntity
	EKey  bccsp.Key
	EOpts bccsp.EncrypterOpts
	DOpts bccsp.DecrypterOpts
}

func NewAES256EncrypterEntity

func NewAES256EncrypterEntity(ID string, b bccsp.BCCSP, key, IV []byte) (*BCCSPEncrypterEntity, error)

func NewEncrypterEntity

func NewEncrypterEntity(ID string, bccsp bccsp.BCCSP, eKey bccsp.Key, eOpts bccsp.EncrypterOpts, dOpts bccsp.DecrypterOpts) (*BCCSPEncrypterEntity, error)

func (*BCCSPEncrypterEntity) Decrypt

func (e *BCCSPEncrypterEntity) Decrypt(ciphertext []byte) ([]byte, error)

func (*BCCSPEncrypterEntity) Encrypt

func (e *BCCSPEncrypterEntity) Encrypt(plaintext []byte) ([]byte, error)

func (*BCCSPEncrypterEntity) Equals

func (this *BCCSPEncrypterEntity) Equals(e Entity) bool

func (*BCCSPEncrypterEntity) Public

func (pe *BCCSPEncrypterEntity) Public() (Entity, error)

type BCCSPEncrypterSignerEntity

type BCCSPEncrypterSignerEntity struct {
	BCCSPEncrypterEntity
	BCCSPSignerEntity
}

func NewAES256EncrypterECDSASignerEntity

func NewAES256EncrypterECDSASignerEntity(ID string, b bccsp.BCCSP, encKeyBytes, signKeyBytes []byte) (*BCCSPEncrypterSignerEntity, error)

func NewEncrypterSignerEntity

func NewEncrypterSignerEntity(ID string, bccsp bccsp.BCCSP, eKey, sKey bccsp.Key, eOpts bccsp.EncrypterOpts, dOpts bccsp.DecrypterOpts, sOpts bccsp.SignerOpts, hOpts bccsp.HashOpts) (*BCCSPEncrypterSignerEntity, error)

func (*BCCSPEncrypterSignerEntity) Equals

func (this *BCCSPEncrypterSignerEntity) Equals(e Entity) bool

func (*BCCSPEncrypterSignerEntity) ID

func (*BCCSPEncrypterSignerEntity) Public

func (pe *BCCSPEncrypterSignerEntity) Public() (Entity, error)

type BCCSPEntity

type BCCSPEntity struct {
	IDstr string
	BCCSP bccsp.BCCSP
}

func (*BCCSPEntity) ID

func (e *BCCSPEntity) ID() string

type BCCSPSignerEntity

type BCCSPSignerEntity struct {
	BCCSPEntity
	SKey  bccsp.Key
	SOpts bccsp.SignerOpts
	HOpts bccsp.HashOpts
}

func NewECDSASignerEntity

func NewECDSASignerEntity(ID string, b bccsp.BCCSP, signKeyBytes []byte) (*BCCSPSignerEntity, error)

func NewECDSAVerifierEntity

func NewECDSAVerifierEntity(ID string, b bccsp.BCCSP, signKeyBytes []byte) (*BCCSPSignerEntity, error)

func NewSignerEntity

func NewSignerEntity(ID string, bccsp bccsp.BCCSP, sKey bccsp.Key, sOpts bccsp.SignerOpts, hOpts bccsp.HashOpts) (*BCCSPSignerEntity, error)

func (*BCCSPSignerEntity) Equals

func (this *BCCSPSignerEntity) Equals(e Entity) bool

func (*BCCSPSignerEntity) Public

func (e *BCCSPSignerEntity) Public() (Entity, error)

func (*BCCSPSignerEntity) Sign

func (e *BCCSPSignerEntity) Sign(msg []byte) ([]byte, error)

func (*BCCSPSignerEntity) Verify

func (e *BCCSPSignerEntity) Verify(signature, msg []byte) (bool, error)

type Encrypter

type Encrypter interface {
	Encrypt(plaintext []byte) (ciphertext []byte, err error)

	Decrypt(ciphertext []byte) (plaintext []byte, err error)
}

type EncrypterEntity

type EncrypterEntity interface {
	Entity
	Encrypter
}

func GetEncrypterEntityForTest

func GetEncrypterEntityForTest(id string) (EncrypterEntity, error)

type EncrypterSignerEntity

type EncrypterSignerEntity interface {
	Entity
	Encrypter
	Signer
}

func GetEncrypterSignerEntityForTest

func GetEncrypterSignerEntityForTest(id string) (EncrypterSignerEntity, error)

type Entity

type Entity interface {
	ID() string

	Equals(Entity) bool

	Public() (Entity, error)
}

type SignedMessage

type SignedMessage struct {
	ID []byte `json:"id"`

	Payload []byte `json:"payload"`

	Sig []byte `json:"sig"`
}

func (*SignedMessage) FromBytes

func (m *SignedMessage) FromBytes(d []byte) error

func (*SignedMessage) Sign

func (m *SignedMessage) Sign(signer Signer) error

func (*SignedMessage) ToBytes

func (m *SignedMessage) ToBytes() ([]byte, error)

func (*SignedMessage) Verify

func (m *SignedMessage) Verify(verifier Signer) (bool, error)

type Signer

type Signer interface {
	Sign(msg []byte) (signature []byte, err error)

	Verify(signature, msg []byte) (valid bool, err error)
}

type SignerEntity

type SignerEntity interface {
	Entity
	Signer
}

Jump to

Keyboard shortcuts

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