crypto

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Length of nacl nonce
	NonceBytes = 24

	// Length of nacl ephemeral public key
	EphemeralPublicKeyBytes = 32
)

Variables

View Source
var (
	// Nacl box decryption failed
	BoxDecryptionError = fmt.Errorf("failed to decrypt curve25519")
)

Functions

func Decrypt

func Decrypt(privKey libp2pc.PrivKey, ciphertext []byte) ([]byte, error)

func DecryptAES

func DecryptAES(bytes []byte, key []byte) ([]byte, error)

DecryptAES uses key (:32 key, 32:12 nonce) to perform AES-256 GCM decryption on bytes.

func Encrypt

func Encrypt(pubKey libp2pc.PubKey, bytes []byte) ([]byte, error)

func EncryptAES

func EncryptAES(bytes []byte, key []byte) ([]byte, error)

EncryptAES performs AES-256 GCM encryption on the provided bytes with key

func GenerateAESKey

func GenerateAESKey() ([]byte, error)

GenerateAESKey returns 44 random bytes, 32 for the key and 12 for a nonce.

func Verify

func Verify(pk libp2pc.PubKey, data []byte, sig []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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