utils

package
v0.0.0-...-ba0cd9c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ONE = big.NewInt(1)
View Source
var ZERO = big.NewInt(0)

Functions

func ComputeHash256

func ComputeHash256(nums ...*big.Int) *big.Int

func GetBip340E

func GetBip340E(Px, Py *big.Int, rX []byte, m [32]byte) *big.Int

bitcoin schnorr

func GetId

func GetId(certificate *x509.Certificate) int32

func GetIdofCert

func GetIdofCert(name string) int32

func GetRandomInZnStar

func GetRandomInZnStar(n *big.Int, random io.Reader) (*big.Int, error)

Generate a random element in the group of all the elements in Z/nZ that has a multiplicative inverse.

func GetScalarETH

func GetScalarETH(message []byte, Rx, Ry, Px, Py *big.Int) *big.Int

func GetSortedPartyID

func GetSortedPartyID(ids []int) tss.SortedPartyIDs

func HashWithTag

func HashWithTag(tag string, msg []byte) []byte

func IntToBytes

func IntToBytes(i *big.Int) []byte

func IsEven

func IsEven(b *big.Int) bool

func LiftX

func LiftX(curve elliptic.Curve, x *big.Int) (*big.Int, *big.Int, error)

func LiftXEvenY

func LiftXEvenY(curve elliptic.Curve, x *big.Int) (*big.Int, *big.Int, error)

func LoadCertificateFromFilePath

func LoadCertificateFromFilePath(certFilePath string) (*x509.Certificate, error)

func LoadPrivateKeyPemFilePath

func LoadPrivateKeyPemFilePath(password, keyFilePath string) (*ecdsa.PrivateKey, error)

func MarshalMessage

func MarshalMessage(msg tss.Message) ([]byte, error)

func MarshalMessageArray

func MarshalMessageArray(msg []tss.Message) ([][]byte, error)

func ParseCertificate

func ParseCertificate(certPEM []byte) (*x509.Certificate, error)

func ParseCertificateKeyPem

func ParseCertificateKeyPem(password string, certKeyPEM []byte) (*ecdsa.PrivateKey, error)

func ParsePoly

func ParsePoly(buffer []byte) (vss.Vs, error)

func ParseShare

func ParseShare(buffer []byte) (*vss.Share, error)

func ReConstructSecret

func ReConstructSecret(shares ...*vss.Share) (*big.Int, error)

func ToBytes

func ToBytes(data interface{}) []byte

func ToPoint

func ToPoint(curve elliptic.Curve, x []byte) (*big.Int, *big.Int, error)

func UnMarshalMessage

func UnMarshalMessage(msg []byte) (tss.Message, error)

func UnMarshalMessageArray

func UnMarshalMessageArray(msg [][]byte) ([]tss.Message, error)

func VerifyCert

func VerifyCert(childCert, rootCert *x509.Certificate) bool

func VerifyCertificate

func VerifyCertificate(childCertPem, rootCertPem []byte) bool

Types

type CLMessage

type CLMessage struct {
	Index       int
	Id          string
	ToIndex     int
	ToId        string
	IsBroadcast bool
	Wire        []byte
}

type CertificateAsPem

type CertificateAsPem struct {
	SignedCertPem string
	PrivateKeyPem string
}

func CreateCARoot

func CreateCARoot(password, commonName, country, location, company, ounit string, year, serial int) (*CertificateAsPem, error)

func CreatePlainServerCert

func CreatePlainServerCert(password string, rootKeyPem []byte, rootCertPem []byte, commonName, country, location, company, ounit string, DNSNames, ipaddress []string, year, serialNumber int) (*CertificateAsPem, error)

type Point

type Point struct {
	X, Y *big.Int
}

func ScalarECCBaseMult

func ScalarECCBaseMult(curve elliptic.Curve, k *big.Int) *Point

func ScalarECCMult

func ScalarECCMult(curve elliptic.Curve, point *Point, k *big.Int) *Point

func (*Point) MarshalJSON

func (p *Point) MarshalJSON() ([]byte, error)

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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