asymalgo

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSigningEmpty is Signing empty value error
	ErrSigningEmpty = errors.New("Signing empty value")
	// ErrCheckingSignEmpty is Checking sign of empty error
	ErrCheckingSignEmpty = errors.New("Cheking sign of empty")
	// ErrIncorrectSign is Incorrect sign
	ErrIncorrectSign = errors.New("Incorrect sign")
)

Functions

func FillLeft

func FillLeft(slice []byte) []byte

FillLeft is filling slice

func ParseSign

func ParseSign(sign string) (*big.Int, *big.Int, error)

ParseSign converts the hex signature to r and s big number

Types

type P256

type P256 struct{}

func (*P256) GenKeyPair

func (e *P256) GenKeyPair() ([]byte, []byte, error)

func (*P256) PrivateToPublic

func (e *P256) PrivateToPublic(key []byte) ([]byte, error)

func (*P256) Sign

func (e *P256) Sign(privateKey, hash []byte) ([]byte, error)

func (*P256) Verify

func (e *P256) Verify(public, hash, signature []byte) (bool, error)

type SM2

type SM2 struct{}

func (*SM2) GenKeyPair

func (s *SM2) GenKeyPair() ([]byte, []byte, error)

func (*SM2) PrivateToPublic

func (s *SM2) PrivateToPublic(key []byte) ([]byte, error)

func (*SM2) Sign

func (s *SM2) Sign(privateKey, hash []byte) ([]byte, error)

func (*SM2) Verify

func (s *SM2) Verify(public, hash, signature []byte) (bool, error)

type Secp256k1

type Secp256k1 struct{}

func (*Secp256k1) GenKeyPair

func (s *Secp256k1) GenKeyPair() ([]byte, []byte, error)

func (*Secp256k1) PrivateToPublic

func (s *Secp256k1) PrivateToPublic(key []byte) ([]byte, error)

func (*Secp256k1) Sign

func (s *Secp256k1) Sign(privateKey, hash []byte) ([]byte, error)

func (*Secp256k1) Verify

func (s *Secp256k1) Verify(public, hash, signature []byte) (bool, error)

Jump to

Keyboard shortcuts

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