bridgesig

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CBridgeSigSz = 65
	CSKSz        = 32
)
View Source
const (
	UnExpectedError = iota
	InvalidPrivateKeyErr
	InvalidPublicKeyErr
	SignDataErr
	InvalidDataSignErr
	InvalidInputParamsSizeErr
	InvalidCommitteeInfoErr
	InvalidSignatureErr
	DecompressFromByteErr
	JSONError
)

Variables

View Source
var ErrCodeMessage = map[int]struct {
	Code    int
	message string
}{
	UnExpectedError:           {-1200, "Unexpected error"},
	InvalidPrivateKeyErr:      {-1201, "Private key is invalid"},
	InvalidPublicKeyErr:       {-1202, "Public key is invalid"},
	InvalidDataSignErr:        {-1203, "Signed data is invalid"},
	InvalidCommitteeInfoErr:   {-1204, "Committee's info is invalid"},
	InvalidInputParamsSizeErr: {-1205, "Len of Input Params is invalid"},
	DecompressFromByteErr:     {-1206, "Decompress bytes array to Elliptic point error"},
	JSONError:                 {-1207, "JSON Marshal, Unmarshal error"},
	InvalidSignatureErr:       {-1208, "Invalid signature"},
	SignDataErr:               {-1209, "Can not sign data"},
}

Functions

func B2ImN

func B2ImN(bytes []byte) *big.Int

B2ImN is Bytes to Int mod N, with N is secp256k1 curve order

func DecodeECDSASig

func DecodeECDSASig(sigStr string) (
	v byte,
	r string,
	s string,
	err error,
)

func KeyGen

func KeyGen(seed []byte) (ecdsa.PrivateKey, ecdsa.PublicKey)

func NewBriSignatureError

func NewBriSignatureError(key int, err error) error

func PKBytes

func PKBytes(pubKey *ecdsa.PublicKey) []byte

func SKBytes

func SKBytes(priKey *ecdsa.PrivateKey) []byte

func Sign

func Sign(keyBytes []byte, data []byte) ([]byte, error)

func Verify

func Verify(pubkeyBytes []byte, data []byte, sig []byte) (bool, error)

Types

type BriSignatureError

type BriSignatureError struct {
	Code    int
	Message string
	// contains filtered or unexported fields
}

func (BriSignatureError) Error

func (e BriSignatureError) Error() string

Jump to

Keyboard shortcuts

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