message

package
v0.0.0-...-fb2b840 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package message provides a structure for message keys, which are symmetric keys used for the encryption/decryption of Signal messages.

Index

Constants

View Source
const CipherKeyLength = 32

CipherKeyLength is the length of the actual cipher key used for messages.

View Source
const DerivedSecretsSize = 80

DerivedSecretsSize is the size of the derived secrets for message keys.

View Source
const IVLength = 16

IVLength is the length of the initialization vector in bytes.

View Source
const KdfSalt string = "WhisperMessageKeys"

KdfSalt is used as the Salt for message keys to derive secrets using a Key Derivation Function

View Source
const MacKeyLength = 32

MacKeyLength is the length of the message authentication code in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keys

type Keys struct {
	// contains filtered or unexported fields
}

Keys is a structure to hold all the keys for a single MessageKey, including the cipherKey, mac, iv, and index of the chain key. MessageKeys are used to encrypt individual messages.

func NewKeys

func NewKeys(cipherKey, macKey, iv []byte, index uint32) *Keys

NewKeys returns a new message keys structure with the given cipherKey, mac, iv, and index.

func NewKeysFromStruct

func NewKeysFromStruct(structure *KeysStructure) *Keys

NewKeysFromStruct will return a new message keys object from the given serializeable structure.

func (*Keys) CipherKey

func (k *Keys) CipherKey() []byte

CipherKey is the key used to produce ciphertext.

func (*Keys) Index

func (k *Keys) Index() uint32

Index returns the number of times the chain key has been put through a key derivation function to generate this message key.

func (*Keys) Iv

func (k *Keys) Iv() []byte

Iv returns the message keys' initialization vector. The IV is a fixed-size input to a cryptographic primitive.

func (*Keys) MacKey

func (k *Keys) MacKey() []byte

MacKey returns the message's message authentication code.

type KeysStructure

type KeysStructure struct {
	CipherKey []byte
	MacKey    []byte
	IV        []byte
	Index     uint32
}

KeysStructure is a serializeable structure of message keys.

func NewStructFromKeys

func NewStructFromKeys(keys *Keys) *KeysStructure

NewStructFromKeys returns a serializeable structure of message keys.

Jump to

Keyboard shortcuts

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