gosm2

package
v0.0.0-...-59da782 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

README

gosm2

使用golang cgo 绑定的 GmSSL 的sm2算法
https://github.com/guanzhi/GmSSL

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clearup

func Clearup()

func Decrypt

func Decrypt(priv *PriveKey, cipertext []byte) ([]byte, error)

func Decrypt1

func Decrypt1(priv *PriveKey, cipertext []byte) ([]byte, error)

func Encrypt

func Encrypt(pub *PublicKey, msg []byte) ([]byte, error)

func Encrypt1

func Encrypt1(pub *PublicKey, msg []byte) ([]byte, error)

func Hash

func Hash(pub *PublicKey, msg []byte) ([]byte, error)

func Hash2

func Hash2(msg []byte) ([]byte, error)

func Init

func Init()

func Ripemd160

func Ripemd160(data []byte) []byte

func Sigbin2Der

func Sigbin2Der(b []byte) ([]byte, error)

func Sign

func Sign(priv *PriveKey, hash []byte) ([]byte, error)

func Verify

func Verify(pub *PublicKey, hash, sig []byte) error

Types

type PriveKey

type PriveKey struct {
	*PublicKey
	// contains filtered or unexported fields
}

func DERDecodePrivateKey

func DERDecodePrivateKey(buf []byte) (*PriveKey, error)

func NewKey

func NewKey() (*PriveKey, error)

func NewKeyFormSecret

func NewKeyFormSecret(secret string) (*PriveKey, error)

func (*PriveKey) DERDecode

func (k *PriveKey) DERDecode(buf []byte) error

func (*PriveKey) DEREncode

func (k *PriveKey) DEREncode() ([]byte, error)

func (*PriveKey) DecodeString

func (k *PriveKey) DecodeString(s string) error

func (*PriveKey) EncodeString

func (k *PriveKey) EncodeString() string

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func OStrDecodePublicKey

func OStrDecodePublicKey(buf []byte) (*PublicKey, error)

func (*PublicKey) Address

func (k *PublicKey) Address() ([]byte, error)

func (*PublicKey) AddressString

func (k *PublicKey) AddressString() string

func (*PublicKey) DecodeString

func (k *PublicKey) DecodeString(s string) error

func (*PublicKey) EncodeString

func (k *PublicKey) EncodeString() string

func (*PublicKey) Hash

func (k *PublicKey) Hash() ([]byte, error)

func (*PublicKey) HashString

func (k *PublicKey) HashString() string

func (*PublicKey) OStrDecode

func (k *PublicKey) OStrDecode(buf []byte) error

func (*PublicKey) OStrEncode

func (k *PublicKey) OStrEncode() ([]byte, error)

Jump to

Keyboard shortcuts

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