DoubleRatchet

package
v0.0.0-...-1dd84db Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DHRatchetX25519

func DHRatchetX25519(
	rootKey []byte,
	publicKey *ed25519.PublicKey,
	privateKey *ed25519.PrivateKey,
	info []byte,
	length int,
	hashString string) (
	nextRootKey []byte,
	nextChainKey []byte,
	returnError error)

DHRatchetX25519 creates the next root key and chain key. For the DH element X25519 is used.

You need to provide the current root key and the public and private component for the DH element. You should also provide the length of all keys. Length will be 32 if you provide 0, hashstring will be SHA512 if you provide "".

Info is set to an application-specific byte sequence distinct from other uses of HKDF in the application.

The function returns the root key, chain key and an error which is nil if everything went correctly.

func MessageKey

func MessageKey(
	chainKey []byte,
	length int,
	info []byte,
	hashString string) (
	nextMessageKey []byte,
	nextChainKey []byte,
	returnError error)

MessageKey creates the next message key in a chain.

You need to provide the current chain key and the length it is supposed to have. Length will be 32 if you provide 0, hashstring will be SHA512 if you provide "".

Info is set to an application-specific byte sequence distinct from other uses of HKDF in the application.

It returns the message key which has 2.5 times the length (e.g. if len(chainKey) = 32, len(messageKey) = 80), the next chain key and an error which is nil if nothing bad happened.

Types

This section is empty.

Jump to

Keyboard shortcuts

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