sm2

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_UID = []byte("1234567812345678")

Functions

func BytesToPrivKey

func BytesToPrivKey(b []byte) (*sm2.PrivateKey, error)

func BytesToPubKey

func BytesToPubKey(b []byte) (*sm2.PublicKey, error)

func Decrypt

func Decrypt(priv *sm2.PrivateKey, cipherBytes []byte) ([]byte, error)

func Encrypt

func Encrypt(pub *sm2.PublicKey, plainBytes []byte) ([]byte, error)

func GenerateKeyPair

func GenerateKeyPair() (*sm2.PrivateKey, *sm2.PublicKey, error)

func GenerateKeyPairWithSeed

func GenerateKeyPairWithSeed(seed []byte) (*sm2.PrivateKey, *sm2.PublicKey, error)

func PrivKeyToBytes

func PrivKeyToBytes(priv *sm2.PrivateKey) []byte

func PubKeyToBytes

func PubKeyToBytes(pub *sm2.PublicKey) []byte

func RawBytesToPubKey added in v1.3.0

func RawBytesToPubKey(b []byte) (*sm2.PublicKey, error)

func RetrievePubKey

func RetrievePubKey(priv *sm2.PrivateKey) *sm2.PublicKey

func Sign

func Sign(priv *sm2.PrivateKey, plainBytes []byte) ([]byte, error)

func Verify

func Verify(pub *sm2.PublicKey, plainBytes, cipherBytes []byte) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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