sec

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptionModule

type EncryptionModule struct {
	PrivateKey *dhkx.DHKey
	// contains filtered or unexported fields
}

Attached to a host and provides the host with key exchange & symmetric encryption capabilities

func NewEncryptionModule

func NewEncryptionModule() *EncryptionModule

func (*EncryptionModule) CompleteKeyExchange

func (em *EncryptionModule) CompleteKeyExchange(key []byte) error

Marks the completion of the key exchange protocol. When the key exchange handshake is performed, the other host's public key is mixed with the keypair generated via PrepareKeyExchange. This creates a shared secret, passed through a KDF and given to a cipher.

func (*EncryptionModule) Decrypt

Decrypts a ciphertext with the key formed during the key exchange process. If encryption is not enabled, then the data is returned without modification.

func (*EncryptionModule) Encrypt

Encrypt a message with the key formed during the key exchange process. If encryption is not enabled, then the data is returned without modification.

func (*EncryptionModule) FreePrivateKeys

func (em *EncryptionModule) FreePrivateKeys()

Removes references to the keypair, allowing for it to be garbage collected.

func (*EncryptionModule) PrepareKeyExchange

func (em *EncryptionModule) PrepareKeyExchange() error

Creates the host's keypair needed for key exchange.

func (*EncryptionModule) WaitForKeyExchange

func (em *EncryptionModule) WaitForKeyExchange()

Blocks until a key exchange has been completed, resulting in a valid cipher

Jump to

Keyboard shortcuts

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