transport

package
v0.0.0-...-9a70a3a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2016 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package transport implements an encrypted and authenticated connection for transferring byte slices over a network. The key-exchange is like SIGMA-I, with the exception that instead of unvirersally verifiable signatures, nacl/box between one party's ephemeral key and the other's long-term key is used for authentication (this provides deniability). Subsequent messages are encrypted using nacl/box with the message counter as an implicit nonce.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is an encrypted and authenticated connection that is NOT concurrency-safe

func Handshake

func Handshake(unencrypted net.Conn, pk, sk, expectedPK *[32]byte, maxFrameSize int) (*Conn, *[32]byte, error)

Handshake establishes an encrypted and authenticated connection. unencrypted is the underlying connection that will be used for the handshake and the following calls to ReadFrame and WriteFrame. The connection should not be used after calling Handshake. pk and sk are the Curve25519 public and private keys of the caller. If expectedPK is not nil, pk will not be revealed to the other party unless they prove that they hold the secret key that corresponds to expectedPK. Note that both sides of a connection using this option will result in a deadlock. The public key of the other party is returned along with the wrapped connection.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ReadFrame

func (c *Conn) ReadFrame(b []byte) (int, error)

ReadFrame(b) reads a single frame into b and returns an integer n such that b[:n] is the frame after possibly modifying b. If b does not have enough space (maxFrameSize bytes), this function may panic.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) WriteFrame

func (c *Conn) WriteFrame(b []byte) (int, error)

WriteFrame(b) writes the frame to the connection in a length-value-encoded for so it can be read using ReadFrame on the other side. Returns len(b).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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