crypto

package module
v0.0.0-...-06e150c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongHolder = errors.New("wrong holder")

Functions

func CountedNonce

func CountedNonce(nonce []byte, counter uint64) []byte

Types

type AsymKey

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

func NewKeyPair

func NewKeyPair() *AsymKey

func NewKeyPairFromPrivateHex

func NewKeyPairFromPrivateHex(hex string) (*AsymKey, error)

func (*AsymKey) OpenSymKey

func (akey *AsymKey) OpenSymKey(sealed string) (*Key, error)

func (*AsymKey) PrivateHex

func (akey *AsymKey) PrivateHex() string

func (*AsymKey) PublicHex

func (akey *AsymKey) PublicHex() string

func (*AsymKey) SealSymKey

func (akey *AsymKey) SealSymKey(symkey *Key) (string, error)

func (*AsymKey) VerboseHex

func (akey *AsymKey) VerboseHex() string

type Key

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

func NewKey

func NewKey() (*Key, error)

func NewKeyFromBytes

func NewKeyFromBytes(keybytes []byte) (*Key, error)

func NewKeyFromHex

func NewKeyFromHex(hexstring string) (*Key, error)

func (*Key) ChachaOpen

func (key *Key) ChachaOpen(cipher []byte) ([]byte, error)

ChachaOpen is a variant using `ChachaOpenFromReader` that takes a slice of bytes instead of an io.Reader

func (*Key) ChachaOpenFromReader

func (key *Key) ChachaOpenFromReader(cipherReader io.Reader, plainWriter io.Writer) error

func (*Key) ChachaSeal

func (key *Key) ChachaSeal(plain []byte) ([]byte, error)

func (*Key) ChachaSealFromReader

func (key *Key) ChachaSealFromReader(plainReader io.Reader, cipherWriter io.Writer) (int64, error)

ChachaSealFromReader reads plain text from an io.Reader and writes authenticated and encrypted data into an io.Writer. The sealing is done in chunks of `chunkSize` bytes. Every such chunk is preceded by 64bit big endian encoded size of the cipher text and a nonce used for that chunk. Following the final chunk a 64bit zero is written to denote the end of the cipher text.

func (*Key) Hex

func (key *Key) Hex() string

Jump to

Keyboard shortcuts

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