sm2

package
v0.0.0-...-63f26f8 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSignToRS

func ParseSignToRS(asn1DerSign []byte, curvetype int) (r *big.Int, s *big.Int, err error)

func TransPubToDer

func TransPubToDer(x []byte, y []byte, curvetype int) ([]byte, error)

func TransSignToDer

func TransSignToDer(r *big.Int, s *big.Int, curvetype int) ([]byte, error)

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	D *big.Int
}

PrivateKey represents a ECDSA private key.

func GeneratePrivByC

func GeneratePrivByC(curveType int) (*PrivateKey, error)

func GeneratePrivKey

func GeneratePrivKey(curveType int) (*PrivateKey, error)

func GetPrivateKey

func GetPrivateKey(rnd []byte, curveType int) (*PrivateKey, error)

func ParsePriKeyFromDer

func ParsePriKeyFromDer(der []byte, curveType int) (*PrivateKey, error)

func (*PrivateKey) Sign

func (prikey *PrivateKey) Sign(msg []byte) ([]byte, error)

type PublicKey

type PublicKey struct {
	X, Y *big.Int
	// contains filtered or unexported fields
}

PublicKey represents an ECDSA public key.

func GeneratePublicKey

func GeneratePublicKey(x []byte, y []byte, curveType int) (retpub *PublicKey, reterr error)

func ParsePubKeyFromDer

func ParsePubKeyFromDer(der []byte, curveType int) (*PublicKey, error)

func ParsePubKeyFromEncode

func ParsePubKeyFromEncode(der []byte, curveType int) (*PublicKey, error)

func (*PublicKey) Check

func (pubkey *PublicKey) Check() (bool, error)

func (*PublicKey) PreHandle

func (pubkey *PublicKey) PreHandle(msg []byte) []byte

func (*PublicKey) Verify

func (pubkey *PublicKey) Verify(sig, msg []byte) (f bool, reterr error)

type SM2Param

type SM2Param struct {
	A         []byte
	B         []byte
	Entl1     []byte
	Entl2     []byte
	Userid    []byte
	P         []byte
	N         []byte
	XG        []byte
	YG        []byte
	CurveType int `json:"sm2_curve_type"`
}

func GetSM2Recom

func GetSM2Recom() *SM2Param

func GetSM2Test

func GetSM2Test() *SM2Param

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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