crypto

package
Version: v0.0.0-...-ff5f600 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoxKey

type BoxKey [32]byte

type ControlCipher

type ControlCipher interface {
	// MACSize returns the number of bytes in the MAC.
	MACSize() int

	// Seal replaces the message with an authenticated and encrypted version.
	// The trailing MACSize bytes of the data are used for the MAC; they are
	// discarded and overwritten.
	Seal(data []byte) error

	// Open authenticates and decrypts a box produced by Seal.  The trailing
	// MACSize bytes are not changed.  Returns true on success.
	Open(data []byte) bool

	// Encrypt encrypts the data in place.  No MAC is added.
	Encrypt(data []byte)

	// Decrypt decrypts the data in place.  No MAC is verified.
	Decrypt(data []byte)

	// ChannelBinding Returns a byte slice that is unique for the the
	// particular cipher (and the parties between which it is operating).
	// Having both parties assert out of the band that they are indeed
	// participating in a connection with that channel binding value is
	// sufficient to authenticate the data received through the cipher.
	ChannelBinding() []byte
}

ControlCipher provides the ciphers and MAC for control channel encryption. Encryption and decryption are performed in place.

func NewControlCipherRPC11

func NewControlCipherRPC11(myPublicKey, myPrivateKey, theirPublicKey *BoxKey) ControlCipher

NewControlCipher returns a ControlCipher for RPC versions greater than or equal to 11.

func NewDisabledControlCipher

func NewDisabledControlCipher(c ControlCipher) ControlCipher

NewDisabledControlCipher returns a cipher that has the correct MACSize, but encryption and decryption are disabled.

type NullControlCipher

type NullControlCipher struct{}

NullControlCipher is a cipher that does nothing.

func (NullControlCipher) ChannelBinding

func (NullControlCipher) ChannelBinding() []byte

func (NullControlCipher) Decrypt

func (NullControlCipher) Decrypt(data []byte)

func (NullControlCipher) Encrypt

func (NullControlCipher) Encrypt(data []byte)

func (NullControlCipher) MACSize

func (NullControlCipher) MACSize() int

func (NullControlCipher) Open

func (NullControlCipher) Open(data []byte) bool

func (NullControlCipher) Seal

func (NullControlCipher) Seal(data []byte) error

Jump to

Keyboard shortcuts

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