testsig

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEndorsementsForSignatureRule

func CreateEndorsementsForSignatureRule(
	signatures, mspIDs, certBytesOrID [][]byte, creatorType int,
) *applicationpb.Endorsements

CreateEndorsementsForSignatureRule creates a EndorsementSet for a signature rule. It takes parallel slices of signatures, MSP IDs, and certificate bytes, and creates a EndorsementSet where each signature is paired with its corresponding identity (MSP ID and certificate). This is used when a set of signatures must all be present to satisfy a rule (e.g., an AND condition).

func CreateEndorsementsForThresholdRule

func CreateEndorsementsForThresholdRule(signatures ...[]byte) []*applicationpb.Endorsements

CreateEndorsementsForThresholdRule creates a slice of EndorsementSet pointers from individual threshold signatures. Each signature provided is wrapped in its own EndorsementWithIdentity and then placed in its own new EndorsementSet.

func GetCert

func GetCert(certPath string) (*x509.Certificate, error)

GetCert reads a PEM-encoded X.509 certificate from the specified file path. and returns the parsed certificate.

func GetCertFromBytes

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

GetCertFromBytes reads a PEM-encoded X.509 certificate and returns the parsed certificate.

func GetSerializedKeyFromCert

func GetSerializedKeyFromCert(certPath string) (signature.PublicKey, error)

GetSerializedKeyFromCert reads a ECDSA public key from a certificate file.

func NewKeyPair

NewKeyPair generate private and public keys. This should only be used for evaluation and testing as it might use non-secure crypto methods.

func NewKeyPairWithSeed

func NewKeyPairWithSeed(scheme signature.Scheme, seed int64) (signature.PrivateKey, signature.PublicKey)

NewKeyPairWithSeed generate deterministic private and public keys. This should only be used for evaluation and testing as it might use non-secure crypto methods.

func ParseSigningKey

func ParseSigningKey(keyContent []byte) (*ecdsa.PrivateKey, error)

ParseSigningKey decodes a ECDSA key from a PEM file.

func SerializeSigningKey

func SerializeSigningKey(key *ecdsa.PrivateKey) ([]byte, error)

SerializeSigningKey encodes a ECDSA private key into a PEM file.

func SerializeVerificationKey

func SerializeVerificationKey(key *ecdsa.PublicKey) ([]byte, error)

SerializeVerificationKey encodes a ECDSA public key into a PEM file.

Types

type NsEndorser

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

NsEndorser endorse a transaction's namespace. It converts a TX into a ASN1 message, and then uses the message endorser interface to endorse it. It also implements the endorser interface, which can endorse raw messages.

func NewNsEndorserFromKey

func NewNsEndorserFromKey(scheme signature.Scheme, key []byte) (*NsEndorser, error)

NewNsEndorserFromKey creates a new NsEndorser according to the key and scheme.

func NewNsEndorserFromMsp

func NewNsEndorserFromMsp(certType int, identities ...msp.SigningIdentity) (*NsEndorser, error)

NewNsEndorserFromMsp creates a new NsEndorser using identities. This endorser will create an endorsement for each MSP provided.

func (*NsEndorser) EndorseTxNs

func (v *NsEndorser) EndorseTxNs(txID string, tx *applicationpb.Tx, nsIdx int) (*applicationpb.Endorsements, error)

EndorseTxNs endorses a transaction's namespace.

Jump to

Keyboard shortcuts

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