credentials

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DriverImpl = map[string]func(*viper.Viper, *Credentials_PeerDriver) error{}

Functions

func DriveEndorsers

func DriveEndorsers(vp *viper.Viper) (map[string]TxEndorserFactory, error)

try to obtain mutiple endorser's configuration from config files

Types

type Credentials_PeerDriver

type Credentials_PeerDriver struct {
	PeerValidator PeerCreds
	TxValidator   TxHandlerFactory
	TxEndorserDef TxEndorserFactory

	//if config file specified a "custom" endorser and it can be obtained
	//from this field, TxEndorserDef will be set to the corresponding one
	SuppliedEndorser map[string]TxEndorserFactory
}

func (*Credentials_PeerDriver) Drive

func (drv *Credentials_PeerDriver) Drive(vp *viper.Viper) error

configure the peer's credential from config files, if suitable content has been found, the corresponding item in driver struct is set and the fields can not be configured will be untouched

when Credentials_PeerCredBase is empty, new Credentials_PeerCredBase is created, or if it has been set, driver will try to merge the new content into it

it configue the per-peer creds while a endorser may be also derived from the peer credential

type DataEncryptor

type DataEncryptor interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

DataEncryptor is used to encrypt/decrypt chaincode's state data

func GenDataEncryptor

func GenDataEncryptor(trippeddeployTx *pb.Transaction, txe *pb.TransactionHandlingContext) (DataEncryptor, error)

extract a DataEncryptor linked to pair defined by the deploy transaction and the execute transaction. the context must firstly be handled by TxConfidentialityHandler, or it just return nil

type PeerCred

type PeerCred interface {
	Cred() []byte
	//the shared secret between the handshaking peer pair, a key-exchange scheme
	//is recommended but it is not enforced to cover the secret in the traffic texts
	Secret() []byte
	VerifyPeerMsg(msg *pb.Message) error
}

type PeerCreds

type PeerCreds interface {
	PeerCred
	Pki() []byte
	//the pki can be nil for creating a PeerCred for "connect" attempt, pki is
	//nil or not indicate different behavior so caller must verify it first
	CreatePeerCred(cred []byte, pki []byte) (PeerCred, error)
	EndorsePeerMsg(msg *pb.Message) (*pb.Message, error)
}

peer creds also include the endorse entry because it should be sole per-network

type TxConfidentialityHandler

type TxConfidentialityHandler interface {
	//tx preexcution, it parse the tx with specified confidentiality and also prepare the
	//execution context for data encryptor
	pb.TxPreHandler

	//---this method is under considering and may be abandoned later---
	GetStateEncryptor(deployTx, executeTx *pb.Transaction) (DataEncryptor, error)
}

(YA-fabric 0.9: it is supposed to be created from something like a certfication but will not get an implement in recent)

func DriveConfidentials

func DriveConfidentials(vp *viper.Viper) (TxConfidentialityHandler, error)

try to obtain confidential's configuration from config files

type TxEndorser

type TxEndorser interface {
	EndorseTransaction(*pb.Transaction) (*pb.Transaction, error)
	Release()
}

type TxEndorserFactory

type TxEndorserFactory interface {
	EndorserId() []byte //notice the endorserid is bytes
	//EndorsePeerState need to consider the exist endorsment field and decide update it or not
	EndorsePeerState(*pb.PeerTxState) (*pb.PeerTxState, error)
	GetEndorser(attr ...string) (TxEndorser, error)
}

-- entries for per-user's credentials, user can be actived in mutiple networks---

type TxHandlerFactory

type TxHandlerFactory interface {
	SetIdConverter(func([]byte) string)
	ValidatePeerStatus(id string, status *pb.PeerTxState) error
	//notify all of the preparing for a specified id (i.e. caches) can be complete released
	RemovePreValidator(id string)
	//tx prevalidator, handle security relatedcontext in tx and fill the security context
	GetValidator(id string) pb.TxPreHandler
}

txhandlerfactory should be thread-safe

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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