crypto

package
v0.0.0-...-f25e4d8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package crypto provides an easy interface to cutting-edge cryptographic functions with sensable defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyDerivation

func KeyDerivation(password []byte, salt []byte) []byte

KeyDerivation using Argon2.

Types

type Key

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

Key implements PKI signing using Ed25519/EdDSA/RFC8032.

func (*Key) Load

func (k *Key) Load(key []byte)

Load a raw private `key`; must be 32 bytes of random.

func (*Key) Public

func (k *Key) Public() []byte

Public key.

func (*Key) Sign

func (k *Key) Sign(msg []byte) []byte

Sign generates detached signature of `msg`.

func (*Key) SignWithSalt

func (k *Key) SignWithSalt(msg []byte) ([]byte, error)

SignWithSalt generates detached signature of `msg` with an extra salt.

func (*Key) Validate

func (k *Key) Validate(msg []byte, sig []byte) error

Validate detached `sig` is for `msg`.

func (*Key) ValidateWithSalt

func (k *Key) ValidateWithSalt(msg []byte, sig []byte) error

ValidateWithSalt validates detached salted `sig` is for `msg`.

type Secret

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

Secret implements symmetric encryption using AES GCM/RFC5288.

func (*Secret) Decrypt

func (s *Secret) Decrypt(msg []byte) ([]byte, error)

Decrypt `msg`.

func (*Secret) Encrypt

func (s *Secret) Encrypt(msg []byte) ([]byte, error)

Encrypt `msg`.

func (*Secret) Load

func (s *Secret) Load(secret []byte) error

Load a shared `secret`; should be 32 bytes.

Jump to

Keyboard shortcuts

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