internal

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CryptersMap map[string]Crypter

CryptersMap contains a mapping to supported crypters

Functions

func AESDecrypt

func AESDecrypt(key []byte, b64ciphertext string) (string, error)

func AESEncrypt

func AESEncrypt(key []byte, plaintext string) (string, error)

func UnparseDecryptParams

func UnparseDecryptParams(decryptParams DecryptParams) string

UnparseDecryptParams parses the URL encoded parameters into a map

Types

type Ciphertext

type Ciphertext string

Ciphertext is the encrypted plaintext

type Crypter

type Crypter interface {
	Name() string
	Encrypt(string, EncryptParams) (Ciphertext, DecryptParams, error)
	Decrypt(Ciphertext, DecryptParams) (string, error)
}

Crypter is an object that knows how to encrypt and decrypt a secret

type DecryptParams

type DecryptParams map[string]string

DecryptParams are parameters used for decrypting a secret

func ParseDecryptParams

func ParseDecryptParams(s string) (DecryptParams, error)

ParseDecryptParams parses the URL encoded parameters into a map

type EncryptParams

type EncryptParams map[string]string

EncryptParams are parameters used for encrypting a secret

type KMSAPI added in v1.0.3

type KMSAPI interface {
	kmsiface.KMSAPI
}

KMSAPI wraps kmsiface.KMSAPI so that we can generate mock

type KMSCrypter

type KMSCrypter struct{}

func (KMSCrypter) Decrypt

func (c KMSCrypter) Decrypt(ciphertext Ciphertext, decryptParams DecryptParams) (string, error)

func (KMSCrypter) Encrypt

func (c KMSCrypter) Encrypt(plaintext string, encryptParams EncryptParams) (Ciphertext, DecryptParams, error)

func (KMSCrypter) Name

func (c KMSCrypter) Name() string

type LocalCrypter

type LocalCrypter struct{}

func (LocalCrypter) Decrypt

func (c LocalCrypter) Decrypt(b64ciphertext Ciphertext, decryptParams DecryptParams) (string, error)

func (LocalCrypter) Encrypt

func (c LocalCrypter) Encrypt(plaintext string, encryptParams EncryptParams) (Ciphertext, DecryptParams, error)

func (LocalCrypter) Name

func (c LocalCrypter) Name() string

type MockCrypter

type MockCrypter struct {
	mock.Mock
}

func (*MockCrypter) Decrypt

func (_m *MockCrypter) Decrypt(_a0 Ciphertext, _a1 DecryptParams) (string, error)

Decrypt provides a mock function with given fields: _a0, _a1

func (*MockCrypter) Encrypt

func (_m *MockCrypter) Encrypt(_a0 string, _a1 EncryptParams) (Ciphertext, DecryptParams, error)

Encrypt provides a mock function with given fields: _a0, _a1

func (*MockCrypter) Name

func (_m *MockCrypter) Name() string

Name provides a mock function with given fields:

type PasswordCrypter

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

func (PasswordCrypter) Decrypt

func (c PasswordCrypter) Decrypt(b64ciphertext Ciphertext, decryptParams DecryptParams) (string, error)

func (PasswordCrypter) Encrypt

func (c PasswordCrypter) Encrypt(plaintext string, encryptParams EncryptParams) (Ciphertext, DecryptParams, error)

func (PasswordCrypter) Name

func (c PasswordCrypter) Name() string

type PlainCrypter

type PlainCrypter struct{}

func (PlainCrypter) Decrypt

func (pc PlainCrypter) Decrypt(myCiphertext Ciphertext, decryptParams DecryptParams) (string, error)

func (PlainCrypter) Encrypt

func (pc PlainCrypter) Encrypt(plaintext string, encryptParams EncryptParams) (Ciphertext, DecryptParams, error)

func (PlainCrypter) Name

func (pc PlainCrypter) Name() string

Jump to

Keyboard shortcuts

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