Documentation ¶
Index ¶
- Constants
- 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
- 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
- type DigestContext
- type Engine
- 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
- type PkeyCtxParams
- type PrivateKey
- 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
- 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
- type SSLContext
Constants ¶
View Source
const ( EC = "EC" RSA = "RSA" DSA = "DSA" DH = "DH" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
func NewCertificateFromPEM ¶
func NewCertificateFromPEM(pem string, pass string) (*Certificate, error)
func (*Certificate) CheckPrivateKey ¶
func (cert *Certificate) CheckPrivateKey(skey *PrivateKey) error
func (*Certificate) GetIssuer ¶
func (cert *Certificate) GetIssuer() (string, error)
func (*Certificate) GetPublicKey ¶
func (cert *Certificate) GetPublicKey() (*PublicKey, error)
func (*Certificate) GetSerialNumber ¶
func (cert *Certificate) GetSerialNumber() (string, error)
func (*Certificate) GetSubject ¶
func (cert *Certificate) GetSubject() (string, error)
func (*Certificate) GetText ¶
func (cert *Certificate) GetText() (string, error)
type CipherContext ¶
type CipherContext struct {
// contains filtered or unexported fields
}
func NewCipherContext ¶
func NewCipherContext(name string, key, iv []byte, encrypt bool) ( *CipherContext, error)
func (*CipherContext) Final ¶
func (ctx *CipherContext) Final() ([]byte, error)
func (*CipherContext) Update ¶
func (ctx *CipherContext) Update(in []byte) ([]byte, error)
type DigestContext ¶
type DigestContext struct {
// contains filtered or unexported fields
}
func NewDigestContext ¶
func NewDigestContext(name string) (*DigestContext, error)
func (*DigestContext) Final ¶
func (ctx *DigestContext) Final() ([]byte, error)
func (*DigestContext) Reset ¶
func (ctx *DigestContext) Reset() error
func (*DigestContext) Update ¶
func (ctx *DigestContext) Update(data []byte) error
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) GetPrivateKey ¶
func (e *Engine) GetPrivateKey(id string, pass string) (*PrivateKey, error)
func (*Engine) GetPublicKey ¶
type HMACContext ¶
type HMACContext struct {
// contains filtered or unexported fields
}
func NewHMACContext ¶
func NewHMACContext(name string, key []byte) ( *HMACContext, error)
func (*HMACContext) Final ¶
func (ctx *HMACContext) Final() ([]byte, error)
func (*HMACContext) Reset ¶
func (ctx *HMACContext) Reset() error
func (*HMACContext) Update ¶
func (ctx *HMACContext) Update(data []byte) error
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func GeneratePrivateKey ¶
func GeneratePrivateKey(alg string, params *PkeyCtxParams, eng *Engine) (*PrivateKey, error)
func NewPrivateKeyFromPEM ¶
func NewPrivateKeyFromPEM(pem string, pass string) (*PrivateKey, error)
func (*PrivateKey) ComputeSM2IDDigest ¶
func (sk *PrivateKey) ComputeSM2IDDigest(id string) ([]byte, error)
func (*PrivateKey) Decrypt ¶
func (*PrivateKey) DeriveKey ¶
func (*PrivateKey) Free ¶ added in v2.3.0
func (sk *PrivateKey) Free()
func (*PrivateKey) GetPEM ¶
func (sk *PrivateKey) GetPEM(cipher string, pass string) (string, error)
func (*PrivateKey) GetPublicKeyPEM ¶
func (sk *PrivateKey) GetPublicKeyPEM() (string, error)
func (*PrivateKey) GetText ¶
func (sk *PrivateKey) GetText() (string, error)
func (*PrivateKey) GetUnencryptedPEM ¶
func (sk *PrivateKey) GetUnencryptedPEM() (string, error)
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func (*PublicKey) ComputeSM2IDDigest ¶
func (*PublicKey) Encrypt ¶
type SSLConnection ¶
type SSLConnection struct {
// contains filtered or unexported fields
}
func (*SSLConnection) GetPeerCertificate ¶
func (conn *SSLConnection) GetPeerCertificate() (*Certificate, error)
func (*SSLConnection) GetVerifyResult ¶
func (conn *SSLConnection) GetVerifyResult() (int64, error)
func (*SSLConnection) Read ¶
func (conn *SSLConnection) Read(nbytes int) ([]byte, error)
func (*SSLConnection) Write ¶
func (conn *SSLConnection) Write(data []byte) (int, error)
type SSLContext ¶
type SSLContext struct {
// contains filtered or unexported fields
}
func NewSSLContext ¶
func NewSSLContext(protocol_version, ca_certs, client_certs string) (*SSLContext, error)
func (*SSLContext) Connect ¶
func (ctx *SSLContext) Connect(hostname, port, ciphers string) (*SSLConnection, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.