ratchet

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2015 License: BSD-3-Clause Imports: 13 Imported by: 4

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 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 *pond.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 *pond.KeyExchange) error

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

func (*Ratchet) GetKXPrivateForTransition

func (r *Ratchet) GetKXPrivateForTransition() [32]byte

GetKXPrivateForTransition returns the DH private key used in the key exchange. This exists in order to support the transition to the new ratchet format.

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

Jump to

Keyboard shortcuts

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