crypto

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginName crypto
	PluginName = "crypto"
)

Variables

This section is empty.

Functions

func RegisterCrypto

func RegisterCrypto(name string, crypto Crypto)

RegisterCrypto register crypto

Types

type Config

type Config struct {
	Entries []ConfigEntry `yaml:"entries"`
}

Config crypto filter config

func (*Config) SetDefault

func (c *Config) SetDefault()

SetDefault set default config.configFilter

func (*Config) Verify

func (c *Config) Verify() error

Verify verify config.configFilter

type ConfigEntry

type ConfigEntry struct {
	Name   string                 `yaml:"name"`
	Option map[string]interface{} `yaml:"option"`
}

ConfigEntry config entry

type Crypto

type Crypto interface {
	GenerateKey() ([]byte, error)
	Encrypt(plaintext string, key []byte) (cryptotext string, err error)
	Decrypt(cryptotext string, key []byte) (string, error)
}

Crypto Crypto interface

type CryptoFilter

type CryptoFilter struct {
	*plugin.PluginBase
	// contains filtered or unexported fields
}

CryptoFilter crypto filter plugin

func (*CryptoFilter) Destroy

func (c *CryptoFilter) Destroy() error

Destroy plugin

func (*CryptoFilter) DoFilter

DoFilter do crypto filter

func (*CryptoFilter) GetCrypto

func (c *CryptoFilter) GetCrypto(algo string) (Crypto, error)

GetCrypto get crypto by algorithm

func (*CryptoFilter) Init

func (c *CryptoFilter) Init(ctx *plugin.InitContext) error

Init plugin

func (*CryptoFilter) IsEnable

func (c *CryptoFilter) IsEnable(cfg config.Configuration) bool

IsEnable enable

func (*CryptoFilter) Name

func (c *CryptoFilter) Name() string

Name plugin name

func (*CryptoFilter) Type

func (c *CryptoFilter) Type() common.Type

Type plugin type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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