nacl

package
v0.0.0-...-b588ea4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptoBox

func CryptoBox(msg, nounce, pk, sk []byte) []byte

encrypts a message to a user given their public key is known returns an encrypted box

func CryptoBoxOpen

func CryptoBoxOpen(box, nounce, sk, pk []byte) []byte

open an encrypted box

func CryptoBoxOverhead

func CryptoBoxOverhead() int

return how many bytes overhead does CryptoBox have

func CryptoBoxPrivKeySize

func CryptoBoxPrivKeySize() int

size of crypto_box private keys

func CryptoBoxPubKeySize

func CryptoBoxPubKeySize() int

size of crypto_box public keys

func CryptoSignDetached

func CryptoSignDetached(msg, sk []byte) []byte

sign data detached with secret key sk

func CryptoSignFucky

func CryptoSignFucky(msg, sk []byte) []byte

sign data with secret key sk return detached sig this uses crypto_sign instead pf crypto_sign_detached

func CryptoSignPrivKeySize

func CryptoSignPrivKeySize() int

size of crypto_sign private keys

func CryptoSignPubKeySize

func CryptoSignPubKeySize() int

size of crypto_sign public keys

func CryptoSignPublicLen

func CryptoSignPublicLen() int

func CryptoSignSecretLen

func CryptoSignSecretLen() int

func CryptoSignSeedLen

func CryptoSignSeedLen() int

func CryptoVerify

func CryptoVerify(smsg, pk []byte) bool

verify a signed message

func CryptoVerifyDetached

func CryptoVerifyDetached(msg, sig, pk []byte) bool

verfiy a detached signature return true on valid otherwise false

func CryptoVerifyFucky

func CryptoVerifyFucky(msg, sig, pk []byte) bool

verify a fucky detached sig

func GetBoxPubkey

func GetBoxPubkey(sk []byte) []byte

get public key from secret key

func GetSignPubkey

func GetSignPubkey(sk []byte) []byte

get public key from secret key

func NewBoxNounce

func NewBoxNounce() []byte

generate a new nounce

func RandBytes

func RandBytes(size int) []byte

func TestAll

func TestAll()

test all crypto functions

Types

type Buffer

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

wrapper arround malloc/free

func Malloc

func Malloc(size int) *Buffer

wrapper arround nacl.malloc

func NewBuffer

func NewBuffer(buff []byte) *Buffer

create a new buffer copying from a byteslice

func (*Buffer) Bytes

func (self *Buffer) Bytes() []byte

get immutable byte slice

func (*Buffer) Data

func (self *Buffer) Data() []byte

get underlying byte slice

func (*Buffer) Free

func (self *Buffer) Free()

zero out memory and then free

func (*Buffer) Length

func (self *Buffer) Length() int

func (*Buffer) String

func (self *Buffer) String() string

type KeyPair

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

func GenBoxKeypair

func GenBoxKeypair() *KeyPair

func GenSignKeypair

func GenSignKeypair() *KeyPair

generate a keypair

func LoadBoxKey

func LoadBoxKey(sk []byte) *KeyPair

load keypair from secret key

func LoadSignKey

func LoadSignKey(seed []byte) *KeyPair

make keypair from seed

func SeedBoxKey

func SeedBoxKey(seed []byte) *KeyPair

make keypair from seed

func (*KeyPair) Free

func (self *KeyPair) Free()

free this keypair from memory

func (*KeyPair) Public

func (self *KeyPair) Public() []byte

func (*KeyPair) Secret

func (self *KeyPair) Secret() []byte

func (*KeyPair) Seed

func (self *KeyPair) Seed() []byte

func (*KeyPair) String

func (self *KeyPair) String() string

Jump to

Keyboard shortcuts

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