Versions in this module Expand all Collapse all v1 v1.4.9 Jul 22, 2021 Changes in this version + func CreateCertificateToMem(template, parent *x509GM.Certificate, signer crypto.Signer) (cert []byte, err error) + func CreateSm2CertificateRequestToMem(certificateRequest *x509GM.CertificateRequest, signer crypto.Signer) (csr []byte, err error) + func GetRandomBytes(len int) ([]byte, error) + func IsLowS(k *ecdsa.PublicKey, s *big.Int) (bool, error) + func IsPureGMTLSCertificate(cert *gmtls.Certificate) bool + func IsX509SM2Certificate(cert *x509.Certificate) bool + func MarshalSM2Signature(r, s *big.Int) ([]byte, error) + func New(securityLevel int, hashFamily string, keyStore bccsp.KeyStore) (bccsp.BCCSP, error) + func NewDefaultSecurityLevel(keyStorePath string) (bccsp.BCCSP, error) + func NewDefaultSecurityLevelWithKeystore(keyStore bccsp.KeyStore) (bccsp.BCCSP, error) + func NewDummyKeyStore() bccsp.KeyStore + func NewFileBasedKeyStore(pwd []byte, path string, readOnly bool) (bccsp.KeyStore, error) + func ParseSm2Certificate2X509(sm2Cert *x509GM.Certificate) *x509.Certificate + func ParseSm2CertificateRequest2X509(sm2req *x509GM.CertificateRequest) *x509.CertificateRequest + func ParseX509Certificate2Sm2(x509Cert *x509.Certificate) *x509GM.Certificate + func ParseX509CertificateRequest2Sm2(x509req *x509.CertificateRequest) *x509GM.CertificateRequest + func SM4Decrypt(key, src []byte) ([]byte, error) + func SM4Encrypt(key, src []byte) ([]byte, error) + func SignatureToLowS(k *ecdsa.PublicKey, signature []byte) ([]byte, error) + func ToLowS(k *ecdsa.PublicKey, s *big.Int) (*big.Int, bool, error) + func UnmarshalSM2Signature(raw []byte) (*big.Int, *big.Int, error) + type Decryptor interface + Decrypt func(k bccsp.Key, ciphertext []byte, opts bccsp.DecrypterOpts) (plaintext []byte, err error) + type Encryptor interface + Encrypt func(k bccsp.Key, plaintext []byte, opts bccsp.EncrypterOpts) (ciphertext []byte, err error) + type Hasher interface + GetHash func(opts bccsp.HashOpts) (h hash.Hash, err error) + Hash func(msg []byte, opts bccsp.HashOpts) (hash []byte, err error) + type KeyDeriver interface + KeyDeriv func(k bccsp.Key, opts bccsp.KeyDerivOpts) (dk bccsp.Key, err error) + type KeyGenerator interface + KeyGen func(opts bccsp.KeyGenOpts) (k bccsp.Key, err error) + type KeyImporter interface + KeyImport func(raw interface{}, opts bccsp.KeyImportOpts) (k bccsp.Key, err error) + type SM2Signature struct + R *big.Int + S *big.Int + type Signer interface + Sign func(k bccsp.Key, digest []byte, opts bccsp.SignerOpts) (signature []byte, err error) + type Verifier interface + Verify func(k bccsp.Key, signature, digest []byte, opts bccsp.SignerOpts) (valid bool, err error)