x509

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 31 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MSPType       = "bccsp"
	BCCSPOptField = "BCCSP"
)
View Source
const (
	BCCSPType = "bccsp"
	SignCerts = "signcerts"
)

Variables

This section is empty.

Functions

func GetBCCSPFromConf

func GetBCCSPFromConf(dir string, keyStorePath string, conf *config.BCCSP) (bccsp.BCCSP, bccsp.KeyStore, error)

GetBCCSPFromConf returns a BCCSP instance and its relative key store from the passed configuration. If no configuration is passed, the default one is used, namely the `SW` provider.

func GetEnrollmentID

func GetEnrollmentID(id []byte) (string, error)

func GetPKCS11BCCSP

func GetPKCS11BCCSP(conf *config.BCCSP) (bccsp.BCCSP, bccsp.KeyStore, error)

GetPKCS11BCCSP returns a new instance of the HSM-based BCCSP

func GetRevocationHandle added in v0.3.0

func GetRevocationHandle(id []byte) ([]byte, error)

func GetSWBCCSP

func GetSWBCCSP(dir string) (bccsp.BCCSP, bccsp.KeyStore, error)

GetSWBCCSP returns a new instance of the software-based BCCSP

func GetSigningIdentity

func GetSigningIdentity(mspConfigPath, keyStorePath, mspID string, bccspConfig *config.BCCSP) (driver.SigningIdentity, error)

GetSigningIdentity retrieves a signing identity from the passed arguments. If keyStorePath is empty, then it is assumed that the key is at mspConfigPath/keystore

func IsLowS

func IsLowS(k *ecdsa.PublicKey, s *big.Int) (bool, error)

IsLow checks that s is a low-S

func LoadLocalMSPAt

func LoadLocalMSPAt(dir, keyStorePath, id, mspType string, bccspConfig *config.BCCSP) (msp.MSP, error)

LoadLocalMSPAt loads an MSP whose configuration is stored at 'dir', and whose id and type are the passed as arguments.

func LoadLocalMSPSignerCert

func LoadLocalMSPSignerCert(dir string) ([]byte, error)

func LoadVerifyingMSPAt

func LoadVerifyingMSPAt(dir, id, mspType string) (msp.MSP, error)

LoadVerifyingMSPAt loads a verifying MSP whose configuration is stored at 'dir', and whose id and type are the passed as arguments.

func NewIdentityFromBytes

func NewIdentityFromBytes(raw []byte) (view.Identity, driver.Verifier, error)

func NewSigner

func NewSigner() (view.Identity, driver.Signer, driver.Verifier, error)

func NewVerifier

func NewVerifier(pk *ecdsa.PublicKey) *edsaVerifier

func PemDecodeCert

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

func PemDecodeKey

func PemDecodeKey(keyBytes []byte) (interface{}, error)

PemDecodeKey takes bytes and returns a Go key

func PemEncodeKey

func PemEncodeKey(key interface{}) ([]byte, error)

PemEncodeKey takes a Go key and converts it to bytes

func Serialize

func Serialize(mspID string, certPath string) ([]byte, error)

func SerializeFromMSP

func SerializeFromMSP(mspID string, path string) ([]byte, error)

func SerializeRaw

func SerializeRaw(mspID string, raw []byte) ([]byte, error)

func ToBCCSPOpts added in v0.2.0

func ToBCCSPOpts(boxed interface{}) (*config.BCCSP, error)

func ToLowS

func ToLowS(k *ecdsa.PublicKey, s *big.Int) (*big.Int, bool, error)

Types

type AuditInfo added in v0.3.0

type AuditInfo struct {
	EnrollmentId     string
	RevocationHandle []byte
}

func (*AuditInfo) Bytes added in v0.3.0

func (a *AuditInfo) Bytes() ([]byte, error)

func (*AuditInfo) FromBytes added in v0.3.0

func (a *AuditInfo) FromBytes(raw []byte) error

type Deserializer

type Deserializer struct{}

func (*Deserializer) DeserializeSigner

func (i *Deserializer) DeserializeSigner(raw []byte) (driver.Signer, error)

func (*Deserializer) DeserializeVerifier

func (i *Deserializer) DeserializeVerifier(raw []byte) (driver.Verifier, error)

func (*Deserializer) Info

func (i *Deserializer) Info(raw []byte, auditInfo []byte) (string, error)

func (*Deserializer) String

func (i *Deserializer) String() string

type FolderIdentityLoader added in v0.2.0

type FolderIdentityLoader struct {
	*IdentityLoader
}

func (*FolderIdentityLoader) Load added in v0.2.0

func (f *FolderIdentityLoader) Load(manager driver.Manager, c config.MSP) error

type IdentityLoader added in v0.2.0

type IdentityLoader struct{}

func (*IdentityLoader) Load added in v0.2.0

func (i *IdentityLoader) Load(manager driver.Manager, c config.MSP) error

type Provider added in v0.3.0

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

func NewProvider

func NewProvider(mspConfigPath, keyStorePath, mspID string, signerService SignerService) (*Provider, error)

NewProvider returns a new X509 provider. If the configuration path contains the secret key, then the provider can generate also signatures, otherwise it cannot.

func NewProviderWithBCCSPConfig

func NewProviderWithBCCSPConfig(mspConfigPath, keyStorePath, mspID string, signerService SignerService, bccspConfig *config.BCCSP) (*Provider, error)

NewProviderWithBCCSPConfig returns a new X509 provider with the passed BCCSP configuration. If the configuration path contains the secret key, then the provider can generate also signatures, otherwise it cannot.

func (*Provider) DeserializeSigner added in v0.3.0

func (p *Provider) DeserializeSigner(raw []byte) (driver.Signer, error)

func (*Provider) DeserializeVerifier added in v0.3.0

func (p *Provider) DeserializeVerifier(raw []byte) (driver.Verifier, error)

func (*Provider) EnrollmentID added in v0.3.0

func (p *Provider) EnrollmentID() string

func (*Provider) Identity added in v0.3.0

func (p *Provider) Identity(opts *fdriver.IdentityOptions) (view.Identity, []byte, error)

func (*Provider) Info added in v0.3.0

func (p *Provider) Info(raw []byte, auditInfo []byte) (string, error)

func (*Provider) IsRemote added in v0.3.0

func (p *Provider) IsRemote() bool

func (*Provider) SerializedIdentity added in v0.3.0

func (p *Provider) SerializedIdentity() (driver2.SigningIdentity, error)

func (*Provider) String added in v0.3.0

func (p *Provider) String() string

type SignerService

type SignerService interface {
	RegisterSigner(identity view.Identity, signer fdriver.Signer, verifier fdriver.Verifier) error
}

Jump to

Keyboard shortcuts

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