crypto

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCiphertext = errors.New("invalid ciphertext")

Functions

func StreamAEADConn

func StreamAEADConn(conn net.Conn, opt AEADOption) (net.Conn, error)

func StreamAEADConnOrNot

func StreamAEADConnOrNot(conn net.Conn, opt AEADOption) (net.Conn, error)

func VerifyAEADOption

func VerifyAEADOption(opt AEADOption, allowNone bool) (bool, error)

Types

type AEAD

type AEAD struct {
	cipher.AEAD
}

func NewAEAD

func NewAEAD(security, key, salt string) (*AEAD, error)

NewAEAD supports security "none" | "aes-128-gcm" | "chacha20-poly1305", returns "nil, nil" if security is "none"

func (*AEAD) Clone

func (a *AEAD) Clone() *AEAD

func (*AEAD) Decrypt

func (a *AEAD) Decrypt(ciphertext []byte) ([]byte, error)

func (*AEAD) Encrypt

func (a *AEAD) Encrypt(dst *pool.BufferWriter, plaintext []byte) ([]byte, error)

type AEADOption

type AEADOption struct {
	Cipher string `proxy:"cipher,omitempty"`
	Key    string `proxy:"key,omitempty"`
	Salt   string `proxy:"salt,omitempty"`
}

Jump to

Keyboard shortcuts

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