Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PluginFlags ¶
PluginFlags returns CLI flags contributed by all registered encryption plugins.
Types ¶
type FieldProvider ¶ added in v0.0.4
type FieldProvider interface {
EncryptField(plaintext []byte, domain, identity string) ([]byte, error)
DecryptField(ciphertext []byte, domain, identity string) ([]byte, error)
}
FieldProvider is the optional provider extension for MSEH v4 persisted-field encryption.
type Header ¶
Header is passed to DecryptStream after DataEncryptionService has parsed the MSEH envelope. Keeping it here avoids an import cycle with dataencryption.
type Plugin ¶
type Plugin struct {
Name string
Loader func(ctx context.Context, cfg *config.Config) (Provider, error)
Flags func(cfg *config.Config) []cli.Flag
Apply func(cfg *config.Config, cmd *cli.Command)
}
Plugin bundles a provider name with its loader function.
type Provider ¶
type Provider interface {
// ID returns the provider identifier written into the MSEH header (e.g. "plain", "dek", "vault").
ID() string
// Encrypt returns MSEH-wrapped ciphertext (or plaintext for the plain provider).
Encrypt(plaintext []byte) ([]byte, error)
// Decrypt accepts MSEH-wrapped ciphertext, legacy bare nonce||ciphertext, or plaintext.
Decrypt(ciphertext []byte) ([]byte, error)
// EncryptStream writes the MSEH header to dst then returns a WriteCloser that
// encrypts written bytes for streaming storage.
EncryptStream(dst io.Writer) (io.WriteCloser, error)
// DecryptStream returns a Reader that decrypts bytes from src.
// header is the already-parsed MSEH header (read by DataEncryptionService).
DecryptStream(src io.Reader, header *Header) (io.Reader, error)
// AttachmentSigningKeys returns the ordered set of HMAC keys for attachment
// download URL signing (primary first, legacy rotation keys after).
// Returns nil if this provider does not support signed URLs.
AttachmentSigningKeys(ctx context.Context) ([][]byte, error)
}
Provider is the SPI for pluggable encryption providers. Each provider handles its own MSEH envelope writing on encrypt and accepts MSEH, legacy bare, or plaintext formats on decrypt.
Click to show internal directories.
Click to hide internal directories.