Versions in this module Expand all Collapse all v0 v0.1.1 Dec 2, 2021 Changes in this version + func Decrypt(priv *SM2PrivateKey, data []byte) ([]byte, error) + func Encrypt(pub *SM2PublicKey, data []byte, ivReader io.Reader) ([]byte, error) + func GenerateSM2KeyForDH(idA, idB, randA []byte, ...) (*big.Int, *big.Int, []byte, error) + func GetSM3Hasher() hash.Hash + func GetSm2Curve() elliptic.Curve + func GetSm4Cipher(key []byte) (cipher.Block, error) + func HashBeforeSM2(pub *SM2PublicKey, msg []byte) []byte + func NewSM3IDHasher() hash.Hash + func Sm4DecryptCBC(key, src []byte) ([]byte, error) + func Sm4EncryptCBC(key, originMsg []byte, randReader io.Reader) ([]byte, error) + type Hasher struct + func NewSM3Hasher() *Hasher + func (h *Hasher) BatchHash(msg [][]byte) (hash []byte, err error) + func (h *Hasher) BlockSize() int + func (h *Hasher) Hash(msg []byte) (hash []byte, err error) + func (h *Hasher) Reset() + func (h *Hasher) Size() int + func (h *Hasher) Sum(b []byte) []byte + func (h *Hasher) Write(p []byte) (n int, err error) + type IDHasher struct + func (h *IDHasher) BatchHash(msg [][]byte) (hash []byte, err error) + func (h *IDHasher) BlockSize() int + func (h *IDHasher) Hash(msg []byte) (hash []byte, err error) + func (h *IDHasher) Reset() + func (h *IDHasher) Size() int + func (h *IDHasher) Sum(b []byte) []byte + func (h *IDHasher) Write(p []byte) (n int, err error) + type SM2 struct + func NewSM2() *SM2 + func (sv *SM2) Sign(k []byte, digest []byte, _ io.Reader) (signature []byte, err error) + func (sv *SM2) Verify(k []byte, signature, digest []byte) (valid bool, err error) + type SM2PrivateKey struct + K [sm2KeyLen]byte + PublicKey SM2PublicKey + func GenerateSM2Key() (*SM2PrivateKey, error) + func (key *SM2PrivateKey) Bytes() ([]byte, error) + func (key *SM2PrivateKey) CalculatePublicKey() *SM2PrivateKey + func (key *SM2PrivateKey) FromBytes(k []byte, opt int) error + func (key *SM2PrivateKey) Public() std.PublicKey + func (key *SM2PrivateKey) SetPublicKey(k *SM2PublicKey) *SM2PrivateKey + func (key *SM2PrivateKey) Sign(k, digest []byte, reader io.Reader) ([]byte, error) + func (key *SM2PrivateKey) SignBatch(k, digest []byte, reader io.Reader) ([]byte, error) + type SM2PublicKey struct + Curve elliptic.Curve + X [sm2KeyLen]byte + Y [sm2KeyLen]byte + func (key *SM2PublicKey) Bytes() ([]byte, error) + func (key *SM2PublicKey) FromBytes(k []byte, opt int) error + func (key *SM2PublicKey) Verify(_, signature, digest []byte) (valid bool, err error) + type SM4 struct + func (ea *SM4) Decrypt(key, encryptedMsg []byte) (originMsg []byte, err error) + func (ea *SM4) Encrypt(key, originMsg []byte, reader io.Reader) (encryptedMsg []byte, err error) + type SM4Key []byte + func (t SM4Key) Bytes() ([]byte, error) + func (t SM4Key) FromBytes(k []byte, opt interface{}) []byte v0.1.0 Jan 11, 2021