crypto

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Chacha20poly1305 = chacha20poly1305Aead{}
View Source
var Sha256 = sha256Hash{}

Functions

func GetAuth added in v0.3.3

func GetAuth(password []byte) (*auth, error)

func NewConn

func NewConn(c net.Conn, rnonce, wnonce []byte, rciph, wciph cipher.AEAD) net.Conn

NewConn wraps a stream-oriented net.Conn with cipher.

func NewHandshaker

func NewHandshaker(server bool, hash []byte, password []byte) *encryptedHandshaker

func NewReader

func NewReader(r io.Reader, nonce []byte, aead cipher.AEAD, maxPayloadSize int) *reader

func NewWriter

func NewWriter(w io.Writer, nonce []byte, aead cipher.AEAD, maxPayloadSize int) *writer

Types

type Aead

type Aead interface {
	New([]byte) (cipher.AEAD, error)
	KeySize() int
	NonceSize() int
	Name() []byte
}

type Ed25519

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

func (Ed25519) Sign

func (e Ed25519) Sign(rand io.Reader, digest []byte) (signature []byte, err error)

func (Ed25519) SignatureSize

func (Ed25519) SignatureSize() int

func (Ed25519) Verify

func (e Ed25519) Verify(message, sig []byte) bool

type Handshaker added in v0.3.3

type Handshaker interface {
	Handshake(net.Conn) (net.Conn, error)
	EncodeHeader(Net, *bytes.Buffer, netapi.Address)
	DecodeHeader(net.Conn) (Net, error)
}

type Hash

type Hash interface {
	New() hash.Hash
	Size() int
}

type Net added in v0.3.3

type Net byte
var (
	TCP Net = 66
	UDP Net = 77
)

func (Net) Unknown added in v0.3.3

func (n Net) Unknown() bool

type Signer

type Signer interface {
	Sign(rand io.Reader, digest []byte) (signature []byte, err error)
	SignatureSize() int
	Verify(message, sig []byte) bool
}

func NewEd25519

func NewEd25519(hash Hash, key []byte) Signer

Jump to

Keyboard shortcuts

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