Skip to content

Commit

Permalink
Fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorJarvis committed Sep 22, 2018
1 parent 6b57f24 commit 3acebe6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions aes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ func BenchmarkDecryptHeader(b *testing.B) {

func TestEncryptMessageBody(t *testing.T) {
e := NewAES()
message := &TextMessage{Body: "Test"}
message := &TextMessage{Name: "Test", Body: "Test"}
key := []byte{125, 108, 205, 217, 117, 220, 43, 125, 8, 231, 236, 166, 66, 244, 203, 229, 48, 16, 205, 91, 247, 53, 67, 122, 104, 4, 248, 136, 99, 106, 245, 168}
nonce := []byte{231, 105, 16, 98, 199, 200, 124, 56, 123, 202, 182, 101}
cipherText, err := e.EncryptMessageBody(message, key, nonce)
if err != nil {
t.Error(err)
}

expectedCipherText := []byte{181, 87, 73, 94, 222, 79, 92, 35, 244, 60, 195, 198, 149, 20, 156, 189, 36, 116, 103, 125, 2, 187, 57, 241, 3, 253, 242, 80, 146, 60, 58, 217, 133, 220, 91, 88, 201, 11, 112, 47, 204, 133, 85, 62, 40, 51, 211, 176, 45, 166, 96, 136, 188, 175, 160, 252, 226, 184, 3, 56, 98}
fmt.Println(cipherText)
expectedCipherText := []byte{188, 87, 73, 94, 222, 79, 92, 35, 244, 60, 195, 198, 149, 20, 156, 189, 36, 116, 103, 125, 2, 187, 57, 242, 3, 253, 254, 94, 155, 32, 58, 217, 133, 221, 95, 19, 89, 235, 8, 42, 148, 224, 38, 74, 39, 113, 215, 14, 155, 33, 84, 128, 47, 72, 35, 246, 33, 200, 119, 239, 238, 77, 4, 171, 187, 9, 191, 28, 46, 143, 117, 43, 174, 175, 122, 144}
if !reflect.DeepEqual(cipherText, expectedCipherText) {
t.Error("message encryption failed")
}
Expand Down
8 changes: 4 additions & 4 deletions conversation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func init() {
SendingMessageKeyInitializersIndex: 0,
ReceivingMessageIndex: 0,
ReceivingMessageKeyInitializersIndex: 1,
SendQueue: make(chan MessageEncrypted),
RecieveQueue: make(chan MessageEncrypted),
SendQueue: make(chan MessageUnencrypted),
ReceiveQueue: make(chan MessageEncrypted),
}

privateKey2, publicKey2, err := RSATools.GenerateRSAKey(rand.Reader)
Expand All @@ -57,8 +57,8 @@ func init() {
ReceivingMessageKeyInitializersIndex: 0,
PartnerPublicKey: publicKey,
PartnerHostname: "127.0.0.1:9000",
SendQueue: make(chan MessageEncrypted),
RecieveQueue: make(chan MessageEncrypted),
SendQueue: make(chan MessageUnencrypted),
ReceiveQueue: make(chan MessageEncrypted),
}

}
Expand Down

0 comments on commit 3acebe6

Please sign in to comment.