Versions in this module Expand all Collapse all v2 v2.3.3 Oct 19, 2023 Changes in this version + const BIG_NUM_SIZE + const CTXPOOL_CACHESIZE + const CTX_POOLSIZE_PER_PK + const SM2_CIPHER_EXTRA_SIZE + const SM2_CIPHER_MODE_C1C2C3 + const SM2_CIPHER_MODE_C1C2C3_ASN1 + const SM2_CIPHER_MODE_C1C3C2 + const SM2_CIPHER_MODE_C1C3C2_ASN1 + const SM2_PRIVATE_KEY_SIZE + const SM2_PRIVATE_KEY_STR_LEN + const SM2_PUBLIC_KEY_SIZE + const SM2_PUBLIC_KEY_STR_LEN + const SM2_SIGNATURE_MAX_SIZE + const SM2_SIGNATURE_MODE_RS + const SM2_SIGNATURE_MODE_RS_ASN1 + const SM3_DIGEST_SIZE + func GetSignatureFromCFCA(signature []byte) []byte + func MarshalPrivateKey(key *PrivateKey) ([]byte, error) + func MarshalPublicKey(key *PublicKey) ([]byte, error) + func PrivateKeyToPEM(key *PrivateKey) (string, error) + func PublicKeyToPEM(key *PublicKey) (string, error) + type CtxPool struct + func NewCtxPoolWithPubKey(pubkey []byte) *CtxPool + func (c *CtxPool) Close() + func (c *CtxPool) GetCtx() *tencentsm.SM2_ctx_t + func (c *CtxPool) ReleaseCtx(ctx *tencentsm.SM2_ctx_t) + type PrivateKey struct + D *big.Int + Text []byte + func GenerateKeyPair() (*PrivateKey, error) + func PrivateKeyFromPEM(skPEM string) (*PrivateKey, error) + func UnmarshalPrivateKey(der []byte) (*PrivateKey, error) + func UnmarshalPrivateKeyWithCurve(namedCurveOID *asn1.ObjectIdentifier, der []byte) (*PrivateKey, error) + func (sk *PrivateKey) Bytes() ([]byte, error) + func (sk *PrivateKey) DecryptWithMode(cipher []byte, mode tencentsm.SM2CipherMode) ([]byte, error) + func (sk *PrivateKey) PublicKey() bccrypto.PublicKey + func (sk *PrivateKey) Sign(msg []byte) ([]byte, error) + func (sk *PrivateKey) SignWithOpts(msg []byte, opts *bccrypto.SignOpts) ([]byte, error) + func (sk *PrivateKey) String() (string, error) + func (sk *PrivateKey) ToStandardKey() crypto.PrivateKey + func (sk *PrivateKey) Type() bccrypto.KeyType + func (sk PrivateKey) Decrypt(cipher []byte) ([]byte, error) + func (sk PrivateKey) DecryptWithOpts(ciphertext []byte, opts *bccrypto.EncOpts) ([]byte, error) + func (sk PrivateKey) EncryptKey() bccrypto.EncryptKey + type PublicKey struct + Text []byte + X *big.Int + Y *big.Int + func ParseSM2PublicKey(asn1Data []byte) (*PublicKey, error) + func PublicKeyFromPEM(pkPEM string) (*PublicKey, error) + func UnmarshalPublicKey(der []byte) (*PublicKey, error) + func (pk *PublicKey) Bytes() ([]byte, error) + func (pk *PublicKey) String() (string, error) + func (pk *PublicKey) ToStandardKey() crypto.PublicKey + func (pk *PublicKey) Type() bccrypto.KeyType + func (pk *PublicKey) Verify(data []byte, sig []byte) (bool, error) + func (pk *PublicKey) VerifyWithOpts(msg []byte, sig []byte, opts *bccrypto.SignOpts) (bool, error) + func (pk PublicKey) Encrypt(msg []byte) ([]byte, error) + func (pk PublicKey) EncryptWithMode(msg []byte, mode tencentsm.SM2CipherMode) ([]byte, error) + func (pk PublicKey) EncryptWithOpts(data []byte, opts *bccrypto.EncOpts) ([]byte, error)