Documentation ¶
Overview ¶
Package access contains structs for storing chaincode access control information
Index ¶
- Variables
- func CertSubjEqual(a, b []byte) (bool, 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
- func PrivateKey(keyBytes []byte) (*ecdsa.PrivateKey, error)
- type CertIdentity
- func (ci CertIdentity) Anonymous() bool
- func (ci CertIdentity) ExpiresAt() time.Time
- func (ci CertIdentity) GetID() string
- func (ci CertIdentity) GetIdentifier() *msp.IdentityIdentifier
- func (ci CertIdentity) GetIssuer() string
- func (ci CertIdentity) GetMSPID() stringdeprecated
- func (ci CertIdentity) GetMSPIdentifier() string
- func (ci CertIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
- func (ci CertIdentity) GetPEM() []byte
- func (ci CertIdentity) GetPublicKey() interface{}
- func (ci CertIdentity) GetPublicVersion() msp.Identity
- func (ci CertIdentity) GetSubject() string
- func (ci CertIdentity) SatisfiesPrincipal(principal *protomsp.MSPPrincipal) error
- func (ci CertIdentity) Serialize() ([]byte, error)
- func (ci CertIdentity) Sign(msg []byte) ([]byte, error)
- func (ci CertIdentity) ToBytes() ([]byte, error)
- func (ci CertIdentity) ToSerialized() *protomsp.SerializedIdentity
- func (ci CertIdentity) Validate() error
- func (ci CertIdentity) Verify(msg []byte, sig []byte) error
- type Entry
- type Id
- type Identity
- type IdentityEntry
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPEMStructure = errors.New(`invalid pem structure`) // ErrPemEncodedExpected pem format error ErrPemEncodedExpected = errors.New("expecting a PEM-encoded X509 certificate; PEM block not found") )
Functions ¶
func CertSubjEqual ¶ added in v0.6.4
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
func PrivateKey ¶ added in v0.6.4
func PrivateKey(keyBytes []byte) (*ecdsa.PrivateKey, error)
Types ¶
type CertIdentity ¶
type CertIdentity struct { MspID string Cert *x509.Certificate }
CertIdentity structs holds data of an tx creator
func FromSerialized ¶
func FromSerialized(s protomsp.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) Anonymous ¶ added in v0.6.4
func (ci CertIdentity) Anonymous() bool
func (CertIdentity) ExpiresAt ¶ added in v0.6.4
func (ci CertIdentity) ExpiresAt() time.Time
func (CertIdentity) GetID ¶
func (ci CertIdentity) GetID() string
GetID get id based in certificate subject and issuer
func (CertIdentity) GetIdentifier ¶ added in v0.6.4
func (ci CertIdentity) GetIdentifier() *msp.IdentityIdentifier
func (CertIdentity) GetIssuer ¶
func (ci CertIdentity) GetIssuer() string
GetIssuer returns invoker's certificate issuer
func (CertIdentity) GetMSPID
deprecated
func (ci CertIdentity) GetMSPID() string
Deprecated: GetMSPID returns invoker's membership service provider id
func (CertIdentity) GetMSPIdentifier ¶ added in v0.6.4
func (ci CertIdentity) GetMSPIdentifier() string
func (CertIdentity) GetOrganizationalUnits ¶ added in v0.6.4
func (ci CertIdentity) GetOrganizationalUnits() []*msp.OUIdentifier
func (CertIdentity) GetPEM ¶
func (ci CertIdentity) GetPEM() []byte
GetPEM certificate encoded to PEM
func (CertIdentity) GetPublicKey ¶
func (ci CertIdentity) GetPublicKey() interface{}
func (CertIdentity) GetPublicVersion ¶ added in v0.6.4
func (ci CertIdentity) GetPublicVersion() msp.Identity
func (CertIdentity) GetSubject ¶
func (ci CertIdentity) GetSubject() string
GetSubject returns invoker's certificate subject
func (CertIdentity) SatisfiesPrincipal ¶ added in v0.6.4
func (ci CertIdentity) SatisfiesPrincipal(principal *protomsp.MSPPrincipal) error
func (CertIdentity) Serialize ¶ added in v0.6.4
func (ci CertIdentity) Serialize() ([]byte, error)
func (CertIdentity) ToBytes ¶
func (ci CertIdentity) ToBytes() ([]byte, error)
ToBytes converts to serializedIdentity and then to json
func (CertIdentity) ToSerialized ¶
func (ci CertIdentity) ToSerialized() *protomsp.SerializedIdentity
ToSerialized converts CertIdentity to *msp.SerializedIdentity
func (CertIdentity) Validate ¶ added in v0.6.4
func (ci CertIdentity) Validate() error
type Entry ¶
type Entry struct { MSPId string Subject string Issuer string PEM []byte Cert *x509.Certificate `json:"-"` // temporary cert }
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 protomsp.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 Identity ¶
type Identity interface { msp.Identity // Deprecated: GetID Identifier, based on Subject and Issuer. Use GetIdentifier instead GetID() string // Deprecated: GetMSPID msp identifier. Use GetMspIdentifier instead 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 }
Identity interface for invoker (tx creator) and grants, stored in chain code state
type IdentityEntry ¶
type IdentityEntry interface {
GetIdentityEntry() Entry
}
IdentityEntry interface