diff options
| author | Jakob Unterwurzacher | 2018-03-22 00:02:10 +0100 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2018-03-22 00:02:10 +0100 | 
| commit | 9bc039a4bac6b51d9ebe116de5c311e90343a088 (patch) | |
| tree | f4ebd37e2cbe4088435421fb7c9550c186161b09 /tests/example_filesystems | |
| parent | 9c86daf499dca8a69b058ec56803d06fbba4fdab (diff) | |
Add `-masterkey=stdin` functionality
https://github.com/rfjakob/gocryptfs/issues/218
Diffstat (limited to 'tests/example_filesystems')
| -rw-r--r-- | tests/example_filesystems/example_filesystems_test.go | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/tests/example_filesystems/example_filesystems_test.go b/tests/example_filesystems/example_filesystems_test.go index 5979bdc..4f29f8d 100644 --- a/tests/example_filesystems/example_filesystems_test.go +++ b/tests/example_filesystems/example_filesystems_test.go @@ -10,6 +10,7 @@ import (  	"flag"  	"fmt"  	"os" +	"os/exec"  	"syscall"  	"testing" @@ -252,6 +253,38 @@ func TestExampleFSv13(t *testing.T) {  	test_helpers.UnmountPanic(pDir)  } +// Check that the masterkey=stdin cli option works. +func TestExampleFSv13MasterkeyStdin(t *testing.T) { +	cDir := "v1.3" +	pDir := test_helpers.TmpDir + "/TestExampleFSv13MasterkeyStdin.mnt" +	err := os.Mkdir(pDir, 0777) +	if err != nil { +		t.Fatal(err) +	} +	args := []string{"-q", "-masterkey=stdin", opensslOpt, cDir, pDir} +	cmd := exec.Command(test_helpers.GocryptfsBinary, args...) +	cmd.Stdout = os.Stdout +	cmd.Stderr = os.Stderr +	p, err := cmd.StdinPipe() +	if err != nil { +		t.Fatal(err) +	} +	err = cmd.Start() +	if err != nil { +		t.Error(err) +	} +	// Write masterkey to stdin +	p.Write([]byte("fd890dab-86bf61cf-ec5ad460-ad3ed01f-9c52d546-2a31783d-a56b088d-3d05232e")) +	p.Close() +	err = cmd.Wait() +	if err != nil { +		t.Error(err) +	} +	// Check that the fs decrypts ok & unmount +	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. | 
