utils

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MrEnclaveLength = 32
View Source
const MrEnclaveStateKey = "MRENCLAVE"

Variables

This section is empty.

Functions

func ExtractEndpoint

func ExtractEndpoint(credentials *protos.Credentials) (string, error)

func ExtractMSPID

func ExtractMSPID(serializedIdentityRaw []byte) (string, error)

func GetChaincodeRequestMessageFromSignedProposal

func GetChaincodeRequestMessageFromSignedProposal(signedProposal *pb.SignedProposal) (crmProtoBytes []byte, e error)

func GetEnclaveId

func GetEnclaveId(attestedData *protos.AttestedData) string

returns enclave_id as hex-encoded string of SHA256 hash over enclave_vk.

func GetMrEnclave

func GetMrEnclave(chaincodeId string, stub shim.ChaincodeStubInterface) (string, error)

func IsFPCCompositeKey

func IsFPCCompositeKey(comp string) bool

func MarshallProto

func MarshallProto(msg proto.Message) string

func Read

func Read(file string) []byte

func ReplayReadWrites

func ReplayReadWrites(stub shim.ChaincodeStubInterface, fpcrwset *protos.FPCKVSet) (err error)

func SplitFPCCompositeKey

func SplitFPCCompositeKey(comp_str string) []string

func TransformToFPCKey

func TransformToFPCKey(comp string) string

func UnmarshalCredentials

func UnmarshalCredentials(credentialsBase64 string) (*protos.Credentials, error)

func Validate

func Validate(signedResponseMessage *protos.SignedChaincodeResponseMessage, attestedData *protos.AttestedData) error

func ValidateEndpoint

func ValidateEndpoint(endpoint string) error

Types

type AttestationParams

type AttestationParams struct {
	Params []string `json:"params"`
}

TODO replace this with a proto? TBD

type IdentityEvaluator

type IdentityEvaluator struct {
}

func (*IdentityEvaluator) EvaluateCreatorIdentity

func (id *IdentityEvaluator) EvaluateCreatorIdentity(creatorIdentityBytes []byte, ownerMSP string) error

EvaluateCreatorIdentity check that two identities have the same msp id. This function requires marshalled msp.SerializedIdentity as inputs.

type IdentityEvaluatorInterface

type IdentityEvaluatorInterface interface {
	EvaluateCreatorIdentity(creatorIdentityBytes []byte, ownerMSP string) error
}

type PolicyEvaluator

type PolicyEvaluator struct {
}

func (*PolicyEvaluator) EvaluateIdentity

func (id *PolicyEvaluator) EvaluateIdentity(policyBytes []byte, identityBytes []byte) error

EvaluateIdentity checks that the provided identity is a valid endorser as specified in the endorsement policy This function requires a marshalled pb.ApplicationPolicy and a marshalled msp.SerializedIdentity as input.

type PolicyEvaluatorInterface

type PolicyEvaluatorInterface interface {
	EvaluateIdentity(policyBytes []byte, identityBytes []byte) error
}

func NewPolicyEvaluator

func NewPolicyEvaluator() PolicyEvaluatorInterface

type Response

type Response struct {
	ResponseData []byte `json:"ResponseData"`
	Signature    []byte `json:"Signature"`
	PublicKey    []byte `json:"PublicKey"`
}

Response contains the response data and signature produced by the enclave TODO remove once ecc uses new ChaincodeResponseMessage

func UnmarshalResponse

func UnmarshalResponse(respBytes []byte) (*Response, error)

Jump to

Keyboard shortcuts

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