sm2

package
v0.0.0-...-16768cb Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package sm2 implements china crypto standards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sign

func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error)

func Verify

func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	D *big.Int
}

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, error)

func (*PrivateKey) Public

func (priv *PrivateKey) Public() crypto.PublicKey

The SM2's private key contains the public key

func (*PrivateKey) Sign

func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)

type PublicKey

type PublicKey struct {
	elliptic.Curve
	X, Y *big.Int
}

func (*PublicKey) Verify

func (pub *PublicKey) Verify(msg []byte, sign []byte) bool

Jump to

Keyboard shortcuts

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