Documentation ¶
Overview ¶
Package sm2 implements china crypto standards.
Package sm2 implements china crypto standards.
Index ¶
- Variables
- func AffineToP256Point(x, y *big.Int) (out p256Point)
- 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)
- 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()
- func TestP256_Point()
- func Test_amd64()
- func Test_p256Func()
- func Test_p256InternalFunc()
- func Uint64ToAffine(in []uint64) (x, y *big.Int)
- 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
- type PrivateKey
- 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
Constants ¶
This section is empty.
Variables ¶
View Source
var DecryptionErr = errors.New("sm2: decryption error")
View Source
var EncryptionErr = errors.New("sm2: encryption error")
View Source
var SM2PARAM_A, _ = new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16)
Functions ¶
func AffineToP256Point ¶
func SignWithDigest ¶
func TestP256_Point ¶
func TestP256_Point()
func Test_amd64 ¶
func Test_amd64()
func Test_p256Func ¶
func Test_p256Func()
func Test_p256InternalFunc ¶
func Test_p256InternalFunc()
func Uint64ToAffine ¶
Types ¶
type PrivateKey ¶
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*PrivateKey, error)
func (*PrivateKey) Decrypt ¶
func (key *PrivateKey) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error)
func (*PrivateKey) Public ¶
func (priv *PrivateKey) Public() crypto.PublicKey
The SM2's private key contains the public key
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)
func (*PrivateKey) SignWithDigest ¶
func (priv *PrivateKey) SignWithDigest(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
Click to show internal directories.
Click to hide internal directories.