x509

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BCCSPType = "bccsp"
	SignCerts = "signcerts"
)

Variables

This section is empty.

Functions

func GetBCCSPFromConf

func GetBCCSPFromConf(dir 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 GetSWBCCSP

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

GetSWBCCSP returns a new instance of the software-based BCCSP

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, 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 NewProvider

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

func NewProviderWithBCCSPConfig

func NewProviderWithBCCSPConfig(mspConfigPath, mspID string, signerService SignerService, bccspConfig *config.BCCSP) (*provider, 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 ToLowS

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

Types

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 Identity

type Identity interface {
	Serialize() ([]byte, error)

	Verify(msg []byte, sig []byte) error
}

Identity refers to the creator of a tx;

type SignerService

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

type SigningIdentity

type SigningIdentity interface {
	Identity //extends Identity

	Sign(msg []byte) ([]byte, error)
}

SigningIdentity defines the functions necessary to sign an array of bytes; it is needed to sign the commands transmitted to the prover peer service.

func GetSigningIdentity

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

GetSigningIdentity retrieves a signing identity from the passed arguments

Jump to

Keyboard shortcuts

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