initializer

package
v0.0.0-...-767fa57 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusAccept byte = 0
	StatusReject byte = 1
	StatusVerify byte = 2
)

Variables

View Source
var (
	DefaultPrivateKey = ed25519.PrivateKey{
		0xd6, 0x18, 0x85, 0x58, 0x94, 0x12, 0xdf, 0xcb, 0xf5, 0x62, 0x96, 0xc7, 0xe8, 0xb8, 0xf1, 0x6c,
		0xb0, 0xd0, 0x83, 0x3f, 0xc1, 0x3a, 0xe8, 0xed, 0x4d, 0xb9, 0xe6, 0xe3, 0x38, 0xb8, 0xd4, 0x59,
		0x75, 0x5e, 0x48, 0x52, 0xac, 0x37, 0xc6, 0x23, 0xff, 0xab, 0x6c, 0x75, 0x37, 0x2e, 0x7, 0x25,
		0xbe, 0xd5, 0x1a, 0xdb, 0x79, 0x32, 0x92, 0xf7, 0x37, 0xf4, 0xc3, 0xa, 0xf3, 0x73, 0xa4, 0x60,
	}
	DefaultTrustedPublicKey = ed25519.PublicKey(DefaultPrivateKey[32:])
)
View Source
var (
	ServerMagic = helper.HashSalt256(internal.Nonce, []byte("ServerMagic"))
	ClientMagic = helper.HashSalt256(internal.Nonce, []byte("ClientMagic"))
)

Functions

func Authenticate

func Authenticate(rw io.ReadWriter, hash []byte) (err error)

func CheckMagic

func CheckMagic(rw io.ReadWriter, sendMagic, recvMagic []byte) error

func GetAuthenticated

func GetAuthenticated(rw io.ReadWriter, hash []byte) error

func Handshake

func Handshake(rw io.ReadWriter, privateKey ed25519.PrivateKey, trustedPublicKeys []ed25519.PublicKey) ([]byte, error)

Types

type EncryptionLayer

type EncryptionLayer struct {
	io.ReadWriter
	// contains filtered or unexported fields
}

func NewEncryptionLayer

func NewEncryptionLayer(rw io.ReadWriter, secret []byte) (*EncryptionLayer, error)

func (*EncryptionLayer) Read

func (el *EncryptionLayer) Read(p []byte) (n int, err error)

func (*EncryptionLayer) Write

func (el *EncryptionLayer) Write(p []byte) (n int, err error)

type Initializer

type Initializer = func(ctx context.Context, rwc io.ReadWriteCloser) (context.Context, io.ReadWriteCloser, error)

func InitAuthenticate

func InitAuthenticate(hash []byte) Initializer

func InitCheckMagic

func InitCheckMagic(sendMagic, recvMagic []byte) Initializer

func InitEncryption

func InitEncryption(secret []byte) Initializer

func InitGetAuthenticated

func InitGetAuthenticated(hash []byte) Initializer

func InitHandshake

func InitHandshake(privateKey ed25519.PrivateKey, trustedPublicKeys []ed25519.PublicKey) Initializer

Jump to

Keyboard shortcuts

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