Versions in this module Expand all Collapse all v2 v2.3.3 Oct 19, 2023 Changes in this version + const DH + const DSA + const EC + const RSA + func GenerateRandom(length int) ([]byte, error) + func GetCipherBlockLength(name string) (int, error) + func GetCipherIVLength(name string) (int, error) + func GetCipherKeyLength(name string) (int, error) + func GetCipherNames() []string + func GetDeriveKeyAlgorithmNames(pkey string) ([]string, error) + func GetDigestBlockSize(name string) (int, error) + func GetDigestLength(name string) (int, error) + func GetDigestNames() []string + func GetEngineNames() []string + func GetErrors() error + func GetMacLength(name string) (int, error) + func GetPublicKeyAlgorithmNames() []string + func GetPublicKeyEncryptionNames(pkey string) ([]string, error) + func GetSignAlgorithmNames(pkey string) ([]string, error) + func GetVersions() []string + func SeedRandom(seed []byte) error + type Certificate struct + func NewCertificateFromPEM(pem string, pass string) (*Certificate, error) + func (cert *Certificate) CheckPrivateKey(skey *PrivateKey) error + func (cert *Certificate) GetIssuer() (string, error) + func (cert *Certificate) GetPublicKey() (*PublicKey, error) + func (cert *Certificate) GetSerialNumber() (string, error) + func (cert *Certificate) GetSubject() (string, error) + func (cert *Certificate) GetText() (string, error) + type CipherContext struct + func NewCipherContext(name string, key, iv []byte, encrypt bool) (*CipherContext, error) + func (ctx *CipherContext) Final() ([]byte, error) + func (ctx *CipherContext) Update(in []byte) ([]byte, error) + type DigestContext struct + func NewDigestContext(name string) (*DigestContext, error) + func (ctx *DigestContext) Final() ([]byte, error) + func (ctx *DigestContext) Reset() error + func (ctx *DigestContext) Update(data []byte) error + type Engine struct + func NewEngineByName(name string) (*Engine, error) + func (e *Engine) GetCommands() ([]string, error) + func (e *Engine) GetPrivateKey(id string, pass string) (*PrivateKey, error) + func (e *Engine) GetPublicKey(id string, pass string) (*PublicKey, error) + func (e *Engine) LoadConfigFile(path string) error + func (e *Engine) RunCommand(name, arg string) error + type HMACContext struct + func NewHMACContext(name string, key []byte) (*HMACContext, error) + func (ctx *HMACContext) Final() ([]byte, error) + func (ctx *HMACContext) Reset() error + func (ctx *HMACContext) Update(data []byte) error + type PkeyCtxParams struct + Keys []string + Values []string + type PrivateKey struct + func GeneratePrivateKey(alg string, params *PkeyCtxParams, eng *Engine) (*PrivateKey, error) + func NewPrivateKeyFromPEM(pem string, pass string) (*PrivateKey, error) + func (sk *PrivateKey) ComputeSM2IDDigest(id string) ([]byte, error) + func (sk *PrivateKey) Decrypt(alg string, in []byte, eng *Engine) ([]byte, error) + func (sk *PrivateKey) DeriveKey(alg string, peer PublicKey, eng *Engine) ([]byte, error) + func (sk *PrivateKey) Free() + func (sk *PrivateKey) GetPEM(cipher string, pass string) (string, error) + func (sk *PrivateKey) GetPublicKeyPEM() (string, error) + func (sk *PrivateKey) GetText() (string, error) + func (sk *PrivateKey) GetUnencryptedPEM() (string, error) + func (sk *PrivateKey) Sign(alg string, dgst []byte, eng *Engine) ([]byte, error) + type PublicKey struct + func NewPublicKeyFromPEM(pem string) (*PublicKey, error) + func (pk *PublicKey) ComputeSM2IDDigest(id string) ([]byte, error) + func (pk *PublicKey) Encrypt(alg string, in []byte, eng *Engine) ([]byte, error) + func (pk *PublicKey) Free() + func (pk *PublicKey) GetPEM() (string, error) + func (pk *PublicKey) GetText() (string, error) + func (pk *PublicKey) Verify(alg string, dgst, sig []byte, eng *Engine) error + type SSLConnection struct + func (conn *SSLConnection) GetPeerCertificate() (*Certificate, error) + func (conn *SSLConnection) GetVerifyResult() (int64, error) + func (conn *SSLConnection) Read(nbytes int) ([]byte, error) + func (conn *SSLConnection) Write(data []byte) (int, error) + type SSLContext struct + func NewSSLContext(protocol_version, ca_certs, client_certs string) (*SSLContext, error) + func (ctx *SSLContext) Connect(hostname, port, ciphers string) (*SSLConnection, error)