secure

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: BSD-3-Clause Imports: 3 Imported by: 12

Documentation

Overview

Package secure is a wrapper package around memguard for managing data which must not be swapped to disk or easily read via a memory scanner.

Index

Constants

This section is empty.

Variables

View Source
var ErrSecretNotFound = errors.New("Could not find secret to remove it")

ErrSecretNotFound occurs when a secret could not be found

Functions

This section is empty.

Types

type Guard

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

Guard is a controller of guarded memory which contains many different secrets. Only one guard can exist at a time.

func NewGuard

func NewGuard() *Guard

NewGuard returns a Guard instance or errors if a guard already exists.

func (*Guard) Destroy

func (g *Guard) Destroy()

Destroy removes all secrets and cleans up everything up appropriately.

func (*Guard) Random

func (g *Guard) Random(size int) (*Secret, error)

Random returns a new secret of the given length in bytes.

func (*Guard) Secret

func (g *Guard) Secret(v []byte) (*Secret, error)

Secret returns a new secret for the given value, the given byte slice will be wiped *after* the secret has been moved into secure memory.

type Secret

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

Secret represent a specific guraded piece of memory

func (*Secret) Buffer

func (s *Secret) Buffer() []byte

Buffer returns an array of bytes referencing the underlying secure memory.

func (*Secret) Destroy

func (s *Secret) Destroy()

Destroy properly dispenses of the underlying secret stored in secure memory.

Jump to

Keyboard shortcuts

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