golang

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 25 Imported by: 2

README

Documentation

Overview

tape.go is utils copied from tape project

Index

Constants

This section is empty.

Variables

View Source
var (
	// CurveHalfOrders contains the precomputed curve group orders halved.
	// It is used to ensure that signature' S value is lower or equal to the
	// curve group order halved. We accept only low-S signatures.
	// They are precomputed for efficiency reasons.
	CurveHalfOrders = map[elliptic.Curve]*big.Int{
		elliptic.P224(): new(big.Int).Rsh(elliptic.P224().Params().N, 1),
		elliptic.P256(): new(big.Int).Rsh(elliptic.P256().Params().N, 1),
		elliptic.P384(): new(big.Int).Rsh(elliptic.P384().Params().N, 1),
		elliptic.P521(): new(big.Int).Rsh(elliptic.P521().Params().N, 1),
	}
)

Functions

func CommitterFrom

func CommitterFrom(connect *grpc.ClientConn) orderer.AtomicBroadcastClient

func CreateProposal

func CreateProposal(creator []byte, channel, ccname, version string, transientMap map[string][]byte, args ...string) (proposal *peer.Proposal, txid string, err error)

func DERToPrivateKey

func DERToPrivateKey(der []byte) (key interface{}, err error)

DERToPrivateKey unmarshals a der to private key

func EndorserFrom

func EndorserFrom(connect *grpc.ClientConn) peer.EndorserClient

func FindKeyFilesOrPanic

func FindKeyFilesOrPanic(dirname string) []string

func GetCertificate

func GetCertificate(f string) (*x509.Certificate, []byte, error)

func GetChaincodeHeaderExtension added in v0.0.1

func GetChaincodeHeaderExtension(hdr *common.Header) (*peer.ChaincodeHeaderExtension, error)

func GetPrivateKey

func GetPrivateKey(f string) (*ecdsa.PrivateKey, error)

func GetRandomNonce

func GetRandomNonce() []byte

func IsLowS

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

func PEMtoPrivateKey

func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error)

PEMtoPrivateKey unmarshals a pem to private key

func Ping

func Ping(target string, params Params) (connect *grpc.ClientConn, err error)

func ToAddress

func ToAddress(url string) string

ToAddress is a utility function to trim the GRPC protocol prefix as it is not needed by GO if the GRPC protocol is not found, the url is returned unchanged

func ToLowS

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

Types

type Committer

func (*Committer) SendRecv

func (committer *Committer) SendRecv(envelope *common.Envelope) (*orderer.BroadcastResponse, error)

func (*Committer) Setup

func (committer *Committer) Setup() (err error)

type Crypto

type Crypto struct {
	Creator  []byte
	PrivKey  *ecdsa.PrivateKey
	SignCert *x509.Certificate
	Digest   func([]byte) []byte
}

func LoadCryptoFrom

func LoadCryptoFrom(config CryptoConfig) (*Crypto, error)

func (*Crypto) NewSignatureHeader

func (s *Crypto) NewSignatureHeader() (*common.SignatureHeader, error)

func (*Crypto) Serialize

func (s *Crypto) Serialize() ([]byte, error)

func (*Crypto) SetDefaultDigest

func (s *Crypto) SetDefaultDigest()

func (*Crypto) Sign

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

type CryptoConfig

type CryptoConfig struct {
	MSPID      string
	PrivKey    string
	SignCert   string
	TLSCACerts []string
}

type ECDSASignature

type ECDSASignature struct {
	R, S *big.Int
}

type Endorser

type Endorser struct {
	peer.EndorserClient
	context.Context
}

func (*Endorser) ProcessProposal

func (endorser *Endorser) ProcessProposal(in *peer.SignedProposal) (*peer.ProposalResponse, error)

type Node

type Node struct {
	Addr                  string `yaml:"addr"`
	TLSCACert             string `yaml:"tls_ca_cert"`
	TLSCAKey              string `yaml:"tls_ca_key"`
	TLSCARoot             string `yaml:"tls_ca_root"`
	TLSCACertByte         []byte
	TLSCAKeyByte          []byte
	TLSCARootByte         []byte
	SslTargetNameOverride string `json:"ssl-target-name-override"`
}

func (Node) AsGRPCClient

func (node Node) AsGRPCClient() (connect *grpc.ClientConn, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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