pub struct FieldEncryption {
pub columns: BTreeMap<String, String>,
pub keys: BTreeMap<String, String>,
}Expand description
Which columns are encrypted in the .csx format, and where their keys
come from.
The keys are named, never written here. A keys entry is the name of
an environment variable holding the base64 of 32 bytes, so the
configuration file carries no secret — which is what makes this worth
having over full-disk encryption, whose key is on the machine too.
[database.field_encryption]
columns = { patient_id = "phi-2026", diagnosis = "phi-2026" }
keys = { phi-2026 = "CHRONIX_FIELD_KEY_PHI" }Column names are global, not per measurement. Only a field may be encrypted: a tag is part of the series key, which is stored in plaintext beside the segment, and every scan ranges on the time column.
Declaring several key ids at once is a rotation — segments written under the old one stay readable. Every declared key must resolve at startup, including one no column currently names.
Fields§
§columns: BTreeMap<String, String>Column name → the id of the key that encrypts it.
keys: BTreeMap<String, String>Key id → the environment variable holding its base64-encoded 32 bytes.
Implementations§
Source§impl FieldEncryption
impl FieldEncryption
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Check the declaration is self-consistent.
§Errors
ConfigError::Validation if a column names a key that is not
declared, if a name is empty, or if the time column is named — a
timestamp cannot be encrypted, because every scan ranges on it and
every retention decision reads it.
Trait Implementations§
Source§impl Clone for FieldEncryption
impl Clone for FieldEncryption
Source§fn clone(&self) -> FieldEncryption
fn clone(&self) -> FieldEncryption
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more