crypto

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package crypto implements the plugin system for cryptography engines. Specifically, the package implements methods to register cryptosystems and then obtain an initialized engine.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownCrypto is returned in the event that the New()
	// function is called with the name of an implementation that
	// does not exist.
	ErrUnknownCrypto = errors.New("the specified crypto engine does not exist")

	// ErrInternalError is used to mask errors from the internal
	// crypto system that are unrecoverable.  This error is safe
	// to return whereas an error from a module may expose secure
	// information.
	ErrInternalError = errors.New("the crypto system has encountered an internal error")

	// ErrAuthorizationFailure is returned in the event the crypto
	// module determines that the provided secret does not match
	// the one secured earlier.
	ErrAuthorizationFailure = errors.New("authorization failed - bad credentials")
)

Functions

func Register

func Register(name string, newFunc Factory)

Register takes in a name for the engine and a function signature to bind to that name.

func SetParentLogger added in v0.3.4

func SetParentLogger(l hclog.Logger)

SetParentLogger sets the parent logger for this instance.

Types

type EMCrypto

type EMCrypto interface {
	SecureSecret(string) (string, error)
	VerifySecret(string, string) error
}

The EMCrypto interface defines the functions that are needed to make a secret secure for storage and later verify a secret against the secured copy.

func New

func New(backend string) (EMCrypto, error)

New returns an initialized Crypto instance which can create and verify secure versions of secrets.

type Factory

type Factory func(hclog.Logger) (EMCrypto, error)

The Factory type is to be implemented by crypto implementations and shall be fed to the Register function.

Directories

Path Synopsis
Package nocrypto provides an implementation of the secret storage engine which performs no security at all.
Package nocrypto provides an implementation of the secret storage engine which performs no security at all.

Jump to

Keyboard shortcuts

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