smarty

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Overview

This file handles reading the smarty telegrams over a serial connection, and splitting in its different tokens using a state machine.

Index

Constants

View Source
const GCMTagLength = 12

Variables

This section is empty.

Functions

func ProcessTelegram

func ProcessTelegram(input []byte) (iv, cipherText []byte)

Types

type CipherForwarder

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

Struct allowing to retrieve smarty telegrams, split into initial value, cipher text and gcm tag

func NewCipherForwarder

func NewCipherForwarder(deviceName string) CipherForwarder

Creation of a new CipherForwarder Parameter: * deviceName: the port to listen to Return: * CipherForwarder: a new object to execute methods on

func (*CipherForwarder) Disconnect

func (cf *CipherForwarder) Disconnect()

Disconnect the serial connection

func (*CipherForwarder) GetTelegram

func (cf *CipherForwarder) GetTelegram() (initialValue, cipherText, gcmTag []byte)

Waits for the next telegram and splits it into its tokens If you are to decrypt this result with the Decryptor, you will have to append the gcm tag to the cipher text! Return: * initialValue: the initial value as specified in the smarty documentation * cipherText: the payload * gcmTag: the aes-gcm tag

type Decryptor

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

Struct allowing simple decryption of existing telegrams

func NewDecryptor

func NewDecryptor(decryptionKey string) Decryptor

Creation of a new Decryptor Parameter: * decryptionKey: your smarty key Return: * Decryptor: a new object to execute methods on

func (Decryptor) Decrypt

func (d Decryptor) Decrypt(initialValue, cipherText []byte) (plainText []byte, ok bool)

Decrypt a smarty telegram Parameter: * initialValue: the initial value as specified in the smarty documentation * cipherText: this expects the payload with appended gcm tag at the end (payload + gcmTag)! Return: * plaintText: the decrypted text * ok: true if the decryption was successful

type OnlineDecryptor

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

Struct allowing live capture of smarty telegrams with decryption

func NewOnlineDecryptor

func NewOnlineDecryptor(deviceName, decryptionKey string) OnlineDecryptor

Creation of a new OnlineDecryptor Parameter: * deviceName: the port to listen to * decryptionKey: your smarty key Return: * OnlineDecryptor: a new object to execute methods on

func (*OnlineDecryptor) Disconnect

func (od *OnlineDecryptor) Disconnect()

Disconnect the serial connection

func (*OnlineDecryptor) GetTelegram

func (od *OnlineDecryptor) GetTelegram() (plainText []byte, ok bool)

Waits for the next telegram and decrypts it Return: * plaintText: the decrypted text * ok: true if the decryption was successful

type Smarty

type Smarty interface {
	Disconnect()
}

type State

type State int

Jump to

Keyboard shortcuts

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