Versions in this module Expand all Collapse all v1 v1.0.1 Jul 31, 2020 v1.0.0 Jul 3, 2020 Changes in this version + const BitSize + const KeyBytes + const UnCompress + func Decrypt(priv *PrivateKey, in []byte, cipherTextType Sm2CipherTextType) ([]byte, error) + func Encrypt(pub *PublicKey, in []byte, cipherTextType Sm2CipherTextType) ([]byte, error) + func GenerateKey(rand io.Reader) (*PrivateKey, *PublicKey, error) + func MarshalCipher(in []byte, cipherTextType Sm2CipherTextType) ([]byte, error) + func MarshalSign(r, s *big.Int) ([]byte, error) + func Sign(priv *PrivateKey, userId []byte, in []byte) ([]byte, error) + func SignToRS(priv *PrivateKey, userId []byte, in []byte) (r, s *big.Int, err error) + func ToECDSAPublickey(key *PublicKey) *ecdsa.PublicKey + func UnmarshalCipher(in []byte, cipherTextType Sm2CipherTextType) (out []byte, err error) + func UnmarshalSign(sign []byte) (r, s *big.Int, err error) + func Verify(pub *PublicKey, userId []byte, src []byte, sign []byte) bool + func VerifyByRS(pub *PublicKey, userId []byte, src []byte, r, s *big.Int) bool + type P256V1Curve struct + A *big.Int + func GetSm2P256V1() P256V1Curve + type PrivateKey struct + Curve P256V1Curve + D *big.Int + func EcsdAToSm2Pri(key *ecdsa.PrivateKey) *PrivateKey + func RawBytesToPrivateKey(bytes []byte) (*PrivateKey, error) + func (pri *PrivateKey) GetRawBytes() []byte + type PublicKey struct + Curve P256V1Curve + X *big.Int + Y *big.Int + func CalculatePubKey(priv *PrivateKey) *PublicKey + func EcsdAToSm2Pubk(key *ecdsa.PublicKey) *PublicKey + func RawBytesToPublicKey(bytes []byte) (*PublicKey, error) + func (pub *PublicKey) GetRawBytes() []byte + func (pub *PublicKey) GetUnCompressBytes() []byte + type Sm2CipherTextType int32 + const C1C2C3 + const C1C3C2