encryption

package
v0.0.0-...-93529e1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptionService

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

EncryptionService for encrypting data using KMS.

func NewService

func NewService() EncryptionService

NewService opens a new session with KMS.

func (EncryptionService) Decrypt

func (e EncryptionService) Decrypt(encKey string, encVal string) (res string, err error)

Decrypt a string using AES 256 bit encryption. The encrypted key is first decrypted by KMS. The encrypted value starts with a random IV that was generated when it was encrypted.

func (EncryptionService) Encrypt

func (e EncryptionService) Encrypt(input string) (encKey string, encVal string, err error)

Encrypt a string using AES 256 bit encryption. The encryption key is generated by KMS and an encrypted copy is returned which must also be stored. The encrypted value starts with a random IV that is needed to decrypt.

type MockService

type MockService struct{}

MockService for tests

func NewMockService

func NewMockService() MockService

func (MockService) Decrypt

func (q MockService) Decrypt(encKey string, envVal string) (result string, err error)

Decrypt on mock returns static data

func (MockService) Encrypt

func (q MockService) Encrypt(input string) (encKey string, encVal string, err error)

Encrypt on mock returns static data

type Service

type Service interface {
	Encrypt(input string) (encKey string, encVal string, err error)
	Decrypt(encKey string, encVal string) (result string, err error)
}

Jump to

Keyboard shortcuts

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