ratchet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2016 License: ISC Imports: 12 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 {
	Dh  []byte
	Dh1 []byte
}

type Ratchet

type Ratchet struct {
	// MyIdentityPrivate and TheirIdentityPublic contain the primary,
	// curve25519 identity keys. These are pointers because the canonical
	// copies live in the client and Contact structs.
	MyIdentityPrivate, TheirIdentityPublic *[32]byte
	// MySigningPublic and TheirSigningPublic are Ed25519 keys. Again,
	// these are pointers because the canonical versions are kept
	// elsewhere.
	MySigningPublic, TheirSigningPublic *[32]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
	// 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, isV2 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