Documentation ¶
Overview ¶
Package access contains structs for storing chaincode access control information
Index ¶
- Variables
- func ActorsFromPem(mspID string, certPEMs map[string][]byte) (map[string]*CertIdentity, error)
- func Certificate(c []byte) (cert *x509.Certificate, err error)
- func GetDN(name *pkix.Name) string
- func ID(subject, issuer string) string
- func IDByCert(cert *x509.Certificate) string
- func IDRaw(subject, issuer string) string
- type Actors
- type CertIdentity
- func FromFile(mspID string, filename string, getContent GetContent) (ci *CertIdentity, err error)
- func FromSerialized(s msp.SerializedIdentity) (ci *CertIdentity, err error)
- func FromStub(stub shim.ChaincodeStubInterface) (ci *CertIdentity, err error)
- func New(mspID string, certPEM []byte) (ci *CertIdentity, err error)
- func (ci CertIdentity) GetID() string
- func (ci CertIdentity) GetIssuer() string
- func (ci CertIdentity) GetMSPID() string
- func (ci CertIdentity) GetPEM() []byte
- func (ci CertIdentity) GetPublicKey() interface{}
- func (ci CertIdentity) GetSubject() string
- func (ci CertIdentity) Is(id Identity) bool
- func (ci CertIdentity) ToBytes() ([]byte, error)
- func (ci CertIdentity) ToSerialized() *msp.SerializedIdentity
- type Entry
- type GetContent
- type Id
- type Identity
- type IdentityEntry
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPemEncodedExpected pem format error ErrPemEncodedExpected = errors.New("expecting a PEM-encoded X509 certificate; PEM block not found") )
Functions ¶
func ActorsFromPem ¶
ActorsFromPem returns CertIdentity (MSP ID and X.509 cert) converted PEM content
func Certificate ¶
func Certificate(c []byte) (cert *x509.Certificate, err error)
Certificate decode and parse .pem []byte x509 certificate structure
func GetDN ¶
GetDN (distinguished name) associated with a pkix.Name. NOTE: This code is almost a direct copy of the String() function in https://go-review.googlesource.com/c/go/+/67270/1/src/crypto/x509/pkix/pkix.go#26 which returns a DN as defined by RFC 2253.
func IDByCert ¶
func IDByCert(cert *x509.Certificate) string
IDByCert returns id by certificate subject and issuer
Types ¶
type Actors ¶
type Actors map[string]*CertIdentity
func ActorsFromPemFile ¶
func ActorsFromPemFile(mspID string, files map[string]string, getContent GetContent) (Actors, error)
ActorsFromPemFile returns map of CertIdentity, loaded from PEM files
type CertIdentity ¶
type CertIdentity struct { MspID string Cert *x509.Certificate }
CertIdentity structs holds data of an tx creator
func FromFile ¶
func FromFile(mspID string, filename string, getContent GetContent) (ci *CertIdentity, err error)
FromFile creates certIdentity from file determined by filename
func FromSerialized ¶
func FromSerialized(s msp.SerializedIdentity) (ci *CertIdentity, err error)
FromSerialized converts msp.SerializedIdentity struct to Identity interface{}
func FromStub ¶
func FromStub(stub shim.ChaincodeStubInterface) (ci *CertIdentity, err error)
FromStub creates Identity interface from tx creator mspID and certificate (stub.GetCreator)
func New ¶
func New(mspID string, certPEM []byte) (ci *CertIdentity, err error)
New creates CertIdentity struct from an mspID and certificate
func (CertIdentity) GetID ¶
func (ci CertIdentity) GetID() string
GetID get id based in certificate subject and issuer
func (CertIdentity) GetIssuer ¶
func (ci CertIdentity) GetIssuer() string
GetIssuer returns invoker's certificate issuer
func (CertIdentity) GetMSPID ¶
func (ci CertIdentity) GetMSPID() string
GetMSPID returns invoker's membership service provider id
func (CertIdentity) GetPEM ¶
func (ci CertIdentity) GetPEM() []byte
GetPEM certificate encoded to PEM
func (CertIdentity) GetPublicKey ¶
func (ci CertIdentity) GetPublicKey() interface{}
func (CertIdentity) GetSubject ¶
func (ci CertIdentity) GetSubject() string
GetSubject returns invoker's certificate subject
func (CertIdentity) Is ¶
func (ci CertIdentity) Is(id Identity) bool
Is checks invoker is equal an identity
func (CertIdentity) ToBytes ¶
func (ci CertIdentity) ToBytes() ([]byte, error)
ToBytes converts to serializedIdentity and then to json
func (CertIdentity) ToSerialized ¶
func (ci CertIdentity) ToSerialized() *msp.SerializedIdentity
ToSerialized converts CertIdentity to *msp.SerializedIdentity
type Entry ¶
type Entry struct { MSPId string Subject string Issuer string PEM []byte // contains filtered or unexported fields }
Entry structure for storing identity information string representation certificate Subject and Issuer can be used for reach query searching
func CreateEntry ¶
CreateEntry creates IdentityEntry structure from an identity interface
func EntryFromSerialized ¶
func EntryFromSerialized(s msp.SerializedIdentity) (g *Entry, err error)
EntryFromSerialized creates Entry from SerializedEntry
func EntryFromStub ¶
func EntryFromStub(stub shim.ChaincodeStubInterface) (g *Entry, err error)
func (Entry) GetIdentityEntry ¶
func (Entry) GetPublicKey ¶
func (e Entry) GetPublicKey() interface{}
type GetContent ¶
type Identity ¶
type Identity interface { // GetID Identifier, based on Subject and Issuer GetID() string // GetMSPID msp identifier GetMSPID() string // GetSubject string representation of X.509 cert subject GetSubject() string // GetIssuer string representation of X.509 cert issuer GetIssuer() string // GetPublicKey *rsa.PublicKey or *dsa.PublicKey or *ecdsa.PublicKey: GetPublicKey() interface{} GetPEM() []byte Is(i Identity) bool }
Identity interface for invoker (tx creator) and grants, stored in chain code state
type IdentityEntry ¶
type IdentityEntry interface {
GetIdentityEntry() Entry
}
IdentityEntry interface