header

package
v0.0.0-...-4d93f28 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Size int = 2 // size of the header in bytes

	EncryptionMethod_RSA_2048_with_AES_256_CBC byte = 0x01
)

Variables

View Source
var SupportedEncryptionMethods = []byte{EncryptionMethod_RSA_2048_with_AES_256_CBC}

Functions

This section is empty.

Types

type Header struct {
	Version          uint8
	IsRequest        bool
	EncryptionMethod byte
}

func Decode

func Decode(data []byte) (Header, error)

Converts the inputted byte slice to a header if properly formatted. Otherwise we will return an error. The function will check the version strictly, meaning that if it does not match exactly we will return an error.

func (*Header) Encode

func (header *Header) Encode() ([]byte, error)

Encodes the header struct into a byte slice. If the header version specified is larger than the one specified in the source return an error. Checks that the encryption method is supported as well otherwise return an error.

Jump to

Keyboard shortcuts

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