xray: add tests and example aes-gcm fs

The single test compares the gocryptfs-xray output with the expected output.
This commit is contained in:
Jakob Unterwurzacher 2019-01-04 19:02:36 +01:00
parent cb524b60b4
commit 30a8fda0a1
6 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,5 @@
Your master key is:
f342380e-238f708f-f4eb94d1-fcf79cca-
7e1e9d9a-b9122286-5e4eaae8-a292ee43

View File

@ -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

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
Ów5Ó44¦R#ňTĂ^•

View File

@ -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))
}
}