sm2

package
v0.0.0-...-1c4572a Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SM2_RPIVATEKEY_LENGTH = 32
	SM2_PUBLICKEY_LENGTH  = 65
)
View Source
const ID = 3
View Source
const Name = "sm2"

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(sigStr []byte) (*big.Int, *big.Int, error)

func IsLowS

func IsLowS(s *big.Int) bool

func Serialize

func Serialize(r, s *big.Int) []byte

func SerializePrivateKey

func SerializePrivateKey(p *sm2.PrivateKey) []byte

func SerializePublicKey

func SerializePublicKey(p *sm2.PublicKey) []byte

func ToLowS

func ToLowS(k *sm2.PublicKey, s *big.Int) *big.Int

Types

type Driver

type Driver struct{}

func (Driver) GenKey

func (d Driver) GenKey() (crypto.PrivKey, error)

func (Driver) PrivKeyFromBytes

func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)

func (Driver) PubKeyFromBytes

func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)

func (Driver) SignatureFromBytes

func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)

type PrivKeySM2

type PrivKeySM2 [SM2_RPIVATEKEY_LENGTH]byte

func (PrivKeySM2) Bytes

func (privKey PrivKeySM2) Bytes() []byte

func (PrivKeySM2) Equals

func (privKey PrivKeySM2) Equals(other crypto.PrivKey) bool

func (PrivKeySM2) PubKey

func (privKey PrivKeySM2) PubKey() crypto.PubKey

func (PrivKeySM2) Sign

func (privKey PrivKeySM2) Sign(msg []byte) crypto.Signature

func (PrivKeySM2) String

func (privKey PrivKeySM2) String() string

type PubKeySM2

type PubKeySM2 [SM2_PUBLICKEY_LENGTH]byte

func (PubKeySM2) Bytes

func (pubKey PubKeySM2) Bytes() []byte

func (PubKeySM2) Equals

func (pubKey PubKeySM2) Equals(other crypto.PubKey) bool

func (PubKeySM2) KeyString

func (pubKey PubKeySM2) KeyString() string

Must return the full bytes in hex. Used for map keying, etc.

func (PubKeySM2) String

func (pubKey PubKeySM2) String() string

func (PubKeySM2) VerifyBytes

func (pubKey PubKeySM2) VerifyBytes(msg []byte, sig crypto.Signature) bool

type SM2Signature

type SM2Signature struct {
	R, S *big.Int
}

type SignatureS

type SignatureS struct {
	crypto.Signature
}

type SignatureSM2

type SignatureSM2 []byte

func (SignatureSM2) Bytes

func (sig SignatureSM2) Bytes() []byte

func (SignatureSM2) Equals

func (sig SignatureSM2) Equals(other crypto.Signature) bool

func (SignatureSM2) IsZero

func (sig SignatureSM2) IsZero() bool

func (SignatureSM2) String

func (sig SignatureSM2) String() string

Jump to

Keyboard shortcuts

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