datakey

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package datakey provides a AES GCM service

Index

Constants

View Source
const KeySize = 32

KeySize defines the key length when creating new keys

View Source
const NonceSize = 32

NonceSize defines the nonce length when creating new keys

Variables

This section is empty.

Functions

func New

func New() ([]byte, error)

New returns a new data key

func RandomBytes

func RandomBytes(value *[]byte) error

Fills a slice with random bytes

Types

type Service

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

Service operates on bytes with a data key

func NewService

func NewService(key []byte) *Service

NewService returns an AES service for a given key

func (*Service) Decrypt

func (svc *Service) Decrypt(encryptedBytes []byte) (plainText string, err error)

Decrypt returns a plaintext string

func (*Service) DecryptAsBytes

func (svc *Service) DecryptAsBytes(encryptedBytes []byte) (plainBytes []byte, err error)

DecryptAsBytes returns decrypted bytes

func (*Service) Encrypt

func (svc *Service) Encrypt(plainText []byte) (cipherText []byte, err error)

Encrypt plaintext bytes into ciphertext

Jump to

Keyboard shortcuts

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