Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr string
Addr is a type-alias for method address strings that identify a specific encryption method configuration. The Addr is an opaque value. Do not perform string manipulation on it outside the functions supplied by the method package.
func NewAddr ¶
NewAddr creates a new Addr type from the provider and name supplied. The Addr is a type-alias for encryption method address strings that identify a specific encryption method configuration. You should treat the value as opaque and not perform string manipulation on it outside the functions supplied by the method package.
type Config ¶
type Config interface { // Build takes the configuration and builds an encryption method. // TODO this may be better changed to return hcl.Diagnostics so warnings can be issued? Build() (Method, error) }
Config describes a configuration struct for setting up an encryption Method. You should always implement this interface with a struct, and you should tag the fields with HCL tags so the encryption implementation can read the .tf code into it. For example:
type MyConfig struct { Key string `hcl:"key"` } func (m MyConfig) Build() (Method, error) { ... }
type Descriptor ¶
type Descriptor interface { // ID returns the unique identifier used when parsing HCL or JSON configs. ID() ID // ConfigStruct creates a new configuration struct annotated with hcl tags. The Build() receiver on // this struct must be able to build a Method from the configuration. // // Common errors: // - Returning a struct without a pointer // - Returning a non-struct ConfigStruct() Config }
Descriptor contains the details on an encryption method and produces a configuration structure with default values.
type ErrCryptoFailure ¶
ErrCryptoFailure indicates a generic cryptographic failure. This error should be embedded into ErrEncryptionFailed, ErrDecryptionFailed, or ErrInvalidConfiguration.
func (ErrCryptoFailure) Error ¶
func (e ErrCryptoFailure) Error() string
func (ErrCryptoFailure) Unwrap ¶
func (e ErrCryptoFailure) Unwrap() error
type ErrDecryptionFailed ¶
type ErrDecryptionFailed struct {
Cause error
}
ErrDecryptionFailed indicates that decrypting a set of data failed.
func (ErrDecryptionFailed) Error ¶
func (e ErrDecryptionFailed) Error() string
func (ErrDecryptionFailed) Unwrap ¶
func (e ErrDecryptionFailed) Unwrap() error
type ErrDecryptionKeyUnavailable ¶
type ErrDecryptionKeyUnavailable struct { }
ErrDecryptionKeyUnavailable indicates that no decryption key is available.
func (ErrDecryptionKeyUnavailable) Error ¶
func (e ErrDecryptionKeyUnavailable) Error() string
type ErrEncryptionFailed ¶
type ErrEncryptionFailed struct {
Cause error
}
ErrEncryptionFailed indicates that encrypting a set of data failed.
func (ErrEncryptionFailed) Error ¶
func (e ErrEncryptionFailed) Error() string
func (ErrEncryptionFailed) Unwrap ¶
func (e ErrEncryptionFailed) Unwrap() error
type ErrInvalidConfiguration ¶
type ErrInvalidConfiguration struct {
Cause error
}
ErrInvalidConfiguration indicates that the method configuration is incorrect.
func (ErrInvalidConfiguration) Error ¶
func (e ErrInvalidConfiguration) Error() string
func (ErrInvalidConfiguration) Unwrap ¶
func (e ErrInvalidConfiguration) Unwrap() error
type Method ¶
type Method interface { // Encrypt encrypts the specified data with the set configuration. This method should treat any data passed as // opaque and should not try to interpret its contents. The interpretation is the job of the encryption.Encryption // interface. Encrypt(data []byte) ([]byte, error) // Decrypt decrypts the specified data with the set configuration. This method should treat any data passed as // opaque and should not try to interpret its contents. The interpretation is the job of the encryption.Encryption // interface. Decrypt(data []byte) ([]byte, error) }
Method is a low-level encryption method interface that is responsible for encrypting a binary blob of data. It should not try to interpret what kind of data it is encrypting.