aead

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MPL-2.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DerivedWrapperOptions added in v0.5.4

type DerivedWrapperOptions struct {
	// KeyID is the key ID to set on the derived wrapper
	KeyID string

	// AEADType is the type of AEAD to use in the sub-wrapper. An empty value
	// defaults to "aes-gcm".
	AEADType string

	// Hash is the type of hash function to use with HKDF. Defaults to
	// sha256.New.
	Hash func() hash.Hash

	// Salt is the salt value to use, can be (but shouldn't be) nil
	Salt []byte

	// Info is the info value to use, can be (but shouldn't be) nil
	Info []byte
}

type ShamirWrapper added in v0.5.2

type ShamirWrapper struct {
	*Wrapper
}

ShamirWrapper is here for backwards compatibility for Vault; it reports a type of "shamir" instead of "aead"

func NewShamirWrapper added in v0.5.2

func NewShamirWrapper(opts *wrapping.WrapperOptions) *ShamirWrapper

func (*ShamirWrapper) Type added in v0.5.2

func (s *ShamirWrapper) Type() string

type Wrapper

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

Wrapper implements the wrapping.Wrapper interface for AEAD

func NewWrapper

func NewWrapper(_ *wrapping.WrapperOptions) *Wrapper

NewWrapper creates a new Wrapper with the provided logger

func (*Wrapper) Decrypt

func (s *Wrapper) Decrypt(_ context.Context, in *wrapping.EncryptedBlobInfo, aad []byte) ([]byte, error)

func (*Wrapper) Encrypt

func (s *Wrapper) Encrypt(_ context.Context, plaintext, aad []byte) (*wrapping.EncryptedBlobInfo, error)

Encrypt is used to encrypt the plaintext using the aead held by the seal.

func (*Wrapper) Finalize

func (s *Wrapper) Finalize(_ context.Context) error

Finalize is called during shutdown. This is a no-op since Wrapper doesn't require any cleanup.

func (*Wrapper) GetKeyBytes

func (s *Wrapper) GetKeyBytes() []byte

func (*Wrapper) HMACKeyID

func (s *Wrapper) HMACKeyID() string

HMACKeyID returns the last known HMAC key id

func (*Wrapper) Init

func (s *Wrapper) Init(_ context.Context) error

Init is a no-op at the moment

func (*Wrapper) KeyID

func (s *Wrapper) KeyID() string

KeyID returns the last known key id

func (*Wrapper) NewDerivedWrapper added in v0.5.4

func (s *Wrapper) NewDerivedWrapper(opts *DerivedWrapperOptions) (*Wrapper, error)

NewDerivedWrapper returns an aead.Wrapper whose key is set to an hkdf-based derivation from the original wrapper

func (*Wrapper) SetAEAD

func (s *Wrapper) SetAEAD(aead cipher.AEAD)

func (*Wrapper) SetAESGCMKeyBytes

func (s *Wrapper) SetAESGCMKeyBytes(key []byte) error

SetAESGCMKeyBytes takes in a byte slice and constucts an AES-GCM AEAD from it

func (*Wrapper) SetConfig added in v0.5.3

func (s *Wrapper) SetConfig(config map[string]string) (map[string]string, error)

SetConfig sets the fields on the Wrapper object based on values from the config parameter.

func (*Wrapper) Type

func (s *Wrapper) Type() string

Type returns the seal type for this particular Wrapper implementation

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

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