security

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 8 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserNotFound = errors.New("user identity must be provided when allowing authentication")

ErrUserNotFound error when authentication passed but no user found

Functions

func Decrypt

func Decrypt(ciphertext []byte, key []byte) ([]byte, error)

Decrypt decrypts the cipher text with the provided key using AES

func Encrypt

func Encrypt(plaintext []byte, key []byte) ([]byte, error)

Encrypt encrypts the plaintext with the provided key using AES

func ForbiddenHTTPError

func ForbiddenHTTPError(description string) error

ForbiddenHTTPError returns HTTPError 403 with some description

func UnauthorizedHTTPError

func UnauthorizedHTTPError(description string) error

UnauthorizedHTTPError returns HTTPError 401 with some description

Types

type Encrypter

type Encrypter interface {
	Encrypt(ctx context.Context, plaintext []byte) ([]byte, error)
	Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)
}

Encrypter provides functionality to encrypt and decrypt data

type KeyFetcher

type KeyFetcher interface {
	GetEncryptionKey(ctx context.Context) ([]byte, error)
}

KeyFetcher provides functionality to get encryption key from a remote location

type KeySetter

type KeySetter interface {
	SetEncryptionKey(ctx context.Context, key []byte) error
}

KeySetter provides functionality to set encryption key in a remote location

type TwoLayerEncrypter

type TwoLayerEncrypter struct {
	Fetcher KeyFetcher
}

TwoLayerEncrypter is an encrypter that fetches the encryption key from a remote location

func (*TwoLayerEncrypter) Decrypt

func (e *TwoLayerEncrypter) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)

Decrypt decrypts the cipher text with a key obtained from a remote location

func (*TwoLayerEncrypter) Encrypt

func (e *TwoLayerEncrypter) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error)

Encrypt encrypts the plaintext with a key obtained from a remote location

Directories

Path Synopsis
Package authenticators contains logic for setting up an Open ID Connect authenticator
Package authenticators contains logic for setting up an Open ID Connect authenticator
httpfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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