crypto

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypt

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

Crypt structure holds implementation of particular Key Management Service e.g. AWS KMS

func NewCrypt

func NewCrypt(kms KMS) *Crypt

NewCrypt creates a new crypt with corresponding Key Management Service

func (*Crypt) DecryptFile

func (c *Crypt) DecryptFile(inputPath, outputPath string) error

DecryptFile reads from the inputPath file or stdin if empty. Then decrypts content with corresponding Key Management Service. Plaintext is saved into outputPath file or print on stdout if empty.

func (*Crypt) EncryptFile

func (c *Crypt) EncryptFile(inputPath, outputPath string) error

EncryptFile reads from the inputPath file or stdin if empty. Then encrypts content with corresponding Key Management Service. Ciphertext is saved into outputPath file or print on stdout if empty.

type KMS

type KMS interface {
	Encrypt(plaintext []byte) ([]byte, error)
	Decrypt(ciphertext []byte) ([]byte, error)
}

KMS - Key Management Service interface abstracts common cryptographic operations. A KMS must be able to decrypt the data it encrypts.

Jump to

Keyboard shortcuts

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