Versions in this module Expand all Collapse all v0 v0.1.1 Apr 20, 2023 v0.1.0 Apr 20, 2023 Changes in this version + var DecryptionErr = errors.New("sm2: decryption error") + var EncryptionErr = errors.New("sm2: encryption error") + var SM2PARAM_A = new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16) + func AffineToP256Point(x, y *big.Int) (out p256Point) — darwin/amd64, linux/amd64, windows/amd64 + func Decrypt(c []byte, key *PrivateKey) ([]byte, error) + func Encrypt(rand io.Reader, key *PublicKey, msg []byte) (der []byte, err error) + func Hexprint(in []byte) — darwin/amd64, linux/amd64, windows/amd64 + func P256Sm2() elliptic.Curve + func Sign(rand io.Reader, priv *PrivateKey, msg []byte) (r, s *big.Int, err error) + func SignWithDigest(rand io.Reader, priv *PrivateKey, digest []byte) (r, s *big.Int, err error) + func Test1() — darwin/amd64, linux/amd64, windows/amd64 + func TestP256_Point() — darwin/amd64, linux/amd64, windows/amd64 + func Test_amd64() — darwin/amd64, linux/amd64, windows/amd64 + func Test_p256Func() — darwin/amd64, linux/amd64, windows/amd64 + func Test_p256InternalFunc() — darwin/amd64, linux/amd64, windows/amd64 + func Uint64ToAffine(in []uint64) (x, y *big.Int) — darwin/amd64, linux/amd64, windows/amd64 + func Verify(pub *PublicKey, msg []byte, r, s *big.Int) bool + func VerifyById(pub *PublicKey, msg, id []byte, r, s *big.Int) bool + func VerifyWithDigest(pub *PublicKey, digest []byte, r, s *big.Int) bool + type EncData struct + C2 []byte + Hash []byte + X *big.Int + Y *big.Int + type PrivateKey struct + D *big.Int + func GenerateKey(rand io.Reader) (*PrivateKey, error) + func (key *PrivateKey) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) + func (priv *PrivateKey) Public() crypto.PublicKey + func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) + func (priv *PrivateKey) SignWithDigest(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) + type PublicKey struct + X *big.Int + Y *big.Int + func (pub *PublicKey) Verify(msg []byte, sign []byte) bool + func (pub *PublicKey) VerifyWithDigest(digest []byte, sign []byte) bool