message

package
v1.5.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package message used as a storage and loading of encrypted messages.

The package allows initializing verification of the correctness of the message by the hash length and proof of work.

Index

Constants

View Source
const (
	CSeparator = "@"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IMessage

type IMessage interface {
	types.IConverter

	IsValid(ISettings) bool
	GetPubKey() []byte  // Public key of the sender.
	GetEncKey() []byte  // One-time key of encryption data.
	GetSalt() []byte    // Random bytes for hide data of the hash.
	GetHash() []byte    // Hash of the (sender + receiver + payload).
	GetSign() []byte    // Sign of the hash.
	GetPayload() []byte // Main data in the ecnrypted bytes format.
}

func LoadMessage

func LoadMessage(psett ISettings, pMsg interface{}) (IMessage, error)

Message can be created only with client module.

type ISettings added in v1.5.7

type ISettings interface {
	GetKeySizeBits() uint64
	GetMessageSizeBytes() uint64
}

func NewSettings added in v1.5.7

func NewSettings(pSett *SSettings) ISettings

type SMessage

type SMessage struct {
	FPubKey  string `json:"pubk"`
	FEncKey  string `json:"enck"`
	FSalt    string `json:"salt"`
	FHash    string `json:"hash"`
	FSign    string `json:"sign"`
	FPayload []byte `json:"-"`
}

Basic structure of transport package.

func (*SMessage) GetEncKey added in v1.5.22

func (p *SMessage) GetEncKey() []byte

func (*SMessage) GetHash added in v1.5.22

func (p *SMessage) GetHash() []byte

func (*SMessage) GetPayload added in v1.5.21

func (p *SMessage) GetPayload() []byte

func (*SMessage) GetPubKey added in v1.5.22

func (p *SMessage) GetPubKey() []byte

func (*SMessage) GetSalt added in v1.5.22

func (p *SMessage) GetSalt() []byte

func (*SMessage) GetSign added in v1.5.22

func (p *SMessage) GetSign() []byte

func (*SMessage) IsValid

func (p *SMessage) IsValid(psett ISettings) bool

func (*SMessage) ToBytes added in v1.5.6

func (p *SMessage) ToBytes() []byte

func (*SMessage) ToString added in v1.5.14

func (p *SMessage) ToString() string

type SSettings added in v1.5.7

type SSettings sSettings

Jump to

Keyboard shortcuts

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