ckms

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFileNotFound if path to config file incorrect
	ErrFileNotFound = errors.New("file not found")

	// ErrFileExistsNoOverwrite not allowed to overwrite existing files
	ErrFileExistsNoOverwrite = errors.New("cannot overrite existing file")
)

Functions

func SaveFile

func SaveFile(raw []byte, path string) error

SaveFile saved the file in custom path (created dir if it doesn't exist)

Types

type CKMS

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

CKMS reads the encrypted file, decrypts it and returns

func NewCKMS

func NewCKMS(keyID string) *CKMS

NewCKMS - config init with aws session from the shared credentials file ~/.aws/credentials and configuration from the shared configuration file ~/.aws/config.

func (*CKMS) Decrypt

func (ckms *CKMS) Decrypt(path string) ([]byte, error)

Decrypt the base64 config file and return plaintext contents of a file

func (*CKMS) DecryptRaw

func (ckms *CKMS) DecryptRaw(cipherText []byte) ([]byte, error)

DecryptRaw decrypts raw bytes (base64 formatted in encryption process)

func (*CKMS) Encrypt

func (ckms *CKMS) Encrypt(path string) ([]byte, error)

Encrypt encrypts the file contents of the given input file and returns encrypted file contents in base64 format

func (*CKMS) EncryptRaw

func (ckms *CKMS) EncryptRaw(raw []byte) ([]byte, error)

EncryptRaw converts raw bytes to base64 format and encrypts the base64 string. result is encrypted byte[]

func (*CKMS) GetSecret

func (ckms *CKMS) GetSecret(secretName string) (map[string]string, error)

GetSecret returns a JSON file with stored secrets in AWS Secret Manager

Jump to

Keyboard shortcuts

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