secretstream

package module
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 8 Imported by: 5

README

secretstream

Implementation of libsodium's secretstream in Go

The main goal of this project is allow using secretstream between programs using libsodium and programs written in Go without resorting to wrapping libsodium in Go. golang.org/x/crypto has all necessary algorithms to make that happen.

Testing against libsodium

It is important that this implementation is compatible with libsodium. Tests tagged with compat_test use libsodium to test compatibility.

make sure you have libsodium installed and ready to be used

$ sudo apt install libsodium libsodium-dev

other platforms something similar

You're ready to run tests!

$ go test --tags=compat_test ./...

Documentation

Index

Constants

View Source
const (
	TagMessage = 0
	TagPush    = 0x01
	TagRekey   = 0x02
	TagFinal   = TagPush | TagRekey

	StreamKeyBytes    = chacha20poly1305.KeySize
	StreamHeaderBytes = chacha20poly1305.NonceSizeX
	StreamABytes      = 16 + 1
)

public constants

Variables

This section is empty.

Functions

func NewStreamKey

func NewStreamKey() ([]byte, error)

Types

type Decryptor

type Decryptor interface {
	Pull(m []byte) ([]byte, byte, error)
}

func NewDecryptor

func NewDecryptor(key, header []byte) (Decryptor, error)

type Encryptor

type Encryptor interface {
	Push(m []byte, tag byte) ([]byte, error)
}

func NewEncryptor

func NewEncryptor(key []byte) (Encryptor, []byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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