Documentation
¶
Index ¶
- Variables
- func NewPolicyProvider(deserializer msp.IdentityDeserializer) policies.Provider
- func ToIdentities(pIdentities []*msppb.Identity, deserializer msp.IdentityDeserializer) ([]msp.Identity, []bool)
- type EnvelopeBasedPolicyProvider
- type MockIdentity
- func (*MockIdentity) Anonymous() bool
- func (*MockIdentity) ExpiresAt() time.Time
- func (id *MockIdentity) GetCertificatePEM() ([]byte, error)
- func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier
- func (*MockIdentity) GetMSPIdentifier() string
- func (*MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
- func (id *MockIdentity) SatisfiesPrincipal(p *mb.MSPPrincipal) error
- func (id *MockIdentity) Serialize() ([]byte, error)
- func (id *MockIdentity) SerializeWithIDOfCert() ([]byte, error)
- func (*MockIdentity) Validate() error
- func (*MockIdentity) Verify(_, sig []byte) error
- type MockIdentityDeserializer
Constants ¶
This section is empty.
Variables ¶
var InvalidSignature = []byte("badsigned")
InvalidSignature denotes a non-valid signature.
Functions ¶
func NewPolicyProvider ¶
func NewPolicyProvider(deserializer msp.IdentityDeserializer) policies.Provider
NewPolicyProvider provides a policy generator for cauthdsl type policies.
func ToIdentities ¶
func ToIdentities(pIdentities []*msppb.Identity, deserializer msp.IdentityDeserializer) ( []msp.Identity, []bool, )
ToIdentities convert serialized identities to msp Identity.
Types ¶
type EnvelopeBasedPolicyProvider ¶
type EnvelopeBasedPolicyProvider struct {
Deserializer msp.IdentityDeserializer
}
EnvelopeBasedPolicyProvider allows to create a new policy from SignaturePolicyEnvelope struct instead of []byte.
func (*EnvelopeBasedPolicyProvider) NewPolicy ¶
func (pp *EnvelopeBasedPolicyProvider) NewPolicy( sigPolicy *cb.SignaturePolicyEnvelope, ) (policies.Policy, error)
NewPolicy creates a new policy from the policy envelope.
type MockIdentity ¶
MockIdentity interface defining operations associated to a "certificate".
func (*MockIdentity) Anonymous ¶
func (*MockIdentity) Anonymous() bool
Anonymous returns true if this is an anonymous identity, false otherwise.
func (*MockIdentity) ExpiresAt ¶
func (*MockIdentity) ExpiresAt() time.Time
ExpiresAt returns the time at which the Identity expires.
func (*MockIdentity) GetCertificatePEM ¶
func (id *MockIdentity) GetCertificatePEM() ([]byte, error)
GetCertificatePEM returns the certificate in PEM format.
func (*MockIdentity) GetIdentifier ¶
func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier
GetIdentifier returns the identifier of that identity.
func (*MockIdentity) GetMSPIdentifier ¶
func (*MockIdentity) GetMSPIdentifier() string
GetMSPIdentifier returns the MSP Id for this instance.
func (*MockIdentity) GetOrganizationalUnits ¶
func (*MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
GetOrganizationalUnits returns zero or more organization units or divisions this identity is related to as long as this is public information.
func (*MockIdentity) SatisfiesPrincipal ¶
func (id *MockIdentity) SatisfiesPrincipal(p *mb.MSPPrincipal) error
SatisfiesPrincipal checks whether this instance matches the description supplied in MSPPrincipal.
func (*MockIdentity) Serialize ¶
func (id *MockIdentity) Serialize() ([]byte, error)
Serialize converts an identity to bytes.
func (*MockIdentity) SerializeWithIDOfCert ¶
func (id *MockIdentity) SerializeWithIDOfCert() ([]byte, error)
SerializeWithIDOfCert converts an identity to bytes.
func (*MockIdentity) Validate ¶
func (*MockIdentity) Validate() error
Validate uses the rules that govern this identity to validate it.
func (*MockIdentity) Verify ¶
func (*MockIdentity) Verify(_, sig []byte) error
Verify a signature over some message using this identity as reference.
type MockIdentityDeserializer ¶
type MockIdentityDeserializer struct {
Fail error
KnownIdentities map[msp.IdentityIdentifier]msp.Identity
}
MockIdentityDeserializer is implemented by both MSPManger and MSP.
func (*MockIdentityDeserializer) DeserializeIdentity ¶
func (md *MockIdentityDeserializer) DeserializeIdentity( id *msppb.Identity, ) (msp.Identity, error)
DeserializeIdentity deserializes an identity.
func (*MockIdentityDeserializer) GetKnownDeserializedIdentity ¶
func (md *MockIdentityDeserializer) GetKnownDeserializedIdentity(id msp.IdentityIdentifier) msp.Identity
GetKnownDeserializedIdentity returns a known identity matching the given IdentityIdentifier.
func (*MockIdentityDeserializer) IsWellFormed ¶
func (*MockIdentityDeserializer) IsWellFormed(_ *msppb.Identity) error
IsWellFormed checks if the given identity can be deserialized into its provider-specific form.