nacl

package
v0.0.0-...-a7f001f Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const EncryptOverhead = 40
View Source
const SignatureOverhead = 64

Variables

View Source
var ErrDecrypt = errors.New("failed to decrypt")
View Source
var ErrOpen = errors.New("failed to open")

Functions

func Open

func Open(out, ciphertext []byte, senderPubKey, recipientPrivKey *Key) (plaintext []byte, err error)

func Seal

func Seal(out, plaintext []byte, recipientPubKey, senderPrivKey *Key, rand io.Reader) (ciphertext []byte, err error)

Types

type Key

type Key struct {
	PrivKey *[32]byte
	PubKey  *[32]byte
}

func New

func New(rand io.Reader) *Key

func PrivKey

func PrivKey(b []byte) *Key

func PubKey

func PubKey(b []byte) *Key

func (*Key) Bytes

func (key *Key) Bytes() []byte

func (*Key) Decrypt

func (key *Key) Decrypt(out, ciphertext []byte) (plaintext []byte, err error)

func (*Key) Encrypt

func (key *Key) Encrypt(out, plaintext []byte, rand io.Reader) (ciphertext []byte, err error)

func (*Key) Sign

func (priv *Key) Sign(out, message []byte) (sig []byte)

func (*Key) Verify

func (pub *Key) Verify(message, sig []byte) bool

Jump to

Keyboard shortcuts

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