identity

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSPAdminCertsPath           = `admincerts`
	MSPCaCertsPath              = `cacerts`
	MSPIntermediateCertsPath    = `intermediatecerts`
	MSPTLSCaCertsPath           = `tlscacerts`
	MSPTLSIntermediateCertsPath = `tlsintermediatecerts`
	MSPKeystorePath             = "keystore"
	MSPSignCertsPath            = "signcerts"
	MSPUsersCertsPath           = "user"
	MSPOuCertsPath              = "ou"
	MspConfigFile               = "config.yaml"
)

Variables

View Source
var (
	ErrNoPEMContent = errors.New("no pem content")
	ErrKeyNotFound  = errors.New("key not found")
)
View Source
var (
	ErrNoFilesInDirectory = errors.New(`no files in directory`)
)
View Source
var (
	ErrPEMEncodingFailed = errors.New("pem encoding failed")
)

Functions

func AdminCertsPath added in v0.7.3

func AdminCertsPath(mspPath string) string

func Certificate added in v0.7.3

func Certificate(certRaw []byte) (*x509.Certificate, error)

func CertificatesFromPath added in v0.7.3

func CertificatesFromPath(certDir string) ([]*x509.Certificate, error)

func FabricMSPConfigFromPath added in v0.7.3

func FabricMSPConfigFromPath(mspID, mspDir string) (*mspproto.FabricMSPConfig, error)

func Key added in v0.7.3

func Key(keyRaw []byte) (interface{}, error)

Key parses raw key btes

func KeyForCert added in v0.7.3

func KeyForCert(certRaw []byte, keyDir string) (interface{}, error)

KeyForCert returns private key for certificate from keyDir

func KeyPairForCert added in v0.7.3

func KeyPairForCert(certRaw []byte, keyDir string) (*x509.Certificate, interface{}, error)

func KeystorePath added in v0.7.3

func KeystorePath(mspPath string) string

func PEMEncode added in v0.7.3

func PEMEncode(certRaw []byte) []byte

func SerializedCertName added in v0.7.3

func SerializedCertName(path string, pos int) string

func SignCertsPath added in v0.7.3

func SignCertsPath(mspPath string) string

Types

type Identity added in v0.10.0

type Identity struct {
	// contains filtered or unexported fields
}

func New added in v0.7.3

func New(mspId string, cert *x509.Certificate) *Identity

func (*Identity) Anonymous added in v0.10.0

func (i *Identity) Anonymous() bool

func (*Identity) ExpiresAt added in v0.10.0

func (i *Identity) ExpiresAt() time.Time

ExpiresAt returns date of certificate expiration

func (*Identity) GetCert added in v0.10.0

func (i *Identity) GetCert() *x509.Certificate

func (*Identity) GetIdentifier added in v0.10.0

func (i *Identity) GetIdentifier() *msp.IdentityIdentifier

func (*Identity) GetMSPIdentifier added in v0.10.0

func (i *Identity) GetMSPIdentifier() string

func (*Identity) GetOrganizationalUnits added in v0.10.0

func (i *Identity) GetOrganizationalUnits() []*msp.OUIdentifier

func (*Identity) GetPEM added in v0.10.0

func (i *Identity) GetPEM() []byte

func (*Identity) SatisfiesPrincipal added in v0.10.0

func (i *Identity) SatisfiesPrincipal(principal *mspPb.MSPPrincipal) error

func (*Identity) Serialize added in v0.10.0

func (i *Identity) Serialize() ([]byte, error)

func (*Identity) SigningIdentity added in v0.10.0

func (i *Identity) SigningIdentity(privateKey interface{}) *SigningIdentity

func (*Identity) Validate added in v0.10.0

func (i *Identity) Validate() error

func (*Identity) Verify added in v0.10.0

func (i *Identity) Verify(msg []byte, sig []byte) error

type MSP added in v0.7.3

type MSP struct {
	// contains filtered or unexported fields
}

func MSPFromConfig added in v0.7.3

func MSPFromConfig(fabricMspConfig *mspproto.FabricMSPConfig) (*MSP, error)

MSPFromConfig created msp config from msp.FabricMSPConfig

func MSPFromPath added in v0.7.3

func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error)

MSPFromPath loads msp config from filesystem

func (*MSP) AdminOrSigner added in v0.7.3

func (m *MSP) AdminOrSigner() *SigningIdentity

AdminOrSigner - returns admin identity if exists, in another case return msp. installation, fetching cc list should happen from admin identity if there is admin identity, use it. in another case - try with msp identity

func (*MSP) Admins added in v0.7.3

func (m *MSP) Admins() []*SigningIdentity

func (*MSP) Config added in v0.10.0

func (m *MSP) Config() *mspproto.FabricMSPConfig

func (*MSP) Identifier added in v0.10.0

func (m *MSP) Identifier() string

func (*MSP) Serialize added in v0.10.0

func (m *MSP) Serialize() (MSPFiles, error)

func (*MSP) Signer added in v0.7.3

func (m *MSP) Signer() *SigningIdentity

func (*MSP) Users added in v0.7.3

func (m *MSP) Users() []*SigningIdentity

type MSPFiles added in v0.7.3

type MSPFiles map[string][]byte

func SerializeMSP added in v0.7.3

func SerializeMSP(fabricMSPConfig *mspproto.FabricMSPConfig) (MSPFiles, error)

func (MSPFiles) Add added in v0.7.3

func (mc MSPFiles) Add(path string, file []byte)

func (MSPFiles) Merge added in v0.7.3

func (mc MSPFiles) Merge(files MSPFiles)

func (MSPFiles) MergeToPath added in v0.7.3

func (mc MSPFiles) MergeToPath(mergePath string, files MSPFiles)

type MSPOpt added in v0.7.3

type MSPOpt func(opts *MSPOpts)

func WithAdminMSPPath added in v0.7.3

func WithAdminMSPPath(adminMSPPath string) MSPOpt

func WithSignCert added in v0.8.0

func WithSignCert(signCert []byte) MSPOpt

func WithSignCertPath added in v0.8.0

func WithSignCertPath(signCertPath string) MSPOpt

func WithSignKey added in v0.8.0

func WithSignKey(signKey []byte) MSPOpt

func WithSignKeyPath added in v0.8.0

func WithSignKeyPath(signKeyPath string) MSPOpt

func WithSkipConfig added in v0.8.0

func WithSkipConfig() MSPOpt

type MSPOpts added in v0.7.3

type MSPOpts struct {
	// contains filtered or unexported fields
}

type SigningIdentity added in v0.10.0

type SigningIdentity struct {
	*Identity
	// contains filtered or unexported fields
}

func FirstSigningFromPath added in v0.10.0

func FirstSigningFromPath(mspID string, certDir, keyDir string) (*SigningIdentity, error)

func ListSigningFromPath added in v0.10.0

func ListSigningFromPath(mspID string, certDir, keyDir string) ([]*SigningIdentity, error)

func NewSigning added in v0.10.0

func NewSigning(mspId string, cert *x509.Certificate, privateKey interface{}) *SigningIdentity

func NewSigningFromBytes added in v0.10.0

func NewSigningFromBytes(mspId string, certRaw []byte, keyRaw []byte) (*SigningIdentity, error)

func NewSigningFromFile added in v0.10.0

func NewSigningFromFile(mspId string, certPath string, keyPath string) (*SigningIdentity, error)

func NewSigningFromMSPPath added in v0.10.0

func NewSigningFromMSPPath(mspId string, mspPath string) (*SigningIdentity, error)

func (*SigningIdentity) GetPublicVersion added in v0.10.0

func (s *SigningIdentity) GetPublicVersion() msp.Identity

func (*SigningIdentity) Sign added in v0.10.0

func (s *SigningIdentity) Sign(msg []byte) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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