Documentation
¶
Index ¶
- Constants
- Variables
- func CloseAllClients() (bool, []error)
- func CloseAllPeers() (bool, []error)
- func CloseAllValidators() (bool, []error)
- func CloseClient(client Client) error
- func ClosePeer(peer Peer) error
- func CloseValidator(peer Peer) error
- func RegisterClient(name string, pwd []byte, enrollID, enrollPWD string) error
- func RegisterPeer(name string, pwd []byte, enrollID, enrollPWD string) error
- func RegisterValidator(name string, pwd []byte, enrollID, enrollPWD string) error
- type CertificateHandler
- type Client
- type Entity
- type Peer
- type StateEncryptor
- type TransactionHandler
Constants ¶
const (
TLSCA_CERT_CHAIN = "tlsca.cert.chain"
)
Variables ¶
var ( // ECertSubjectRole is the ASN1 object identifier of the subject's role. ECertSubjectRole = asn1.ObjectIdentifier{2, 1, 3, 4, 5, 6, 7} )
Functions ¶
func CloseAllClients ¶
CloseAllClients closes all the clients initialized so far
func CloseAllPeers ¶
CloseAllPeers closes all the peers initialized so far
func CloseAllValidators ¶
CloseAllValidators closes all the validators initialized so far
func CloseClient ¶
CloseClient releases all the resources allocated by clients
func CloseValidator ¶
CloseValidator releases all the resources allocated by the validator
func RegisterClient ¶
RegisterClient registers a client to the PKI infrastructure
func RegisterPeer ¶
RegisterPeer registers a peer to the PKI infrastructure
Types ¶
type CertificateHandler ¶
type CertificateHandler interface {
// GetCertificate returns the certificate's DER
GetCertificate() []byte
// Sign signs msg using the signing key corresponding to the certificate
Sign(msg []byte) ([]byte, error)
// Verify verifies msg using the verifying key corresponding to the certificate
Verify(signature []byte, msg []byte) error
// GetTransactionHandler returns a new transaction handler relative to this certificate
GetTransactionHandler() (TransactionHandler, error)
}
CertificateHandler exposes methods to deal with an ECert/TCert
type Client ¶
type Client interface {
Entity
// NewChaincodeDeployTransaction is used to deploy chaincode.
NewChaincodeDeployTransaction(chaincodeDeploymentSpec *obc.ChaincodeDeploymentSpec, uuid string) (*obc.Transaction, error)
// NewChaincodeExecute is used to execute chaincode's functions.
NewChaincodeExecute(chaincodeInvocation *obc.ChaincodeInvocationSpec, uuid string) (*obc.Transaction, error)
// NewChaincodeQuery is used to query chaincode's functions.
NewChaincodeQuery(chaincodeInvocation *obc.ChaincodeInvocationSpec, uuid string) (*obc.Transaction, error)
// DecryptQueryResult is used to decrypt the result of a query transaction
DecryptQueryResult(queryTx *obc.Transaction, result []byte) ([]byte, error)
// GetEnrollmentCertHandler returns a CertificateHandler whose certificate is the enrollment certificate
GetEnrollmentCertificateHandler() (CertificateHandler, error)
// GetTCertHandlerNext returns a CertificateHandler whose certificate is the next available TCert
GetTCertificateHandlerNext() (CertificateHandler, error)
// GetTCertHandlerFromDER returns a CertificateHandler whose certificate is the one passed
GetTCertificateHandlerFromDER(der []byte) (CertificateHandler, error)
}
Client is an entity able to deploy and invoke chaincode
type Entity ¶
type Entity interface {
// GetName returns this entity's name
GetName() string
}
Entity represents a crypto object having a name
type Peer ¶
type Peer interface {
Entity
// GetID returns this peer's identifier
GetID() []byte
// GetEnrollmentID returns this peer's enrollment id
GetEnrollmentID() string
// TransactionPreValidation verifies that the transaction is
// well formed with the respect to the security layer
// prescriptions (i.e. signature verification).
TransactionPreValidation(tx *obc.Transaction) (*obc.Transaction, error)
// TransactionPreExecution verifies that the transaction is
// well formed with the respect to the security layer
// prescriptions (i.e. signature verification). If this is the case,
// the method prepares the transaction to be executed.
// TransactionPreExecution returns a clone of tx.
TransactionPreExecution(tx *obc.Transaction) (*obc.Transaction, error)
// Sign signs msg with this validator's signing key and outputs
// the signature if no error occurred.
Sign(msg []byte) ([]byte, error)
// Verify checks that signature if a valid signature of message under vkID's verification key.
// If the verification succeeded, Verify returns nil meaning no error occurred.
// If vkID is nil, then the signature is verified against this validator's verification key.
Verify(vkID, signature, message []byte) error
// GetStateEncryptor returns a StateEncryptor linked to pair defined by
// the deploy transaction and the execute transaction. Notice that,
// executeTx can also correspond to a deploy transaction.
GetStateEncryptor(deployTx, executeTx *obc.Transaction) (StateEncryptor, error)
}
Peer is an entity able to verify transactions
type StateEncryptor ¶
type StateEncryptor interface {
// Encrypt encrypts message msg
Encrypt(msg []byte) ([]byte, error)
// Decrypt decrypts ciphertext ct obtained
// from a call of the Encrypt method.
Decrypt(ct []byte) ([]byte, error)
}
StateEncryptor is used to encrypt chaincode's state
type TransactionHandler ¶
type TransactionHandler interface {
// GetCertificateHandler returns the certificate handler relative to the certificate mapped to this transaction
GetCertificateHandler() (CertificateHandler, error)
// GetBinding returns a binding to the underlying transaction
GetBinding() ([]byte, error)
// NewChaincodeDeployTransaction is used to deploy chaincode
NewChaincodeDeployTransaction(chaincodeDeploymentSpec *obc.ChaincodeDeploymentSpec, uuid string) (*obc.Transaction, error)
// NewChaincodeExecute is used to execute chaincode's functions
NewChaincodeExecute(chaincodeInvocation *obc.ChaincodeInvocationSpec, uuid string) (*obc.Transaction, error)
// NewChaincodeQuery is used to query chaincode's functions
NewChaincodeQuery(chaincodeInvocation *obc.ChaincodeInvocationSpec, uuid string) (*obc.Transaction, error)
}
TransactionHandler represents a single transaction that can be named by the output of the GetBinding method. This transaction is linked to a single Certificate (TCert or ECert).
Source Files
¶
- client.go
- client_chain.go
- client_crypto.go
- client_ecert_handler.go
- client_impl.go
- client_ks.go
- client_tca.go
- client_tcert_handler.go
- client_tx.go
- crypto.go
- node.go
- node_conf.go
- node_crypto.go
- node_eca.go
- node_impl.go
- node_ks.go
- node_sign.go
- node_tca.go
- node_tlsca.go
- peer.go
- peer_impl.go
- validator.go
- validator_chain.go
- validator_eca.go
- validator_impl.go
- validator_ks.go
- validator_sign.go