ratchet

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: 13 Imported by: 0

Documentation

Overview

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

This implementation is designed to be used with asynchronous key exchange. In particular, it is admitted that two separate axolotl sessions may be established between the same two parties, and it is the application's responsibility to close one of them.

The key exchange is assumed to be externally authenticated and no identity key verification (or exchange) is performed.

Index

Constants

View Source
const (

	// Overhead is the total difference between the encrypted and decrypted length
	Overhead      = authSize + sealedHeaderSize + secretbox.Overhead
	OverheadFirst = authSize + handshakePreHeaderSize + sealedHeaderSize + secretbox.Overhead
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ratchet

type Ratchet struct {
	FillAuth  func(tag, data []byte, theirAuthPublic *[32]byte)
	CheckAuth func(tag, data, msg []byte, ourAuthPrivate *[32]byte) error

	Rand io.Reader
	Now  func() time.Time
	// contains filtered or unexported fields
}

func NewRatchetFromFace

func NewRatchetFromFace(that RatchetStateFace) *Ratchet

func (*Ratchet) Decrypt

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

func (*Ratchet) DecryptFirst

func (r *Ratchet) DecryptFirst(ciphertext []byte, ourRatchetPrivate *[32]byte) ([]byte, error)

func (*Ratchet) Encrypt

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

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

func (*Ratchet) EncryptFirst

func (r *Ratchet) EncryptFirst(out, msg []byte, theirRatchetPublic *[32]byte) []byte

func (*Ratchet) FillFromFace

func (r *Ratchet) FillFromFace(that RatchetStateFace) *Ratchet

func (*Ratchet) FlushSavedKeys

func (r *Ratchet) FlushSavedKeys(now time.Time, lifetime time.Duration)

func (*Ratchet) GetNextRecvHeaderKey

func (r *Ratchet) GetNextRecvHeaderKey() *proto.Byte32

func (*Ratchet) GetNextSendHeaderKey

func (r *Ratchet) GetNextSendHeaderKey() *proto.Byte32

func (*Ratchet) GetOurAuthPrivate

func (r *Ratchet) GetOurAuthPrivate() *proto.Byte32

func (*Ratchet) GetOurRatchetPrivate

func (r *Ratchet) GetOurRatchetPrivate() *proto.Byte32

func (*Ratchet) GetPrevAuthPrivate

func (r *Ratchet) GetPrevAuthPrivate() *proto.Byte32

func (*Ratchet) GetPrevSendCount

func (r *Ratchet) GetPrevSendCount() uint32

func (*Ratchet) GetRatchet

func (r *Ratchet) GetRatchet() bool

func (*Ratchet) GetRecvChainKey

func (r *Ratchet) GetRecvChainKey() *proto.Byte32

func (*Ratchet) GetRecvCount

func (r *Ratchet) GetRecvCount() uint32

func (*Ratchet) GetRecvHeaderKey

func (r *Ratchet) GetRecvHeaderKey() *proto.Byte32

func (*Ratchet) GetRootKey

func (r *Ratchet) GetRootKey() *proto.Byte32

func (*Ratchet) GetSavedKeys

func (r *Ratchet) GetSavedKeys() []RatchetState_SavedKeys

func (*Ratchet) GetSendChainKey

func (r *Ratchet) GetSendChainKey() *proto.Byte32

func (*Ratchet) GetSendCount

func (r *Ratchet) GetSendCount() uint32

func (*Ratchet) GetSendHeaderKey

func (r *Ratchet) GetSendHeaderKey() *proto.Byte32

func (*Ratchet) GetTheirAuthPublic

func (r *Ratchet) GetTheirAuthPublic() *proto.Byte32

func (*Ratchet) GetTheirRatchetPublic

func (r *Ratchet) GetTheirRatchetPublic() *proto.Byte32

func (*Ratchet) Marshal

func (r *Ratchet) Marshal() ([]byte, error)

func (*Ratchet) MarshalTo

func (r *Ratchet) MarshalTo(out []byte) (int, error)

func (*Ratchet) Proto

func (r *Ratchet) Proto() protobuf.Message

func (*Ratchet) Unmarshal

func (r *Ratchet) Unmarshal(data []byte) error

Directories

Path Synopsis
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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