aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/config_file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-12-08 16:13:29 +0100
committerJakob Unterwurzacher2015-12-08 16:17:04 +0100
commitc6dacd6f913b4c6eb7a8917af49190dce32db108 (patch)
treec0fd9a08f42c37bd977b95d2bb0a7c96226045c1 /cryptfs/config_file.go
parentff8c81f95b311eb1cd9c822202519f1a90a8cdd4 (diff)
Add EME filename encryption & enable it by default
Diffstat (limited to 'cryptfs/config_file.go')
-rw-r--r--cryptfs/config_file.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/cryptfs/config_file.go b/cryptfs/config_file.go
index be37c60..bf1f2a0 100644
--- a/cryptfs/config_file.go
+++ b/cryptfs/config_file.go
@@ -12,10 +12,6 @@ const (
// The dot "." is not used in base64url (RFC4648), hence
// we can never clash with an encrypted file.
ConfDefaultName = "gocryptfs.conf"
- // Understood Feature Flags
- // Also teach isFeatureFlagKnown() about any additions
- FlagPlaintextNames = "PlaintextNames"
- FlagDirIV = "DirIV"
)
type ConfFile struct {
@@ -37,7 +33,7 @@ type ConfFile struct {
// CreateConfFile - create a new config with a random key encrypted with
// "password" and write it to "filename".
// Uses scrypt with cost parameter logN.
-func CreateConfFile(filename string, password string, plaintextNames bool, logN int) error {
+func CreateConfFile(filename string, password string, plaintextNames bool, logN int, EMENames bool) error {
var cf ConfFile
cf.filename = filename
@@ -50,11 +46,13 @@ func CreateConfFile(filename string, password string, plaintextNames bool, logN
// Set defaults
cf.Version = HEADER_CURRENT_VERSION
- cf.FeatureFlags = []string{FlagDirIV}
// Set values chosen by the user
if plaintextNames {
cf.FeatureFlags = append(cf.FeatureFlags, FlagPlaintextNames)
+ } else {
+ cf.FeatureFlags = append(cf.FeatureFlags, FlagDirIV)
+ cf.FeatureFlags = append(cf.FeatureFlags, FlagEMENames)
}
// Write file to disk
@@ -157,10 +155,18 @@ func (cf *ConfFile) WriteFile() error {
return nil
}
+const (
+ // Understood Feature Flags.
+ // Also teach isFeatureFlagKnown() about any additions
+ FlagPlaintextNames = "PlaintextNames"
+ FlagDirIV = "DirIV"
+ FlagEMENames = "EMENames"
+)
+
// Verify that we understand a feature flag
func (cf *ConfFile) isFeatureFlagKnown(flag string) bool {
switch flag {
- case FlagPlaintextNames, FlagDirIV:
+ case FlagPlaintextNames, FlagDirIV, FlagEMENames:
return true
default:
return false