Documentation
¶
Index ¶
- func BlockDataHash(b *cb.BlockData) ([]byte, error)
- func BlockHeaderBytes(b *cb.BlockHeader) []byte
- func BlockHeaderHash(b *cb.BlockHeader) []byte
- func ChannelHeader(env *cb.Envelope) (*cb.ChannelHeader, error)
- func ChannelID(env *cb.Envelope) (string, error)
- func CheckTxID(txid string, nonce, creator []byte) error
- func ComputeBlockDataHash(b *cb.BlockData) []byte
- func ComputeTxID(nonce, creator []byte) string
- func CopyBlockMetadata(src, dst *cb.Block)
- func CreateChaincodeProposal(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTransient(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTxIDAndTransient(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ common.HeaderType, channelID string, ...) (*peer.Proposal, string, error)
- func CreateDeployProposalFromCDS(channelID string, cds *peer.ChaincodeDeploymentSpec, creator []byte, ...) (*peer.Proposal, string, error)
- func CreateGetChaincodesProposal(channelID string, creator []byte) (*peer.Proposal, string, error)
- func CreateGetInstalledChaincodesProposal(creator []byte) (*peer.Proposal, string, error)
- func CreateInstallProposalFromCDS(ccpack proto.Message, creator []byte) (*peer.Proposal, string, error)
- func CreateNonce() ([]byte, error)
- func CreateNonceOrPanic() []byte
- func CreateProposalFromCIS(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, ...) (*peer.Proposal, string, error)
- func CreateProposalFromCISAndTxid(txid string, typ common.HeaderType, channelID string, ...) (*peer.Proposal, string, error)
- func CreateProposalResponse(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, ...) (*peer.ProposalResponse, error)
- func CreateProposalResponseFailure(hdrbytes []byte, payl []byte, response *peer.Response, results []byte, ...) (*peer.ProposalResponse, error)
- func CreateSignedEnvelope(txType common.HeaderType, channelID string, signer identity.SignerSerializer, ...) (*common.Envelope, error)
- func CreateSignedEnvelopeWithIDOfCert(txType common.HeaderType, channelID string, ...) (*common.Envelope, error)
- func CreateSignedEnvelopeWithTLSBinding(txType common.HeaderType, channelID string, signer identity.SignerSerializer, ...) (*common.Envelope, error)
- func CreateSignedEnvelopeWithTLSBindingWithIDOfCert(txType common.HeaderType, channelID string, ...) (*common.Envelope, error)
- func CreateSignedTx(proposal *peer.Proposal, signer identity.SignerSerializer, ...) (*common.Envelope, error)
- func CreateUpgradeProposalFromCDS(channelID string, cds *peer.ChaincodeDeploymentSpec, creator []byte, ...) (*peer.Proposal, string, error)
- func EnvelopeToConfigUpdate(configtx *cb.Envelope) (*cb.ConfigUpdateEnvelope, error)
- func ExtractEnvelope(block *cb.Block, index int) (*cb.Envelope, error)
- func ExtractEnvelopeOrPanic(block *cb.Block, index int) *cb.Envelope
- func GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error)
- func GetActionFromEnvelopeMsg(env *common.Envelope) (*peer.ChaincodeAction, error)
- func GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)
- func GetBytesChaincodeEvent(event *peer.ChaincodeEvent) ([]byte, error)
- func GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)
- func GetBytesEnvelope(env *common.Envelope) ([]byte, error)
- func GetBytesHeader(hdr *common.Header) ([]byte, error)
- func GetBytesPayload(payl *common.Payload) ([]byte, error)
- func GetBytesProposalPayloadForTx(payload *peer.ChaincodeProposalPayload) ([]byte, error)
- func GetBytesProposalResponse(pr *peer.ProposalResponse) ([]byte, error)
- func GetBytesProposalResponsePayload(hash []byte, response *peer.Response, result []byte, event []byte, ...) ([]byte, error)
- func GetBytesResponse(res *peer.Response) ([]byte, error)
- func GetBytesSignatureHeader(hdr *common.SignatureHeader) ([]byte, error)
- func GetBytesTransaction(tx *peer.Transaction) ([]byte, error)
- func GetChannelIDFromBlock(block *cb.Block) (string, error)
- func GetChannelIDFromBlockBytes(bytes []byte) (string, error)
- func GetConsenterMetadataFromBlock(block *cb.Block) (*cb.Metadata, error)
- func GetEnvelopeFromBlock(data []byte) (*common.Envelope, error)
- func GetLastConfigIndexFromBlock(block *cb.Block) (uint64, error)
- func GetLastConfigIndexFromBlockOrPanic(block *cb.Block) uint64
- func GetMetadataFromBlock(block *cb.Block, index cb.BlockMetadataIndex) (*cb.Metadata, error)
- func GetMetadataFromBlockOrPanic(block *cb.Block, index cb.BlockMetadataIndex) *cb.Metadata
- func GetOrComputeTxIDFromEnvelope(txEnvelopBytes []byte) (string, error)
- func GetPayloads(txActions *peer.TransactionAction) (*peer.ChaincodeActionPayload, *peer.ChaincodeAction, error)
- func GetProposalHash1(header *common.Header, ccPropPayl []byte) ([]byte, error)
- func GetProposalHash2(header *common.Header, ccPropPayl []byte) ([]byte, error)
- func GetSignedProposal(prop *peer.Proposal, signer identity.SignerSerializer) (*peer.SignedProposal, error)
- func HasConfigTx(blockdata *cb.BlockData) bool
- func HashTLSCertificate(certPEMBlock []byte) ([]byte, error)
- func InitBlockMetadata(block *cb.Block)
- func InvokedChaincodeName(proposalBytes []byte) (string, error)
- func IsConfigBlock(block *cb.Block) bool
- func IsConfigTransaction(envelope *cb.Envelope) bool
- func LogMessageForIdentities(signedData []*SignedData) (logMsg string)
- func LogMessageForIdentity(id *msppb.Identity) string
- func MakeChannelHeader(headerType cb.HeaderType, version int32, chainID string, epoch uint64) *cb.ChannelHeader
- func MakePayloadHeader(ch *cb.ChannelHeader, sh *cb.SignatureHeader) *cb.Header
- func MakeSignatureHeader(serializedCreatorCertChain []byte, nonce []byte) *cb.SignatureHeader
- func Marshal(pb proto.Message) ([]byte, error)
- func MarshalOrPanic(pb proto.Message) []byte
- func MockSignedEndorserProposal2OrPanic(channelID string, cs *peer.ChaincodeSpec, signer identity.SignerSerializer) (*peer.SignedProposal, *peer.Proposal)
- func MockSignedEndorserProposalOrPanic(channelID string, cs *peer.ChaincodeSpec, creator, signature []byte) (*peer.SignedProposal, *peer.Proposal)
- func NewBlock(seqNum uint64, previousHash []byte) *cb.Block
- func NewConfigGroup() *common.ConfigGroup
- func NewSignatureHeader(id identity.Serializer) (*cb.SignatureHeader, error)
- func NewSignatureHeaderOrPanic(id identity.Serializer) *cb.SignatureHeader
- func NewSignatureHeaderWithIDOfCert(id identity.ExtendedSerializer) (*cb.SignatureHeader, error)
- func ReadBlockFromFile(blockPath string) (*cb.Block, error)
- func SetTxID(channelHeader *cb.ChannelHeader, signatureHeader *cb.SignatureHeader)
- func SignOrPanic(signer identity.Signer, msg []byte) []byte
- func UnmarshalBlock(encoded []byte) (*common.Block, error)
- func UnmarshalBlockMetadataSignatures(bytes [][]byte) (*common.Metadata, error)
- func UnmarshalBlockOrPanic(encoded []byte) *common.Block
- func UnmarshalChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)
- func UnmarshalChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)
- func UnmarshalChaincodeDeploymentSpec(code []byte) (*peer.ChaincodeDeploymentSpec, error)
- func UnmarshalChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)
- func UnmarshalChaincodeHeaderExtension(hdrExtension []byte) (*peer.ChaincodeHeaderExtension, error)
- func UnmarshalChaincodeID(bytes []byte) (*peer.ChaincodeID, error)
- func UnmarshalChaincodeInvocationSpec(encoded []byte) (*peer.ChaincodeInvocationSpec, error)
- func UnmarshalChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)
- func UnmarshalChannelHeader(bytes []byte) (*common.ChannelHeader, error)
- func UnmarshalChannelHeaderOrPanic(bytes []byte) *common.ChannelHeader
- func UnmarshalConfigEnvelope(bytes []byte) (*common.ConfigEnvelope, error)
- func UnmarshalEnvelope(encoded []byte) (*common.Envelope, error)
- func UnmarshalEnvelopeOfType(envelope *cb.Envelope, headerType cb.HeaderType, message proto.Message) (*cb.ChannelHeader, error)
- func UnmarshalEnvelopeOrPanic(encoded []byte) *common.Envelope
- func UnmarshalHashedRWSet(bytes []byte) (*kvrwset.HashedRWSet, error)
- func UnmarshalHeader(bytes []byte) (*common.Header, error)
- func UnmarshalIdentifierHeader(bytes []byte) (*common.IdentifierHeader, error)
- func UnmarshalIdentity(bytes []byte) (*msppb.Identity, error)
- func UnmarshalKVRWSet(bytes []byte) (*kvrwset.KVRWSet, error)
- func UnmarshalPayload(encoded []byte) (*common.Payload, error)
- func UnmarshalPayloadOrPanic(encoded []byte) *common.Payload
- func UnmarshalProposal(propBytes []byte) (*peer.Proposal, error)
- func UnmarshalProposalResponse(prBytes []byte) (*peer.ProposalResponse, error)
- func UnmarshalProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)
- func UnmarshalResponse(resBytes []byte) (*peer.Response, error)
- func UnmarshalSignatureHeader(bytes []byte) (*common.SignatureHeader, error)
- func UnmarshalSignatureHeaderOrPanic(bytes []byte) *common.SignatureHeader
- func UnmarshalSignaturePolicy(bytes []byte) (*common.SignaturePolicyEnvelope, error)
- func UnmarshalTransaction(txBytes []byte) (*peer.Transaction, error)
- func UnmarshalTxReadWriteSet(bytes []byte) (*rwset.TxReadWriteSet, error)
- func VerifyTransactionsAreWellFormed(bd *cb.BlockData) error
- type BlockSigVerifier
- type BlockVerifierFunc
- type SignedData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockHeaderBytes ¶
func BlockHeaderBytes(b *cb.BlockHeader) []byte
func BlockHeaderHash ¶
func BlockHeaderHash(b *cb.BlockHeader) []byte
func ChannelHeader ¶
func ChannelHeader(env *cb.Envelope) (*cb.ChannelHeader, error)
ChannelHeader returns the *cb.ChannelHeader for a given *cb.Envelope.
func CheckTxID ¶
CheckTxID checks that txid is equal to the Hash computed over the concatenation of nonce and creator.
func ComputeBlockDataHash ¶
ComputeBlockDataHash computes a SHA-256 digest of the block data using length-delimited serialization. Each data item is prefixed with its 4-byte big-endian length before hashing. This prevents hash ambiguity when concatenating variable-length items (e.g., [ab, cd] vs [a, bcd] produce the same simple concat but different length-prefixed hashes) and matches the orderer's BatchedRequests.Digest() computation.
func ComputeTxID ¶
ComputeTxID computes TxID as the Hash computed over the concatenation of nonce and creator.
func CopyBlockMetadata ¶
CopyBlockMetadata copies metadata from one block into another.
func CreateChaincodeProposal ¶
func CreateChaincodeProposal(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)
CreateChaincodeProposal creates a proposal from given input. It returns the proposal and the transaction id associated to the proposal
func CreateChaincodeProposalWithTransient ¶
func CreateChaincodeProposalWithTransient(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTransient creates a proposal from given input It returns the proposal and the transaction id associated to the proposal
func CreateChaincodeProposalWithTxIDAndTransient ¶
func CreateChaincodeProposalWithTxIDAndTransient(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, creator []byte, txid string, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTxIDAndTransient creates a proposal from given input. It returns the proposal and the transaction id associated with the proposal
func CreateChaincodeProposalWithTxIDNonceAndTransient ¶
func CreateChaincodeProposalWithTxIDNonceAndTransient(txid string, typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, nonce, creator []byte, transientMap map[string][]byte) (*peer.Proposal, string, error)
CreateChaincodeProposalWithTxIDNonceAndTransient creates a proposal from given input
func CreateDeployProposalFromCDS ¶
func CreateDeployProposalFromCDS( channelID string, cds *peer.ChaincodeDeploymentSpec, creator []byte, policy []byte, escc []byte, vscc []byte, collectionConfig []byte, ) (*peer.Proposal, string, error)
CreateDeployProposalFromCDS returns a deploy proposal given a serialized identity and a ChaincodeDeploymentSpec
func CreateGetChaincodesProposal ¶
CreateGetChaincodesProposal returns a GETCHAINCODES proposal given a serialized identity
func CreateGetInstalledChaincodesProposal ¶
CreateGetInstalledChaincodesProposal returns a GETINSTALLEDCHAINCODES proposal given a serialized identity
func CreateInstallProposalFromCDS ¶
func CreateInstallProposalFromCDS(ccpack proto.Message, creator []byte) (*peer.Proposal, string, error)
CreateInstallProposalFromCDS returns a install proposal given a serialized identity and a ChaincodeDeploymentSpec
func CreateNonce ¶
CreateNonce generates a nonce using the common/crypto package.
func CreateNonceOrPanic ¶
func CreateNonceOrPanic() []byte
CreateNonceOrPanic generates a nonce using the common/crypto package and panics if this operation fails.
func CreateProposalFromCIS ¶
func CreateProposalFromCIS(typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)
CreateProposalFromCIS returns a proposal given a serialized identity and a ChaincodeInvocationSpec
func CreateProposalFromCISAndTxid ¶
func CreateProposalFromCISAndTxid(txid string, typ common.HeaderType, channelID string, cis *peer.ChaincodeInvocationSpec, creator []byte) (*peer.Proposal, string, error)
CreateProposalFromCISAndTxid returns a proposal given a serialized identity and a ChaincodeInvocationSpec
func CreateProposalResponse ¶
func CreateProposalResponse( hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, ccid *peer.ChaincodeID, signingEndorser identity.SignerSerializer, ) (*peer.ProposalResponse, error)
CreateProposalResponse creates a proposal response.
func CreateProposalResponseFailure ¶
func CreateProposalResponseFailure( hdrbytes []byte, payl []byte, response *peer.Response, results []byte, events []byte, chaincodeName string, ) (*peer.ProposalResponse, error)
CreateProposalResponseFailure creates a proposal response for cases where endorsement proposal fails either due to a endorsement failure or a chaincode failure (chaincode response status >= shim.ERRORTHRESHOLD)
func CreateSignedEnvelope ¶
func CreateSignedEnvelope( txType common.HeaderType, channelID string, signer identity.SignerSerializer, dataMsg proto.Message, msgVersion int32, epoch uint64, ) (*common.Envelope, error)
CreateSignedEnvelope creates a signed envelope with cert in the signature header.
func CreateSignedEnvelopeWithIDOfCert ¶
func CreateSignedEnvelopeWithIDOfCert( txType common.HeaderType, channelID string, signer identity.ExtendedSignerSerializer, dataMsg proto.Message, msgVersion int32, epoch uint64, ) (*common.Envelope, error)
CreateSignedEnvelopeWithIDOfCert creates a signed envelope with ID of the cert in the signature header.
func CreateSignedEnvelopeWithTLSBinding ¶
func CreateSignedEnvelopeWithTLSBinding( txType common.HeaderType, channelID string, signer identity.SignerSerializer, dataMsg proto.Message, msgVersion int32, epoch uint64, tlsCertHash []byte, ) (*common.Envelope, error)
CreateSignedEnvelopeWithTLSBinding creates a singed envelope with TLS cert hash in the channel header and cert in the signature header.
func CreateSignedEnvelopeWithTLSBindingWithIDOfCert ¶
func CreateSignedEnvelopeWithTLSBindingWithIDOfCert( txType common.HeaderType, channelID string, signer identity.ExtendedSignerSerializer, dataMsg proto.Message, msgVersion int32, epoch uint64, tlsCertHash []byte, ) (*common.Envelope, error)
CreateSignedEnvelopeWithTLSBindingWithIDOfCert creates a singed envelope with TLS cert hash in the channel header and ID of cert in the signature header.
func CreateSignedTx ¶
func CreateSignedTx( proposal *peer.Proposal, signer identity.SignerSerializer, resps ...*peer.ProposalResponse, ) (*common.Envelope, error)
CreateSignedTx assembles an Envelope message from proposal, endorsements, and a signer. This function should be called by a client when it has collected enough endorsements for a proposal to create a transaction and submit it to peers for ordering
func CreateUpgradeProposalFromCDS ¶
func CreateUpgradeProposalFromCDS( channelID string, cds *peer.ChaincodeDeploymentSpec, creator []byte, policy []byte, escc []byte, vscc []byte, collectionConfig []byte, ) (*peer.Proposal, string, error)
CreateUpgradeProposalFromCDS returns a upgrade proposal given a serialized identity and a ChaincodeDeploymentSpec
func EnvelopeToConfigUpdate ¶
func EnvelopeToConfigUpdate(configtx *cb.Envelope) (*cb.ConfigUpdateEnvelope, error)
EnvelopeToConfigUpdate is used to extract a ConfigUpdateEnvelope from an envelope of type CONFIG_UPDATE
func ExtractEnvelope ¶
ExtractEnvelope retrieves the requested envelope from a given block and unmarshals it
func ExtractEnvelopeOrPanic ¶
ExtractEnvelopeOrPanic retrieves the requested envelope from a given block and unmarshals it -- it panics if either of these operations fail
func GetActionFromEnvelope ¶
func GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error)
GetActionFromEnvelope extracts a ChaincodeAction message from a serialized Envelope TODO: fix function name as per FAB-11831
func GetActionFromEnvelopeMsg ¶
func GetActionFromEnvelopeMsg(env *common.Envelope) (*peer.ChaincodeAction, error)
func GetBytesChaincodeActionPayload ¶
func GetBytesChaincodeActionPayload(cap *peer.ChaincodeActionPayload) ([]byte, error)
GetBytesChaincodeActionPayload get the bytes of ChaincodeActionPayload from the message
func GetBytesChaincodeEvent ¶
func GetBytesChaincodeEvent(event *peer.ChaincodeEvent) ([]byte, error)
GetBytesChaincodeEvent gets the bytes of ChaincodeEvent
func GetBytesChaincodeProposalPayload ¶
func GetBytesChaincodeProposalPayload(cpp *peer.ChaincodeProposalPayload) ([]byte, error)
GetBytesChaincodeProposalPayload gets the chaincode proposal payload
func GetBytesEnvelope ¶
GetBytesEnvelope get the bytes of Envelope from the message
func GetBytesHeader ¶
GetBytesHeader get the bytes of Header from the message
func GetBytesPayload ¶
GetBytesPayload get the bytes of Payload from the message
func GetBytesProposalPayloadForTx ¶
func GetBytesProposalPayloadForTx( payload *peer.ChaincodeProposalPayload, ) ([]byte, error)
GetBytesProposalPayloadForTx takes a ChaincodeProposalPayload and returns its serialized version according to the visibility field
func GetBytesProposalResponse ¶
func GetBytesProposalResponse(pr *peer.ProposalResponse) ([]byte, error)
GetBytesProposalResponse gets proposal bytes response
func GetBytesProposalResponsePayload ¶
func GetBytesProposalResponsePayload(hash []byte, response *peer.Response, result []byte, event []byte, ccid *peer.ChaincodeID) ([]byte, error)
GetBytesProposalResponsePayload gets proposal response payload
func GetBytesResponse ¶
GetBytesResponse gets the bytes of Response
func GetBytesSignatureHeader ¶
func GetBytesSignatureHeader(hdr *common.SignatureHeader) ([]byte, error)
GetBytesSignatureHeader get the bytes of SignatureHeader from the message
func GetBytesTransaction ¶
func GetBytesTransaction(tx *peer.Transaction) ([]byte, error)
GetBytesTransaction get the bytes of Transaction from the message
func GetChannelIDFromBlock ¶
GetChannelIDFromBlock returns channel ID in the block.
func GetChannelIDFromBlockBytes ¶
GetChannelIDFromBlockBytes returns channel ID given byte array which represents the block.
func GetConsenterMetadataFromBlock ¶
GetConsenterMetadataFromBlock attempts to retrieve consenter metadata from the value stored in block metadata at index SIGNATURES (first field). If no consenter metadata is found there, it falls back to index ORDERER (third field).
func GetEnvelopeFromBlock ¶
GetEnvelopeFromBlock gets an envelope from a block's Data field.
func GetLastConfigIndexFromBlock ¶
GetLastConfigIndexFromBlock retrieves the index of the last config block as encoded in the block metadata.
func GetLastConfigIndexFromBlockOrPanic ¶
GetLastConfigIndexFromBlockOrPanic retrieves the index of the last config block as encoded in the block metadata, or panics on error.
func GetMetadataFromBlock ¶
GetMetadataFromBlock retrieves metadata at the specified index.
func GetMetadataFromBlockOrPanic ¶
GetMetadataFromBlockOrPanic retrieves metadata at the specified index, or panics on error.
func GetOrComputeTxIDFromEnvelope ¶
GetOrComputeTxIDFromEnvelope gets the txID present in a given transaction envelope. If the txID is empty, it constructs the txID from nonce and creator fields in the envelope.
func GetPayloads ¶
func GetPayloads(txActions *peer.TransactionAction) (*peer.ChaincodeActionPayload, *peer.ChaincodeAction, error)
GetPayloads gets the underlying payload objects in a TransactionAction
func GetProposalHash1 ¶
GetProposalHash1 gets the proposal hash bytes after sanitizing the chaincode proposal payload according to the rules of visibility
func GetProposalHash2 ¶
GetProposalHash2 gets the proposal hash - this version is called by the committer where the visibility policy has already been enforced and so we already get what we have to get in ccPropPayl
func GetSignedProposal ¶
func GetSignedProposal(prop *peer.Proposal, signer identity.SignerSerializer) (*peer.SignedProposal, error)
GetSignedProposal returns a signed proposal given a Proposal message and a signing identity
func HasConfigTx ¶
func HashTLSCertificate ¶ added in v0.2.0
HashTLSCertificate computes the SHA256 hash of a PEM-encoded TLS certificate. The certificate must be provided in PEM format with block type "CERTIFICATE". This hash can be used with CreateSignedEnvelopeWithTLSBinding to bind a transaction to a specific TLS certificate.
Parameters:
- certPEMBlock: PEM-encoded TLS certificate bytes.
Returns:
- The SHA256 hash of the certificate DER bytes.
- An error if the input is not a valid PEM-encoded certificate.
Example usage:
tlsCertHash, err := protoutil.HashTLSCertificate(certPEMBlock)
if err != nil {
return err
}
envelope, err := protoutil.CreateSignedEnvelopeWithTLSBinding(
txType, channelID, signer, dataMsg, msgVersion, epoch, tlsCertHash)
func InitBlockMetadata ¶
InitBlockMetadata initializes metadata structure.
func InvokedChaincodeName ¶
InvokedChaincodeName takes the proposal bytes of a SignedProposal, and unpacks it all the way down, until either an error is encountered, or the chaincode name is found. This is useful primarily for chaincodes which wish to know the chaincode name originally invoked, in order to deny cc2cc invocations (or, perhaps to deny direct invocations and require cc2cc).
func IsConfigBlock ¶
IsConfigBlock validates whenever given block contains configuration update transaction
func IsConfigTransaction ¶
func LogMessageForIdentities ¶
func LogMessageForIdentities(signedData []*SignedData) (logMsg string)
LogMessageForIdentities returns a string with identity information.
func LogMessageForIdentity ¶
LogMessageForIdentity returns a string with serialized identity information, or a string indicating why the serialized identity information cannot be returned. Any errors are intentionally returned in the return strings so that the function can be used in single-line log messages with minimal clutter.
func MakeChannelHeader ¶
func MakeChannelHeader(headerType cb.HeaderType, version int32, chainID string, epoch uint64) *cb.ChannelHeader
MakeChannelHeader creates a ChannelHeader.
func MakePayloadHeader ¶
func MakePayloadHeader(ch *cb.ChannelHeader, sh *cb.SignatureHeader) *cb.Header
MakePayloadHeader creates a Payload Header.
func MakeSignatureHeader ¶
func MakeSignatureHeader(serializedCreatorCertChain []byte, nonce []byte) *cb.SignatureHeader
MakeSignatureHeader creates a SignatureHeader.
func MarshalOrPanic ¶
MarshalOrPanic serializes a protobuf message and panics if this operation fails
func MockSignedEndorserProposal2OrPanic ¶
func MockSignedEndorserProposal2OrPanic( channelID string, cs *peer.ChaincodeSpec, signer identity.SignerSerializer, ) (*peer.SignedProposal, *peer.Proposal)
func MockSignedEndorserProposalOrPanic ¶
func MockSignedEndorserProposalOrPanic( channelID string, cs *peer.ChaincodeSpec, creator, signature []byte, ) (*peer.SignedProposal, *peer.Proposal)
MockSignedEndorserProposalOrPanic creates a SignedProposal with the passed arguments
func NewConfigGroup ¶
func NewConfigGroup() *common.ConfigGroup
func NewSignatureHeader ¶
func NewSignatureHeader(id identity.Serializer) (*cb.SignatureHeader, error)
NewSignatureHeader creates the signature header with cert.
func NewSignatureHeaderOrPanic ¶
func NewSignatureHeaderOrPanic(id identity.Serializer) *cb.SignatureHeader
NewSignatureHeaderOrPanic returns a signature header and panics on error.
func NewSignatureHeaderWithIDOfCert ¶
func NewSignatureHeaderWithIDOfCert(id identity.ExtendedSerializer) (*cb.SignatureHeader, error)
NewSignatureHeaderWithIDOfCert creates the signature header with ID of the cert.
func ReadBlockFromFile ¶ added in v0.2.0
ReadBlockFromFile reads a block from the filesystem.
func SetTxID ¶
func SetTxID(channelHeader *cb.ChannelHeader, signatureHeader *cb.SignatureHeader)
SetTxID generates a transaction id based on the provided signature header and sets the TxId field in the channel header
func SignOrPanic ¶
SignOrPanic signs a message and panics on error.
func UnmarshalBlock ¶
UnmarshalBlock unmarshals bytes to a Block.
func UnmarshalBlockMetadataSignatures ¶ added in v0.2.0
UnmarshalBlockMetadataSignatures unmarshal bytes to common.Metadata.
func UnmarshalBlockOrPanic ¶
UnmarshalBlockOrPanic unmarshals bytes to an Block or panics on error.
func UnmarshalChaincodeAction ¶
func UnmarshalChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)
UnmarshalChaincodeAction unmarshals bytes to a ChaincodeAction.
func UnmarshalChaincodeActionPayload ¶
func UnmarshalChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)
UnmarshalChaincodeActionPayload unmarshals bytes to a ChaincodeActionPayload.
func UnmarshalChaincodeDeploymentSpec ¶
func UnmarshalChaincodeDeploymentSpec(code []byte) (*peer.ChaincodeDeploymentSpec, error)
UnmarshalChaincodeDeploymentSpec unmarshals bytes to a ChaincodeDeploymentSpec.
func UnmarshalChaincodeEvents ¶
func UnmarshalChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)
UnmarshalChaincodeEvents unmarshals bytes to a ChaincodeEvent.
func UnmarshalChaincodeHeaderExtension ¶
func UnmarshalChaincodeHeaderExtension(hdrExtension []byte) (*peer.ChaincodeHeaderExtension, error)
UnmarshalChaincodeHeaderExtension unmarshals bytes to a ChaincodeHeaderExtension.
func UnmarshalChaincodeID ¶
func UnmarshalChaincodeID(bytes []byte) (*peer.ChaincodeID, error)
UnmarshalChaincodeID unmarshals bytes to a ChaincodeID.
func UnmarshalChaincodeInvocationSpec ¶
func UnmarshalChaincodeInvocationSpec(encoded []byte) (*peer.ChaincodeInvocationSpec, error)
UnmarshalChaincodeInvocationSpec unmarshals bytes to a ChaincodeInvocationSpec.
func UnmarshalChaincodeProposalPayload ¶
func UnmarshalChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)
UnmarshalChaincodeProposalPayload unmarshals bytes to a ChaincodeProposalPayload.
func UnmarshalChannelHeader ¶
func UnmarshalChannelHeader(bytes []byte) (*common.ChannelHeader, error)
UnmarshalChannelHeader unmarshals bytes to a ChannelHeader.
func UnmarshalChannelHeaderOrPanic ¶
func UnmarshalChannelHeaderOrPanic(bytes []byte) *common.ChannelHeader
UnmarshalChannelHeaderOrPanic unmarshals bytes to a ChannelHeader or panics on error.
func UnmarshalConfigEnvelope ¶
func UnmarshalConfigEnvelope(bytes []byte) (*common.ConfigEnvelope, error)
UnmarshalConfigEnvelope unmarshals bytes to a ConfigEnvelope.
func UnmarshalEnvelope ¶
UnmarshalEnvelope unmarshals bytes to a Envelope.
func UnmarshalEnvelopeOfType ¶
func UnmarshalEnvelopeOfType(envelope *cb.Envelope, headerType cb.HeaderType, message proto.Message) (*cb.ChannelHeader, error)
UnmarshalEnvelopeOfType unmarshals an envelope of the specified type, including unmarshalling the payload data
func UnmarshalEnvelopeOrPanic ¶
UnmarshalEnvelopeOrPanic unmarshals bytes to an Envelope structure or panics on error.
func UnmarshalHashedRWSet ¶
func UnmarshalHashedRWSet(bytes []byte) (*kvrwset.HashedRWSet, error)
UnmarshalHashedRWSet unmarshals bytes to a HashedRWSet.
func UnmarshalHeader ¶
UnmarshalHeader unmarshals bytes to a Header.
func UnmarshalIdentifierHeader ¶
func UnmarshalIdentifierHeader(bytes []byte) (*common.IdentifierHeader, error)
UnmarshalIdentifierHeader unmarshals bytes to an IdentifierHeader.
func UnmarshalIdentity ¶
UnmarshalIdentity unmarshals bytes to an Identity.
func UnmarshalKVRWSet ¶
UnmarshalKVRWSet unmarshals bytes to a KVRWSet.
func UnmarshalPayload ¶
UnmarshalPayload unmarshals bytes to a Payload.
func UnmarshalPayloadOrPanic ¶
UnmarshalPayloadOrPanic unmarshals bytes to a Payload structure or panics on error.
func UnmarshalProposal ¶
UnmarshalProposal unmarshals bytes to a Proposal.
func UnmarshalProposalResponse ¶
func UnmarshalProposalResponse(prBytes []byte) (*peer.ProposalResponse, error)
UnmarshalProposalResponse unmarshals bytes to a ProposalResponse.
func UnmarshalProposalResponsePayload ¶
func UnmarshalProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)
UnmarshalProposalResponsePayload unmarshals bytes to a ProposalResponsePayload.
func UnmarshalResponse ¶
UnmarshalResponse unmarshals bytes to a Response.
func UnmarshalSignatureHeader ¶
func UnmarshalSignatureHeader(bytes []byte) (*common.SignatureHeader, error)
UnmarshalSignatureHeader unmarshals bytes to a SignatureHeader.
func UnmarshalSignatureHeaderOrPanic ¶
func UnmarshalSignatureHeaderOrPanic(bytes []byte) *common.SignatureHeader
UnmarshalSignatureHeaderOrPanic unmarshals bytes to a SignatureHeader or panics on error.
func UnmarshalSignaturePolicy ¶
func UnmarshalSignaturePolicy(bytes []byte) (*common.SignaturePolicyEnvelope, error)
UnmarshalSignaturePolicy unmarshals bytes to a SignaturePolicyEnvelope.
func UnmarshalTransaction ¶
func UnmarshalTransaction(txBytes []byte) (*peer.Transaction, error)
UnmarshalTransaction unmarshals bytes to a Transaction.
func UnmarshalTxReadWriteSet ¶
func UnmarshalTxReadWriteSet(bytes []byte) (*rwset.TxReadWriteSet, error)
UnmarshalTxReadWriteSet unmarshals bytes to a TxReadWriteSet.
Types ¶
type BlockSigVerifier ¶ added in v0.2.0
BlockSigVerifier can be used to verify blocks using the given policy. If BFT is enabled, a list of Consenters must also be provided.
func (*BlockSigVerifier) Verify ¶ added in v0.2.0
func (v *BlockSigVerifier) Verify(header *cb.BlockHeader, metadata *cb.BlockMetadata) error
Verify verifies a block's header and metadata using the verifier's policy.
type BlockVerifierFunc ¶
type BlockVerifierFunc func(header *cb.BlockHeader, metadata *cb.BlockMetadata) error
BlockVerifierFunc is returned by BlockSignatureVerifier. It is preserved for backward compatibility.
func BlockSignatureVerifier ¶
func BlockSignatureVerifier(bftEnabled bool, consenters []*cb.Consenter, policy policy) BlockVerifierFunc
BlockSignatureVerifier is a wrapper for BlockSigVerifier. It is preserved for backward compatibility.
type SignedData ¶
SignedData is used to represent the general triplet required to verify a signature This is intended to be generic across crypto schemes, while most crypto schemes will include the signing identity and a nonce within the Data, this is left to the crypto implementation.
func ConfigUpdateEnvelopeAsSignedData ¶
func ConfigUpdateEnvelopeAsSignedData(ce *common.ConfigUpdateEnvelope) ([]*SignedData, error)
ConfigUpdateEnvelopeAsSignedData returns the set of signatures for the ConfigUpdateEnvelope as SignedData or an error indicating why this was not possible.
func EnvelopeAsSignedData ¶
func EnvelopeAsSignedData(env *common.Envelope) ([]*SignedData, error)
EnvelopeAsSignedData returns the signatures for the Envelope as SignedData slice of length 1 or an error indicating why this was not possible.