secureconn

package module
v0.0.0-...-e22bf32 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 14 Imported by: 0

README

secureconn

Build

This is a basic https-like implementation using box.

Basic meaning that we have a concept of a client and server that have a secure session. A handshake is performed in which they trade public keys and begin a session. This utilizes public key encryption in that the sender uses the receiver's public key to encrypt the message. The receiver decrpyts the message with their corresponding private key.

Quickstart (demo)

To use this:

$ git clone https://github.com/prologic/secureconn
$ go build ./cmd/echo/...

First, start the server:

$ ./echo -s [-p <port>]

Next, connect as a client:

$ ./echo [-p <port>]

Quickstart (library)

Coming soon...

Licene

secureconn is licensed under the terms of the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthSigMessage

func NewAuthSigMessage(key ed25519.PublicKey, sig []byte) *authSigMessage

func Parallel

func Parallel(fns ...func())

Types

type SecureConnection

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

Implements net.Conn

func NewSecureConnection

func NewSecureConnection(conn io.ReadWriteCloser, locPrivKey ed25519.PrivateKey) (*SecureConnection, error)

Performs handshake and returns a new authenticated SecureConnection. Returns nil if error in handshake. Caller should call conn.Close()

func (*SecureConnection) Close

func (sc *SecureConnection) Close() error

Implements net.Conn

func (*SecureConnection) LocalAddr

func (sc *SecureConnection) LocalAddr() net.Addr

func (*SecureConnection) Read

func (sc *SecureConnection) Read(data []byte) (n int, err error)

CONTRACT: data smaller than dataMaxSize is read atomically.

func (*SecureConnection) RemoteAddr

func (sc *SecureConnection) RemoteAddr() net.Addr

func (*SecureConnection) RemotePubKey

func (sc *SecureConnection) RemotePubKey() ed25519.PublicKey

Returns authenticated remote pubkey

func (*SecureConnection) SetDeadline

func (sc *SecureConnection) SetDeadline(t time.Time) error

func (*SecureConnection) SetReadDeadline

func (sc *SecureConnection) SetReadDeadline(t time.Time) error

func (*SecureConnection) SetWriteDeadline

func (sc *SecureConnection) SetWriteDeadline(t time.Time) error

func (*SecureConnection) Write

func (sc *SecureConnection) Write(data []byte) (n int, err error)

Writes encrypted frames of `sealedFrameSize` CONTRACT: data smaller than dataMaxSize is read atomically.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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