func TestVaultFunctionsFingerprint(t *testing.T) {
	dir, err := ioutil.TempDir("", "vault")
	if err != nil {
		t.Error(err)
	}
	defer os.RemoveAll(dir)  
	tmpfile := filepath.Join(dir, "vault")
	vault, err := New("55:cd:f2:7e:4c:0b:e5:a7:6e:6c:fc:6b:8e:58:9d:15", "test_data/id_rsa.pub", "", "create", tmpfile)
	if err != nil {
		t.Error(err)
	}
	PKCS8, err := vault.PKCS8()
	if err != nil {
		t.Error(err)
	}
	vault.PublicKey, err = vault.GetRSAPublicKey(PKCS8)
	if err != nil {
		t.Error(err)
	}
	vault.Fingerprint, err = vault.GenFingerprint(PKCS8)
	if err != nil {
		t.Error(err)
	}
	if vault.Password, err = crypto.GenerateNonce(32); err != nil {
		t.Error(err)
	}
	in := []byte("The quick brown fox jumps over the lazy dog")
	out, err := aead.Encrypt(vault.Password, in, []byte(vault.Fingerprint))
	if err != nil {
		t.Error(err)
	}
	if err = vault.Close(out); err != nil {
		t.Error(err)
	}
	enc1, err := ioutil.ReadFile(tmpfile)
	if err != nil {
		t.Error(err)
	}
	plaintext, err := vault.View()
	if err != nil {
		t.Error(err)
	}
	if !bytes.Equal(in, plaintext) {
		t.Error("in != out")
	}
	os.Setenv("EDITOR", "cat")
	edited, err := vault.Edit(plaintext)
	if err != nil {
		t.Error(err)
	}
	out, err = aead.Encrypt(vault.Password, edited, []byte(vault.Fingerprint))
	if err != nil {
		t.Error(err)
	}
	if err = vault.Close(out); err != nil {
		t.Error(err)
	}
	plaintext, err = vault.View()
	if err != nil {
		t.Error(err)
	}
	enc2, err := ioutil.ReadFile(tmpfile)
	if err != nil {
		t.Error(err)
	}
	if !bytes.Equal(edited, plaintext) {
		t.Error("edited != plaintext ")
	}
	if bytes.Equal(enc1, enc2) {
		t.Error("Expecting different encrypted outputs")
	}
}
These are done in one function to avoid declaring global variables in a test
file.
package sshvault
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"os"
	"path/filepath"
	"testing"
	"github.com/ssh-vault/crypto"
	"github.com/ssh-vault/crypto/aead"
)