all: now messages between frps and frpc can be encryped when use_encryption set true

This commit is contained in:
fatedier
2016-03-31 18:48:18 +08:00
parent 52f99bbc00
commit 80fc76da52
11 changed files with 73 additions and 44 deletions

View File

@@ -19,10 +19,10 @@ import (
"testing"
)
func TestEncrypto(t *testing.T) {
func TestEncrypt(t *testing.T) {
pp := new(Pcrypto)
pp.Init([]byte("Hana"))
res, err := pp.Encrypto([]byte("Just One Test!"))
res, err := pp.Encrypt([]byte("Just One Test!"))
if err != nil {
t.Fatal(err)
}
@@ -30,15 +30,15 @@ func TestEncrypto(t *testing.T) {
fmt.Printf("[%x]\n", res)
}
func TestDecrypto(t *testing.T) {
func TestDecrypt(t *testing.T) {
pp := new(Pcrypto)
pp.Init([]byte("Hana"))
res, err := pp.Encrypto([]byte("Just One Test!"))
res, err := pp.Encrypt([]byte("Just One Test!"))
if err != nil {
t.Fatal(err)
}
res, err = pp.Decrypto(res)
res, err = pp.Decrypt(res)
if err != nil {
t.Fatal(err)
}