// gocryptfs v1.1 introduced reverse mode func TestExampleFSv11reversePlaintextnames(t *testing.T) { dirA := "v1.1-reverse-plaintextnames" 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) } 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) checkExampleFSrw(t, dirC, false) test_helpers.UnmountPanic(dirC) test_helpers.UnmountPanic(dirB) m := "e7fb8f0d-2a81df9e-26611e4b-5540b218-e48aa458-c2a623af-d0c82637-1466b5f2" 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) checkExampleFSrw(t, dirC, false) test_helpers.UnmountPanic(dirC) test_helpers.UnmountPanic(dirB) }
// gocryptfs v1.1 introduced reverse mode func TestExampleFSv11reverse(t *testing.T) { dirA := "v1.1-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) } 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) checkExampleFSrw(t, dirC, false) test_helpers.UnmountPanic(dirC) test_helpers.UnmountPanic(dirB) m := "68b51855-042abd80-635ae1ba-90152a78-2ec2d243-832ac72a-eab0561a-f2d37913" 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) checkExampleFSrw(t, dirC, false) test_helpers.UnmountPanic(dirC) test_helpers.UnmountPanic(dirB) }
// .gocryptfs.reverse.conf in the plaintext dir should be visible as // gocryptfs.conf func TestConfigMapping(t *testing.T) { c := dirB + "/gocryptfs.conf" if !test_helpers.VerifyExistence(c) { t.Errorf("%s missing", c) } data, err := ioutil.ReadFile(c) if err != nil { t.Fatal(err) } if len(data) == 0 { t.Errorf("empty file") } }
func TestLongnameStat(t *testing.T) { fd, err := os.Create(dirA + "/" + x240) if err != nil { t.Fatal(err) } path := dirC + "/" + x240 if !test_helpers.VerifyExistence(path) { t.Fail() } test_helpers.VerifySize(t, path, 0) _, err = fd.Write(make([]byte, 10)) if err != nil { t.Fatal(err) } fd.Close() /* time.Sleep(1000 * time.Millisecond) test_helpers.VerifySize(t, path, 10) */ }