Versions in this module Expand all Collapse all v1 v1.1.0 Oct 19, 2023 Changes in this version type Sm2Key + func (sm2 *Sm2Key) ExportPrivateKeyToDer(pwd []byte) ([]byte, error) + func (sm2 *Sm2Key) ExportPublicKeyToDer() ([]byte, error) + func (sm2 *Sm2Key) ImportPrivateKeyFromDer(prv, pwd []byte) error + func (sm2 *Sm2Key) ImportPublicKeyFromDer(pub []byte) error v1.0.0 Oct 19, 2023 Changes in this version + const GmSSLGoVersion + const Sm2DefaultId + const Sm2MaxCiphertextSize + const Sm2MaxPlaintextSize + const Sm2MaxSignatureSize + const Sm2MinCiphertextSize + const Sm2MinPlaintextSize + const Sm3DigestSize + const Sm3HmacMaxKeySize + const Sm3HmacMinKeySize + const Sm3HmacSize + const Sm3Pbkdf2DefaultSaltSize + const Sm3Pbkdf2MaxIter + const Sm3Pbkdf2MaxKeySize + const Sm3Pbkdf2MaxSaltSize + const Sm3Pbkdf2MinIter + const Sm4BlockSize + const Sm4CbcIvSize + const Sm4CtrIvSize + const Sm4GcmDefaultIvSize + const Sm4GcmDefaultTagSize + const Sm4GcmMaxIvSize + const Sm4GcmMaxTagSize + const Sm4GcmMinIvSize + const Sm4KeySize + const Sm9MaxCiphertextSize + const Sm9MaxIdSize + const Sm9MaxPlaintextSize + const Sm9SignatureSize + const ZucIvSize + const ZucKeySize + func GetGmSSLLibraryVersion() string + func RandBytes(length int) ([]byte, error) + func Sm3Pbkdf2(pass string, salt []byte, iter uint, keylen uint) ([]byte, error) + type Sm2Certificate struct + func ImportSm2CertificatePem(path string) (*Sm2Certificate, error) + func (cert *Sm2Certificate) GetIssuer() ([]byte, map[string]string, error) + func (cert *Sm2Certificate) GetSerialNumber() ([]byte, error) + func (cert *Sm2Certificate) GetSubject() ([]byte, map[string]string, error) + func (cert *Sm2Certificate) GetSubjectPublicKey() (*Sm2Key, error) + func (cert *Sm2Certificate) GetValidity() (time.Time, time.Time, error) + func (cert *Sm2Certificate) VerifyByCaCertificate(ca_cert *Sm2Certificate, sm2_id string) bool + type Sm2Key struct + func GenerateSm2Key() (*Sm2Key, error) + func ImportSm2EncryptedPrivateKeyInfoPem(pass string, path string) (*Sm2Key, error) + func ImportSm2PublicKeyInfoPem(path string) (*Sm2Key, error) + func (sm2 *Sm2Key) ComputeZ(id string) ([]byte, error) + func (sm2 *Sm2Key) Decrypt(in []byte) ([]byte, error) + func (sm2 *Sm2Key) Encrypt(in []byte) ([]byte, error) + func (sm2 *Sm2Key) ExportEncryptedPrivateKeyInfoPem(pass string, path string) error + func (sm2 *Sm2Key) ExportPublicKeyInfoPem(path string) error + func (sm2 *Sm2Key) Sign(dgst []byte) ([]byte, error) + func (sm2 *Sm2Key) Verify(dgst []byte, signature []byte) bool + type Sm2Signature struct + func NewSm2Signature(sm2 *Sm2Key, id string, sign bool) (*Sm2Signature, error) + func (sig *Sm2Signature) Sign() ([]byte, error) + func (sig *Sm2Signature) Update(data []byte) error + func (sig *Sm2Signature) Verify(signature []byte) bool + type Sm3 struct + func NewSm3() *Sm3 + func (sm3 *Sm3) Digest() []byte + func (sm3 *Sm3) Reset() + func (sm3 *Sm3) Update(data []byte) + type Sm3Hmac struct + func NewSm3Hmac(key []byte) (*Sm3Hmac, error) + func (hmac *Sm3Hmac) GenerateMac() []byte + func (hmac *Sm3Hmac) Reset(key []byte) error + func (hmac *Sm3Hmac) Update(data []byte) + type Sm4 struct + func NewSm4(key []byte, encrypt bool) (*Sm4, error) + func (sm4 *Sm4) Encrypt(block []byte) ([]byte, error) + type Sm4Cbc struct + func NewSm4Cbc(key []byte, iv []byte, encrypt bool) (*Sm4Cbc, error) + func (cbc *Sm4Cbc) Finish() ([]byte, error) + func (cbc *Sm4Cbc) Reset(key []byte, iv []byte, encrypt bool) error + func (cbc *Sm4Cbc) Update(data []byte) ([]byte, error) + type Sm4Ctr struct + func NewSm4Ctr(key []byte, iv []byte) (*Sm4Ctr, error) + func (ctr *Sm4Ctr) Finish() ([]byte, error) + func (ctr *Sm4Ctr) Reset(key []byte, iv []byte) error + func (ctr *Sm4Ctr) Update(data []byte) ([]byte, error) + type Sm4Gcm struct + func NewSm4Gcm(key []byte, iv []byte, aad []byte, taglen int, encrypt bool) (*Sm4Gcm, error) + func (gcm *Sm4Gcm) Finish() ([]byte, error) + func (gcm *Sm4Gcm) Reset(key []byte, iv []byte, aad []byte, taglen int, encrypt bool) error + func (gcm *Sm4Gcm) Update(data []byte) ([]byte, error) + type Sm9EncKey struct + func ImportEncryptedSm9EncPrivateKeyInfoPem(path string, pass string, id string) (*Sm9EncKey, error) + func (sm9 *Sm9EncKey) Decrypt(in []byte) ([]byte, error) + func (sm9 *Sm9EncKey) ExportEncryptedPrivateKeyInfoPem(path string, pass string) error + func (sm9 *Sm9EncKey) GetId() string + type Sm9EncMasterKey struct + func GenerateSm9EncMasterKey() (*Sm9EncMasterKey, error) + func ImportEncryptedSm9EncMasterKeyInfoPem(path string, pass string) (*Sm9EncMasterKey, error) + func ImportSm9EncMasterPublicKeyPem(path string) (*Sm9EncMasterKey, error) + func (sm9 *Sm9EncMasterKey) Encrypt(in []byte, to string) ([]byte, error) + func (sm9 *Sm9EncMasterKey) ExportEncryptedMasterKeyInfoPem(path string, pass string) error + func (sm9 *Sm9EncMasterKey) ExportMasterPublicKeyPem(path string) error + func (sm9 *Sm9EncMasterKey) ExtractKey(id string) (*Sm9EncKey, error) + type Sm9SignKey struct + func ImportEncryptedSm9SignPrivateKeyInfoPem(path string, pass string, id string) (*Sm9SignKey, error) + func (sm9 *Sm9SignKey) ExportEncryptedPrivateKeyInfoPem(path string, pass string) error + func (sm9 *Sm9SignKey) GetId() string + type Sm9SignMasterKey struct + func GenerateSm9SignMasterKey() (*Sm9SignMasterKey, error) + func ImportEncryptedSm9SignMasterKeyInfoPem(path string, pass string) (*Sm9SignMasterKey, error) + func ImportSm9SignMasterPublicKeyPem(path string) (*Sm9SignMasterKey, error) + func (sm9 *Sm9SignMasterKey) ExportEncryptedMasterKeyInfoPem(path string, pass string) error + func (sm9 *Sm9SignMasterKey) ExportMasterPublicKeyPem(path string) error + func (sm9 *Sm9SignMasterKey) ExtractKey(id string) (*Sm9SignKey, error) + type Sm9Signature struct + func NewSm9Signature(sign bool) (*Sm9Signature, error) + func (sig *Sm9Signature) Sign(sign_key *Sm9SignKey) ([]byte, error) + func (sig *Sm9Signature) Update(data []byte) error + func (sig *Sm9Signature) Verify(signature []byte, master_public_key *Sm9SignMasterKey, signer_id string) bool + type Zuc struct + func NewZuc(key []byte, iv []byte) (*Zuc, error) + func (zuc *Zuc) Finish() ([]byte, error) + func (zuc *Zuc) Update(in []byte) ([]byte, error)