暂无描述

security_test.go 840B

    package main import "testing" func TestEncoding(t *testing.T) { clear := "encoding test" base64 := encodeBase64([]byte(clear)) decode64 := string(decodeBase64([]byte(base64))) if decode64 != clear { t.Error("Encoding does not match") } } func TestEncryption(t *testing.T) { clear := "encryption test" passphrase := "password" encrypted, err := encrypt(clear, passphrase) if err != nil { t.Error(err) } decrypted, err := decrypt(encrypted, passphrase) if err != nil { t.Error(err) } if clear != string(decrypted) { t.Error("Encryption does not match") } } func TestHash(t *testing.T) { t.Skip("Need a test for hashing") } func TestHashCredentials(t *testing.T) { t.Skip("Need a test for hashing credentials") } func TestGeneratePassphrase(t *testing.T) { t.Skip("Need a test for generating a passphrase") }