golang

package module
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 29 Imported by: 2

README

Documentation

Overview

TODO tape.go was utils copied from tape project, now we can write our own powered by goutil

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 DERToPrivateKey

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

DERToPrivateKey unmarshal a der to private key

func FindKeyFilesOrPanic

func FindKeyFilesOrPanic(dirname string) []string

func GetContractMetadata added in v0.0.10

func GetContractMetadata(ctx context.Context, connection grpc.ClientConnInterface, signingIdentity format.MessageSigningIdentity, channelID, chaincodeName string) (cm metadata.ContractChaincodeMetadata)

Only works when using the Contract API for your chaincode implementation , your chaincode should have a "org.hyperledger.fabric:GetMetadata" transaction function that will provide you with information on the smart contracts and transaction functions contained in the chaincode.

func GetPrivateKey

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

func IsLowS

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

func ListChannelOnPeer added in v0.0.9

func ListChannelOnPeer(ctx context.Context, connection grpc.ClientConnInterface, crypto *Crypto) (results []string)

func PEMtoPrivateKey

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

PEMtoPrivateKey unmarshal a pem to private key

func Ping

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

func PingOrPanic added in v0.0.11

func PingOrPanic(target string, params Params) *grpc.ClientConn

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

type Committer struct {
	orderer.AtomicBroadcastClient
	orderer.AtomicBroadcast_BroadcastClient // not intrinsic
}

func (*Committer) SendRecv

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

func (*Committer) Setup

func (committer *Committer) Setup(ctx context.Context) (err error)

type Crypto

type Crypto struct {
	Creator  []byte
	PrivKey  *ecdsa.PrivateKey
	SignCert *x509.Certificate
	// contains filtered or unexported fields
}

func LoadCryptoFrom

func LoadCryptoFrom(config CryptoConfig) *Crypto

func (*Crypto) Credentials added in v0.0.9

func (c *Crypto) Credentials() []byte

func (*Crypto) DefaultMode added in v0.0.11

func (c *Crypto) DefaultMode()

func (*Crypto) Digest

func (c *Crypto) Digest(message []byte) []byte

func (*Crypto) GatewayMode added in v0.0.11

func (c *Crypto) GatewayMode()

func (*Crypto) MspID added in v0.0.9

func (c *Crypto) MspID() string

func (*Crypto) NewSignatureHeader

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

func (*Crypto) Serialize

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

func (*Crypto) SetDigest added in v0.0.10

func (c *Crypto) SetDigest(digestFunc hash.Hash)

func (*Crypto) Sign

func (c *Crypto) Sign(message []byte) ([]byte, error)

type CryptoConfig

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

func (CryptoConfig) GetCertificate added in v0.0.10

func (c CryptoConfig) GetCertificate() (*x509.Certificate, []byte)

type ECDSASignature

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

type Endorser

type Endorser struct {
	peer.EndorserClient
	context.Context
}

func EndorserFrom

func EndorserFrom(ctx context.Context, connect *grpc.ClientConn) Endorser

func (*Endorser) ProcessProposal

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

type Node

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

func (Node) AsGRPCClient

func (node Node) AsGRPCClient() (*grpc.ClientConn, *http.Error)

func (Node) AsGRPCClientOrPanic added in v0.0.11

func (node Node) AsGRPCClientOrPanic() *grpc.ClientConn

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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