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
- type Ratchet
- func (r *Ratchet) Decrypt(ciphertext []byte) ([]byte, error)
- func (r *Ratchet) DecryptFirst(ciphertext []byte, ourRatchetPrivate *[32]byte) ([]byte, error)
- func (r *Ratchet) Encrypt(out, msg []byte) []byte
- func (r *Ratchet) EncryptFirst(out, msg []byte, theirRatchetPublic *[32]byte) []byte
- func (r *Ratchet) FillFromFace(that RatchetStateFace) *Ratchet
- func (r *Ratchet) FlushSavedKeys(now time.Time, lifetime time.Duration)
- func (r *Ratchet) GetNextRecvHeaderKey() *proto.Byte32
- func (r *Ratchet) GetNextSendHeaderKey() *proto.Byte32
- func (r *Ratchet) GetOurAuthPrivate() *proto.Byte32
- func (r *Ratchet) GetOurRatchetPrivate() *proto.Byte32
- func (r *Ratchet) GetPrevAuthPrivate() *proto.Byte32
- func (r *Ratchet) GetPrevSendCount() uint32
- func (r *Ratchet) GetRatchet() bool
- func (r *Ratchet) GetRecvChainKey() *proto.Byte32
- func (r *Ratchet) GetRecvCount() uint32
- func (r *Ratchet) GetRecvHeaderKey() *proto.Byte32
- func (r *Ratchet) GetRootKey() *proto.Byte32
- func (r *Ratchet) GetSavedKeys() []RatchetState_SavedKeys
- func (r *Ratchet) GetSendChainKey() *proto.Byte32
- func (r *Ratchet) GetSendCount() uint32
- func (r *Ratchet) GetSendHeaderKey() *proto.Byte32
- func (r *Ratchet) GetTheirAuthPublic() *proto.Byte32
- func (r *Ratchet) GetTheirRatchetPublic() *proto.Byte32
- func (r *Ratchet) Marshal() ([]byte, error)
- func (r *Ratchet) MarshalTo(out []byte) (int, error)
- func (r *Ratchet) Proto() protobuf.Message
- func (r *Ratchet) Unmarshal(data []byte) error
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) DecryptFirst ¶
func (*Ratchet) Encrypt ¶
Encrypt acts like append() but appends an encrypted and authenticated version of msg to out.
func (*Ratchet) EncryptFirst ¶
func (*Ratchet) FillFromFace ¶
func (*Ratchet) FlushSavedKeys ¶
func (*Ratchet) GetNextRecvHeaderKey ¶
func (*Ratchet) GetNextSendHeaderKey ¶
func (*Ratchet) GetOurAuthPrivate ¶
func (*Ratchet) GetOurRatchetPrivate ¶
func (*Ratchet) GetPrevAuthPrivate ¶
func (*Ratchet) GetPrevSendCount ¶
func (*Ratchet) GetRatchet ¶
func (*Ratchet) GetRecvChainKey ¶
func (*Ratchet) GetRecvCount ¶
func (*Ratchet) GetRecvHeaderKey ¶
func (*Ratchet) GetRootKey ¶
func (*Ratchet) GetSavedKeys ¶
func (r *Ratchet) GetSavedKeys() []RatchetState_SavedKeys
func (*Ratchet) GetSendChainKey ¶
func (*Ratchet) GetSendCount ¶
func (*Ratchet) GetSendHeaderKey ¶
func (*Ratchet) GetTheirAuthPublic ¶
func (*Ratchet) GetTheirRatchetPublic ¶
Click to show internal directories.
Click to hide internal directories.