mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com> Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info> Signed-off-by: Christian Mesh <christianmesh1@gmail.com> Signed-off-by: James Humphries <James@james-humphries.co.uk> Co-authored-by: James Humphries <jamesh@spacelift.io> Co-authored-by: Serdar Dalgıç <serdardalgic@users.noreply.github.com> Co-authored-by: Mikel Olasagasti Uranga <mikel@olasagasti.info> Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
43 lines
952 B
Go
43 lines
952 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package aesgcm
|
|
|
|
import (
|
|
"github.com/opentofu/opentofu/internal/encryption/keyprovider"
|
|
"github.com/opentofu/opentofu/internal/encryption/method"
|
|
)
|
|
|
|
// Descriptor integrates the method.Descriptor and provides a TypedConfig for easier configuration.
|
|
type Descriptor interface {
|
|
method.Descriptor
|
|
|
|
// TypedConfig returns a config typed for this method.
|
|
TypedConfig() *Config
|
|
}
|
|
|
|
// New creates a new descriptor for the AES-GCM encryption method, which requires a 32-byte key.
|
|
func New() Descriptor {
|
|
return &descriptor{}
|
|
}
|
|
|
|
type descriptor struct {
|
|
}
|
|
|
|
func (f *descriptor) TypedConfig() *Config {
|
|
return &Config{
|
|
Keys: keyprovider.Output{},
|
|
AAD: nil,
|
|
}
|
|
}
|
|
|
|
func (f *descriptor) ID() method.ID {
|
|
return "aes_gcm"
|
|
}
|
|
|
|
func (f *descriptor) ConfigStruct() method.Config {
|
|
return f.TypedConfig()
|
|
}
|