gmssl

package
v2.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EC  = "EC"
	RSA = "RSA"
	DSA = "DSA"
	DH  = "DH"
)

Variables

This section is empty.

Functions

func GenerateRandom

func GenerateRandom(length int) ([]byte, error)

func GetCipherBlockLength

func GetCipherBlockLength(name string) (int, error)

func GetCipherIVLength

func GetCipherIVLength(name string) (int, error)

func GetCipherKeyLength

func GetCipherKeyLength(name string) (int, error)

func GetCipherNames

func GetCipherNames() []string

func GetDeriveKeyAlgorithmNames

func GetDeriveKeyAlgorithmNames(pkey string) ([]string, error)

func GetDigestBlockSize

func GetDigestBlockSize(name string) (int, error)

func GetDigestLength

func GetDigestLength(name string) (int, error)

func GetDigestNames

func GetDigestNames() []string

func GetEngineNames

func GetEngineNames() []string

func GetErrors

func GetErrors() error

func GetMacLength

func GetMacLength(name string) (int, error)

func GetPublicKeyAlgorithmNames

func GetPublicKeyAlgorithmNames() []string

func GetPublicKeyEncryptionNames

func GetPublicKeyEncryptionNames(pkey string) ([]string, error)

func GetSignAlgorithmNames

func GetSignAlgorithmNames(pkey string) ([]string, error)

func GetVersions

func GetVersions() []string

func SeedRandom

func SeedRandom(seed []byte) error

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 NewEngineByName

func NewEngineByName(name string) (*Engine, error)

func (*Engine) GetCommands

func (e *Engine) GetCommands() ([]string, error)

func (*Engine) GetPrivateKey

func (e *Engine) GetPrivateKey(id string, pass string) (*PrivateKey, error)

func (*Engine) GetPublicKey

func (e *Engine) GetPublicKey(id string, pass string) (*PublicKey, error)

func (*Engine) LoadConfigFile

func (e *Engine) LoadConfigFile(path string) error

func (*Engine) RunCommand

func (e *Engine) RunCommand(name, arg string) error

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 PkeyCtxParams

type PkeyCtxParams struct {
	Keys   []string
	Values []string
}

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 (sk *PrivateKey) Decrypt(alg string, in []byte, eng *Engine) ([]byte, error)

func (*PrivateKey) DeriveKey

func (sk *PrivateKey) DeriveKey(alg string, peer PublicKey, eng *Engine) ([]byte, error)

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)

func (*PrivateKey) Sign

func (sk *PrivateKey) Sign(alg string, dgst []byte, eng *Engine) ([]byte, error)

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func NewPublicKeyFromPEM

func NewPublicKeyFromPEM(pem string) (*PublicKey, error)

func (*PublicKey) ComputeSM2IDDigest

func (pk *PublicKey) ComputeSM2IDDigest(id string) ([]byte, error)

func (*PublicKey) Encrypt

func (pk *PublicKey) Encrypt(alg string, in []byte, eng *Engine) ([]byte, error)

func (*PublicKey) Free added in v2.3.0

func (pk *PublicKey) Free()

func (*PublicKey) GetPEM

func (pk *PublicKey) GetPEM() (string, error)

func (*PublicKey) GetText

func (pk *PublicKey) GetText() (string, error)

func (*PublicKey) Verify

func (pk *PublicKey) Verify(alg string, dgst, sig []byte, eng *Engine) error

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL