ciphers

package
v0.0.0-...-b428d71 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewShadowConn

func NewShadowConn(conn net.Conn, cipher AEADCipher) net.Conn

Types

type AEADCipher

type AEADCipher interface {
	KeySize() int
	SaltSize() int
	NonceSize() int
	TagSize() int

	// singleton cipher during the whole app lifecycle
	// but salt differs for each connection
	Encrypter(salt []byte) (cipher.AEAD, error)
	Decrypter(salt []byte) (cipher.AEAD, error)

	GenSalt() ([]byte, error)
	GenNonce() []byte
}

func NewAEADCipher

func NewAEADCipher(name, password string) (AEADCipher, error)

type ShadowConn

type ShadowConn struct {
	net.Conn
	// contains filtered or unexported fields
}

ShadowConn is a wrapper around a net.Conn that encrypts/decrypts all data passing through it.

func (*ShadowConn) Read

func (c *ShadowConn) Read(b []byte) (total int, err error)

func (*ShadowConn) Write

func (c *ShadowConn) Write(b []byte) (total int, err error)

Jump to

Keyboard shortcuts

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