From 30a8fda0a1d69dc9019e35a3da5bb8434ca9dbc0 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 4 Jan 2019 19:02:36 +0100 Subject: xray: add tests and example aes-gcm fs The single test compares the gocryptfs-xray output with the expected output. --- gocryptfs-xray/xray_tests/aesgcm_fs.masterkey.txt | 5 ++++ gocryptfs-xray/xray_tests/aesgcm_fs.xray.txt | 3 +++ .../xray_tests/aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg | Bin 0 -> 5082 bytes gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.conf | 20 ++++++++++++++++ .../xray_tests/aesgcm_fs/gocryptfs.diriv | 1 + gocryptfs-xray/xray_tests/xray_test.go | 26 +++++++++++++++++++++ 6 files changed, 55 insertions(+) create mode 100644 gocryptfs-xray/xray_tests/aesgcm_fs.masterkey.txt create mode 100644 gocryptfs-xray/xray_tests/aesgcm_fs.xray.txt create mode 100644 gocryptfs-xray/xray_tests/aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg create mode 100644 gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.conf create mode 100644 gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.diriv create mode 100644 gocryptfs-xray/xray_tests/xray_test.go (limited to 'gocryptfs-xray') diff --git a/gocryptfs-xray/xray_tests/aesgcm_fs.masterkey.txt b/gocryptfs-xray/xray_tests/aesgcm_fs.masterkey.txt new file mode 100644 index 0000000..08b910a --- /dev/null +++ b/gocryptfs-xray/xray_tests/aesgcm_fs.masterkey.txt @@ -0,0 +1,5 @@ +Your master key is: + + f342380e-238f708f-f4eb94d1-fcf79cca- + 7e1e9d9a-b9122286-5e4eaae8-a292ee43 + diff --git a/gocryptfs-xray/xray_tests/aesgcm_fs.xray.txt b/gocryptfs-xray/xray_tests/aesgcm_fs.xray.txt new file mode 100644 index 0000000..b44a0f7 --- /dev/null +++ b/gocryptfs-xray/xray_tests/aesgcm_fs.xray.txt @@ -0,0 +1,3 @@ +Header: Version: 2, Id: aa854388132e168d55250e89070ca5bf +Block 0: IV: d2d30e816ddebcf6af2e7333b837c8fd, Tag: 66cb786e17f02c9ffd1d722ac0b69f79, Offset: 18 Len: 4128 +Block 1: IV: 82e2c96c1d6f2fd1e985d44feff8bb31, Tag: f4c0743fd073ff779e94c4954b8c6c34, Offset: 4146 Len: 936 diff --git a/gocryptfs-xray/xray_tests/aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg b/gocryptfs-xray/xray_tests/aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg new file mode 100644 index 0000000..9021496 Binary files /dev/null and b/gocryptfs-xray/xray_tests/aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg differ diff --git a/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.conf b/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.conf new file mode 100644 index 0000000..9963e2d --- /dev/null +++ b/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.conf @@ -0,0 +1,20 @@ +{ + "Creator": "gocryptfs v1.7-beta1-7-g6b94f5e", + "EncryptedKey": "mHLMC8208CamUCy6lpX8BtQ0h93dmhUycXAJRPYJI5d8vHvlS7hVgWOuAIf1wQEWQ2veEo9GBe3rmfmTnGzSvA==", + "ScryptObject": { + "Salt": "0yHaO65zMQgn9izBA3HlcLkX0KdI3PGBc4799TRVQYo=", + "N": 65536, + "R": 8, + "P": 1, + "KeyLen": 32 + }, + "Version": 2, + "FeatureFlags": [ + "GCMIV128", + "HKDF", + "DirIV", + "EMENames", + "LongNames", + "Raw64" + ] +} diff --git a/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.diriv b/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.diriv new file mode 100644 index 0000000..205ed2f --- /dev/null +++ b/gocryptfs-xray/xray_tests/aesgcm_fs/gocryptfs.diriv @@ -0,0 +1 @@ +Ów5Ó44¦R#òTÃ^• \ No newline at end of file diff --git a/gocryptfs-xray/xray_tests/xray_test.go b/gocryptfs-xray/xray_tests/xray_test.go new file mode 100644 index 0000000..a3374b0 --- /dev/null +++ b/gocryptfs-xray/xray_tests/xray_test.go @@ -0,0 +1,26 @@ +package xray_tests + +import ( + "bytes" + "fmt" + "io/ioutil" + "os/exec" + "testing" +) + +func TestAesgcmXray(t *testing.T) { + expected, err := ioutil.ReadFile("aesgcm_fs.xray.txt") + if err != nil { + t.Fatal(err) + } + cmd := exec.Command("../gocryptfs-xray", "aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg") + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatal(err) + } + if bytes.Compare(out, expected) != 0 { + t.Errorf("Unexpected output") + fmt.Printf("expected:\n%s", string(expected)) + fmt.Printf("have:\n%s", string(out)) + } +} -- cgit v1.2.3