gm

package
v0.0.0-...-2bfd647 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePrivatePem

func CreatePrivatePem(privateKey *sm2.PrivateKey, pwd []byte, path string) error

CreatePrivatePem Create private key file

func CreatePublicPem

func CreatePublicPem(publicKey *sm2.PublicKey, path string) error

CreatePublicPem Create public key file

func CreateSM2Key

func CreateSM2Key() (privateKey *sm2.PrivateKey, publicKey *sm2.PublicKey, err error)

CreateSM2Key Randomly generate public and private keys

func Decrypt

func Decrypt(cipherStr string, privateKey *sm2.PrivateKey) (string, error)

func DecryptWithSm4

func DecryptWithSm4(key, iv, cipherText []byte) ([]byte, error)

func Encrypt

func Encrypt(data string, publicKey *sm2.PublicKey) string

func EncryptWithSm4

func EncryptWithSm4(key, iv, plainText []byte) ([]byte, error)

func ReadPrivatePem

func ReadPrivatePem(path string, pwd []byte) (*sm2.PrivateKey, error)

ReadPrivatePem Read private key file

func ReadPublicPem

func ReadPublicPem(path string) (*sm2.PublicKey, error)

ReadPublicPem Read public key file

func Sign

func Sign(msg string, privateKey *sm2.PrivateKey, signer crypto.SignerOpts) (string, error)

func Sm3

func Sm3(data string) []byte

func Verify

func Verify(msg string, sign string, publicKey *sm2.PublicKey) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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