aboutsummaryrefslogtreecommitdiff
path: root/internal/configfile/config_file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-05 11:33:54 +0200
committerJakob Unterwurzacher2016-06-05 11:40:13 +0200
commitb97268c94824b8047c8d4f97a68549260e4f6835 (patch)
tree72aa2b1d79ba3b5f7a52439beb605c8e5aa84422 /internal/configfile/config_file.go
parenta602e798b1a65fdfe5e7f0260a34e17ea7ab0615 (diff)
configfile: bake the "Creator" gocryptfs version into the file
This field is added for the convenience of users and may help them to identify which gocryptfs version they need to mount a filesystem. The same information is essentially contained in FeatureFlags, but this is more difficult to decode for humans. It is completely ignored programmatically (also by older gocryptfs versions).
Diffstat (limited to 'internal/configfile/config_file.go')
-rw-r--r--internal/configfile/config_file.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index e54e84e..d91ce3e 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -19,8 +19,10 @@ const (
)
type ConfFile struct {
- // File the config is saved to. Not exported to JSON.
- filename string
+ // gocryptfs version string
+ // This only documents the config file for humans who look at it. The actual
+ // technical info is contained in FeatureFlags.
+ Creator string
// Encrypted AES key, unlocked using a password hashed with scrypt
EncryptedKey []byte
// Stores parameters for scrypt hashing (key derivation)
@@ -32,14 +34,17 @@ type ConfFile struct {
// mounting. This mechanism is analogous to the ext4 feature flags that are
// stored in the superblock.
FeatureFlags []string
+ // File the config is saved to. Not exported to JSON.
+ filename string
}
// 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, creator string) error {
var cf ConfFile
cf.filename = filename
+ cf.Creator = creator
cf.Version = contentenc.CurrentVersion
// Generate new random master key