aboutsummaryrefslogtreecommitdiff
path: root/tests/example_filesystems
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-28 19:02:22 +0200
committerJakob Unterwurzacher2017-05-30 17:04:46 +0200
commite43eb36da3e72cd0f59ac978cf76a94fa87ca7cd (patch)
tree3ec424628b30e0633b668c2ec95fcc4bc69d74f3 /tests/example_filesystems
parentd202a456f56ec9923626ef6839254d40f2c8ee37 (diff)
tests: add v1.3-reverse example filesystem
We check the md5 sum of the encrypted version of a file to make sure we don't accidentially change the ciphertext generation.
Diffstat (limited to 'tests/example_filesystems')
-rw-r--r--tests/example_filesystems/example_filesystems_test.go54
-rw-r--r--tests/example_filesystems/v1.3-reverse/.gocryptfs.reverse.conf21
l---------tests/example_filesystems/v1.3-reverse/abs1
-rw-r--r--tests/example_filesystems/v1.3-reverse/dir1/dir2/filebin0 -> 10000 bytes
-rw-r--r--tests/example_filesystems/v1.3-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1
l---------tests/example_filesystems/v1.3-reverse/rel1
-rw-r--r--tests/example_filesystems/v1.3-reverse/status.txt1
7 files changed, 79 insertions, 0 deletions
diff --git a/tests/example_filesystems/example_filesystems_test.go b/tests/example_filesystems/example_filesystems_test.go
index d7411e6..cbea251 100644
--- a/tests/example_filesystems/example_filesystems_test.go
+++ b/tests/example_filesystems/example_filesystems_test.go
@@ -250,3 +250,57 @@ func TestExampleFSv13(t *testing.T) {
checkExampleFSLongnames(t, pDir)
test_helpers.UnmountPanic(pDir)
}
+
+// gocryptfs v1.3 introduced HKDF.
+// We check the md5 sum of the encrypted version of a file to make sure we don't
+// accidentially change the ciphertext generation.
+func TestExampleFSv13reverse(t *testing.T) {
+ // Prepare directories
+ dirA := "v1.3-reverse"
+ dirB := test_helpers.TmpDir + "/" + dirA + ".B"
+ err := os.Mkdir(dirB, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ dirC := test_helpers.TmpDir + "/" + dirA + ".C"
+ err = os.Mkdir(dirC, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Mount using password
+ test_helpers.MountOrFatal(t, dirA, dirB, "-reverse", "-extpass", "echo test", opensslOpt)
+ c := dirB + "/gocryptfs.conf"
+ if !test_helpers.VerifyExistence(c) {
+ t.Errorf("%s missing", c)
+ }
+ test_helpers.MountOrFatal(t, dirB, dirC, "-extpass", "echo test", opensslOpt)
+ // Test
+ checkExampleFSrw(t, dirC, false)
+ // Encrypted version of dir1/dir2/file (10000 zero bytes)
+ cPath := dirB + "/zOsW1-BUX54hC2hmhu2EOw/4ZqrpGQdw5r07KR1qw2ZeQ/tfCm9Sp9J_Dvc-jD7J6p8g"
+ want := "9818501d214c5eb42ca2472caf6c82a1"
+ actual := test_helpers.Md5fn(cPath)
+ if actual != want {
+ t.Errorf("wrong md5")
+ }
+ // Unmount
+ test_helpers.UnmountPanic(dirC)
+ test_helpers.UnmountPanic(dirB)
+
+ // Mount using masterkey
+ m := "2290a7f4-3e1908fb-b006f7d9-261bdaf1-4b72bc38-3b24956c-db7d8a8d-d996076a"
+ test_helpers.MountOrFatal(t, dirA, dirB, "-reverse", "-masterkey", m, opensslOpt)
+ if !test_helpers.VerifyExistence(c) {
+ t.Errorf("%s missing", c)
+ }
+ test_helpers.MountOrFatal(t, dirB, dirC, "-aessiv", "-masterkey", m, opensslOpt)
+ // Test
+ checkExampleFSrw(t, dirC, false)
+ actual = test_helpers.Md5fn(cPath)
+ if actual != want {
+ t.Errorf("wrong md5")
+ }
+ // Unmmount
+ test_helpers.UnmountPanic(dirC)
+ test_helpers.UnmountPanic(dirB)
+}
diff --git a/tests/example_filesystems/v1.3-reverse/.gocryptfs.reverse.conf b/tests/example_filesystems/v1.3-reverse/.gocryptfs.reverse.conf
new file mode 100644
index 0000000..4241280
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/.gocryptfs.reverse.conf
@@ -0,0 +1,21 @@
+{
+ "Creator": "gocryptfs v1.3",
+ "EncryptedKey": "o6yhOpoaToWqs7iZMgx2J+dmrRcL8TOjqd7ntlqy4Y/g/ygNRADJXGITtEIDukf7FbGyn2JNZtWs/4ZOgLNmYw==",
+ "ScryptObject": {
+ "Salt": "8a64zpm0vXFg9uretHuwbxijzQmx2QF4hKOYM0yK/S8=",
+ "N": 65536,
+ "R": 8,
+ "P": 1,
+ "KeyLen": 32
+ },
+ "Version": 2,
+ "FeatureFlags": [
+ "GCMIV128",
+ "HKDF",
+ "DirIV",
+ "EMENames",
+ "LongNames",
+ "Raw64",
+ "AESSIV"
+ ]
+}
diff --git a/tests/example_filesystems/v1.3-reverse/abs b/tests/example_filesystems/v1.3-reverse/abs
new file mode 120000
index 0000000..e1740fa
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/abs
@@ -0,0 +1 @@
+/a/b/c/d \ No newline at end of file
diff --git a/tests/example_filesystems/v1.3-reverse/dir1/dir2/file b/tests/example_filesystems/v1.3-reverse/dir1/dir2/file
new file mode 100644
index 0000000..e64c723
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/dir1/dir2/file
Binary files differ
diff --git a/tests/example_filesystems/v1.3-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx b/tests/example_filesystems/v1.3-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
new file mode 100644
index 0000000..68300b8
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -0,0 +1 @@
+It works!
diff --git a/tests/example_filesystems/v1.3-reverse/rel b/tests/example_filesystems/v1.3-reverse/rel
new file mode 120000
index 0000000..8279c75
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/rel
@@ -0,0 +1 @@
+status.txt \ No newline at end of file
diff --git a/tests/example_filesystems/v1.3-reverse/status.txt b/tests/example_filesystems/v1.3-reverse/status.txt
new file mode 100644
index 0000000..68300b8
--- /dev/null
+++ b/tests/example_filesystems/v1.3-reverse/status.txt
@@ -0,0 +1 @@
+It works!