signaturealgorithm

package
v0.0.0-...-37ff43f Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignatureAlgorithmTest

func SignatureAlgorithmTest(t *testing.T, sig SignatureAlgorithm)

Types

type PrivateKey

type PrivateKey struct {
	PublicKey // public part.
	PriData   []byte
}

type PublicKey

type PublicKey struct {
	PubData []byte
}

type SignatureAlgorithm

type SignatureAlgorithm interface {
	SignatureName() string
	PublicKeyLength() int
	PrivateKeyLength() int
	SignatureLength() int
	SignatureWithPublicKeyLength() int
	PublicKeyStartValue() byte
	SignatureStartValue() byte

	GenerateKey() (*PrivateKey, error)

	SerializePrivateKey(*PrivateKey) ([]byte, error)
	DeserializePrivateKey([]byte) (*PrivateKey, error)

	SerializePublicKey(*PublicKey) ([]byte, error)
	DeserializePublicKey([]byte) (*PublicKey, error)

	HexToPrivateKey(string) (*PrivateKey, error)
	HexToPrivateKeyNoError(string) *PrivateKey

	PrivateKeyToHex(*PrivateKey) (string, error)

	HexToPublicKey(string) (*PublicKey, error)
	PublicKeyToHex(*PublicKey) (string, error)

	LoadPrivateKeyFromFile(file string) (*PrivateKey, error)
	SavePrivateKeyToFile(file string, key *PrivateKey) error

	PublicKeyToAddress(*PublicKey) (common.Address, error)
	PublicKeyToAddressNoError(*PublicKey) common.Address

	EncodePublicKey(*PublicKey) []byte
	DecodePublicKey([]byte) (*PublicKey, error)

	Sign(digestHash []byte, prv *PrivateKey) (sig []byte, err error)
	Verify(pubKey []byte, digestHash []byte, signature []byte) bool

	Zeroize(prv *PrivateKey)

	PublicKeyAndSignatureFromCombinedSignature(digestHash []byte, sig []byte) (signature []byte, pubKey []byte, err error)

	CombinePublicKeySignature(sigBytes []byte, pubKeyBytes []byte) (combinedSignature []byte, err error)

	PublicKeyBytesFromSignature(digestHash []byte, sig []byte) ([]byte, error)

	PublicKeyFromSignature(digestHash []byte, sig []byte) (*PublicKey, error)

	//what is this? todo
	ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool
}

Jump to

Keyboard shortcuts

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