ratchet

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: ISC Imports: 14 Imported by: 0

Documentation

Overview

Package ratchet implements the axolotl ratchet, by Trevor Perrin. See https://github.com/trevp/axolotl/wiki.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyExchange

type KeyExchange struct {
	Cipher [sntrup4591761.CiphertextSize]byte
	Public []byte
}

type Ratchet

type Ratchet struct {
	MyPrivateKey        *[sntrup4591761.PrivateKeySize]byte
	MySigningPublic     *[ed25519.PublicKeySize]byte
	TheirIdentityPublic *[sha256.Size]byte
	TheirSigningPublic  *[ed25519.PublicKeySize]byte
	TheirPublicKey      *[sntrup4591761.PublicKeySize]byte

	// Now is an optional function that will be used to get the current
	// time. If nil, time.Now is used.
	Now func() time.Time

	MyHalf    *[32]byte
	TheirHalf *[32]byte
	// contains filtered or unexported fields
}

Ratchet contains the per-contact, crypto state.

func New

func New(rand io.Reader) *Ratchet

func (*Ratchet) CompleteKeyExchange

func (r *Ratchet) CompleteKeyExchange(kx *KeyExchange, alice bool) error

CompleteKeyExchange takes a KeyExchange message from the other party and establishes the ratchet.

func (*Ratchet) Decrypt

func (r *Ratchet) Decrypt(ciphertext []byte) ([]byte, error)

func (*Ratchet) Encrypt

func (r *Ratchet) Encrypt(out, msg []byte) []byte

Encrypt acts like append() but appends an encrypted version of msg to out.

func (*Ratchet) FillKeyExchange

func (r *Ratchet) FillKeyExchange(kx *KeyExchange) error

FillKeyExchange sets elements of kx with key exchange information from the ratchet.

func (*Ratchet) Marshal

func (r *Ratchet) Marshal(now time.Time, lifetime time.Duration) *disk.RatchetState

func (*Ratchet) Unmarshal

func (r *Ratchet) Unmarshal(s *disk.RatchetState) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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