Documentation ¶
Overview ¶
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) (cipher []byte, err error)
- 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 Sm2KeyGen(rand io.Reader) (sk, pk []byte, err error)
- func Sm2Sign(sk, pk, msg []byte) ([]byte, error)
- func Sm2Verify(sign, pk, msg []byte) bool
- func Verify(pub *PublicKey, msg []byte, r, s *big.Int) bool
- func VerifyWithDigest(pub *PublicKey, digest []byte, r, s *big.Int) bool
- type PrivateKey
- type PublicKey
- type Sm2PrivateKey
- type Sm2PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var DecryptionErr = errors.New("sm2: decryption error")
View Source
var EncryptionErr = errors.New("sm2: encryption error")
Functions ¶
func SignWithDigest ¶
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
type PublicKey ¶
type Sm2PrivateKey ¶
Click to show internal directories.
Click to hide internal directories.