summaryrefslogtreecommitdiff
path: root/internal/configfile
diff options
context:
space:
mode:
Diffstat (limited to 'internal/configfile')
-rw-r--r--internal/configfile/config_file.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index dba6c47..c1f93af 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -325,3 +325,18 @@ func getKeyEncrypter(scryptHash []byte, useHKDF bool) *contentenc.ContentEnc {
ce := contentenc.New(cc, 4096, false)
return ce
}
+
+// ContentEncryption tells us which content encryption algorithm is selected
+func (cf *ConfFile) ContentEncryption() (algo cryptocore.AEADTypeEnum, err error) {
+ if err := cf.Validate(); err != nil {
+ return cryptocore.AEADTypeEnum{}, err
+ }
+ if cf.IsFeatureFlagSet(FlagXChaCha20Poly1305) {
+ return cryptocore.BackendXChaCha20Poly1305, nil
+ }
+ if cf.IsFeatureFlagSet(FlagAESSIV) {
+ return cryptocore.BackendAESSIV, nil
+ }
+ // If neither AES-SIV nor XChaCha are selected, we must be using AES-GCM
+ return cryptocore.BackendGoGCM, nil
+}