Documentation
¶
Overview ¶
Package sm2 implements china crypto standards.
Package sm2 implements china crypto standards.
Index ¶
- Variables
- func Decrypt(c []byte, key *PrivateKey) ([]byte, error)
- func Encrypt(rand io.Reader, key *PublicKey, msg []byte) (der []byte, err error)
- func P256Sm2() elliptic.Curve
- func Sign(rand io.Reader, priv *PrivateKey, msg []byte) (r, s *big.Int, err error)
- func Verify(pub *PublicKey, msg []byte, r, s *big.Int) bool
- func VerifyById(pub *PublicKey, msg, id []byte, r, s *big.Int) bool
- type EncData
- type PrivateKey
- 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 ¶
Types ¶
type PrivateKey ¶
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*PrivateKey, 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)
Click to show internal directories.
Click to hide internal directories.