Documentation ¶
Index ¶
- func CreatePrivatePem(privateKey *sm2.PrivateKey, pwd []byte, path string) error
- func CreatePublicPem(publicKey *sm2.PublicKey, path string) error
- func CreateSM2Key() (privateKey *sm2.PrivateKey, publicKey *sm2.PublicKey, err error)
- func Decrypt(cipherStr string, privateKey *sm2.PrivateKey) (string, error)
- func DecryptWithSm4(key, iv, cipherText []byte) ([]byte, error)
- func Encrypt(data string, publicKey *sm2.PublicKey) string
- func EncryptWithSm4(key, iv, plainText []byte) ([]byte, error)
- func ReadPrivatePem(path string, pwd []byte) (*sm2.PrivateKey, error)
- func ReadPublicPem(path string) (*sm2.PublicKey, error)
- func Sign(msg string, privateKey *sm2.PrivateKey, signer crypto.SignerOpts) (string, error)
- func Sm3(data string) []byte
- func Verify(msg string, sign string, publicKey *sm2.PublicKey) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePrivatePem ¶
func CreatePrivatePem(privateKey *sm2.PrivateKey, pwd []byte, path string) error
CreatePrivatePem Create private key file
func CreatePublicPem ¶
CreatePublicPem Create public key file
func CreateSM2Key ¶
func CreateSM2Key() (privateKey *sm2.PrivateKey, publicKey *sm2.PublicKey, err error)
CreateSM2Key Randomly generate public and private keys
func DecryptWithSm4 ¶
func EncryptWithSm4 ¶
func ReadPrivatePem ¶
func ReadPrivatePem(path string, pwd []byte) (*sm2.PrivateKey, error)
ReadPrivatePem Read private key file
func ReadPublicPem ¶
ReadPublicPem Read public key file
func Sign ¶
func Sign(msg string, privateKey *sm2.PrivateKey, signer crypto.SignerOpts) (string, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.