tribecrypto

package
v0.0.0-...-52bbd4c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthOpen

func AuthOpen(bytesBox []byte, otherPK *AnonymPublicKey, mySK *AnonymPrivateKey) ([]byte, bool)

AuthOpen is the authenticated version of AnonymBoxer.Open

func AuthSeal

func AuthSeal(message []byte, otherPK *AnonymPublicKey, mySK *AnonymPrivateKey) ([]byte, error)

AuthSeal is the authenticated version of AnonymBoxer.Seal

Types

type AnonymBoxer

type AnonymBoxer struct {
	PublicKey  AnonymPublicKey
	PrivateKey AnonymPrivateKey
}

AnonymBoxer is a helper type for handling nacl boxes

func (AnonymBoxer) Open

func (boxer AnonymBoxer) Open(ct []byte) ([]byte, error)

Open decrypts the provided cipher text

func (AnonymBoxer) Seal

func (boxer AnonymBoxer) Seal(m []byte) ([]byte, error)

Seal encrypts te provided bytes

type AnonymPrivateKey

type AnonymPrivateKey struct {
	Value [32]byte
}

AnonymPrivateKey is the private key part of an anonym boxer

type AnonymPublicKey

type AnonymPublicKey struct {
	Value [32]byte
}

AnonymPublicKey is the public key part of an anonym boxer

func (AnonymPublicKey) Seal

func (pk AnonymPublicKey) Seal(m []byte) ([]byte, error)

Seal encrypts the provided bytes

type FileBoxer

type FileBoxer struct {
	Key [32]byte `json:"key"`
}

FileBoxer is a stream cipher for encrypting huge files

func (*FileBoxer) Open

func (boxer *FileBoxer) Open(reader io.Reader, out io.Writer) error

Open decrypts the provided cipher text

func (*FileBoxer) Seal

func (boxer *FileBoxer) Seal(reader io.Reader) (io.Reader, error)

Seal encrypts the contents of a file

type SymmetricKey

type SymmetricKey struct {
	Key [32]byte  `json:"key"`
	RNG io.Reader `json:"-"`
}

SymmetricKey is a helper struct for handling nacl.secretbox

func DecodeSymmetricKey

func DecodeSymmetricKey(data []byte) (*SymmetricKey, error)

DecodeSymmetricKey decodes and returns an encoded SymmetricKey

func (*SymmetricKey) BoxOpen

func (k *SymmetricKey) BoxOpen(bytesBox []byte) ([]byte, bool)

BoxOpen decrypts the provided cipher text

func (*SymmetricKey) BoxSeal

func (k *SymmetricKey) BoxSeal(message []byte) []byte

BoxSeal encrypts the provided message

func (*SymmetricKey) Encode

func (k *SymmetricKey) Encode() ([]byte, error)

Encode encodes the secret key

Jump to

Keyboard shortcuts

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