-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkeys_test.go
60 lines (53 loc) · 1.93 KB
/
keys_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package prekeyserver
import (
"github.com/otrv4/gotrx"
. "gopkg.in/check.v1"
)
func (s *GenericServerSuite) Test_fingerprint_returnsCorrectFingerprint(c *C) {
sym := [57]byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,
}
expectedFpr := gotrx.Fingerprint{
0x4, 0x31, 0x67, 0xb9, 0x76, 0x1e, 0x86, 0x29,
0x69, 0x85, 0xdd, 0xb, 0x95, 0xba, 0x46, 0xdc,
0xaf, 0xb5, 0x68, 0x4f, 0x1a, 0x27, 0x62, 0x31,
0xbf, 0x66, 0xe8, 0xb6, 0xb6, 0x2f, 0xc3, 0x27,
0xb4, 0x4b, 0xce, 0x37, 0x28, 0x4, 0x51, 0xa7,
0x28, 0xcd, 0x99, 0x90, 0xa5, 0xe8, 0x1d, 0xd9,
0x5b, 0xe, 0xba, 0x10, 0x9a, 0x87, 0x8c, 0xeb,
}
kp := gotrx.DeriveKeypair(sym)
fpr := kp.Fingerprint()
c.Assert(fpr, DeepEquals, expectedFpr)
}
func (s *GenericServerSuite) Test_keypair_Fingerprint_returnsTheFingerprint(c *C) {
sym := [57]byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,
}
expectedFpr := gotrx.Fingerprint{
0x4, 0x31, 0x67, 0xb9, 0x76, 0x1e, 0x86, 0x29,
0x69, 0x85, 0xdd, 0xb, 0x95, 0xba, 0x46, 0xdc,
0xaf, 0xb5, 0x68, 0x4f, 0x1a, 0x27, 0x62, 0x31,
0xbf, 0x66, 0xe8, 0xb6, 0xb6, 0x2f, 0xc3, 0x27,
0xb4, 0x4b, 0xce, 0x37, 0x28, 0x4, 0x51, 0xa7,
0x28, 0xcd, 0x99, 0x90, 0xa5, 0xe8, 0x1d, 0xd9,
0x5b, 0xe, 0xba, 0x10, 0x9a, 0x87, 0x8c, 0xeb,
}
kp := gotrx.DeriveKeypair(sym)
fpr := kp.Fingerprint()
c.Assert(fpr, DeepEquals, expectedFpr)
}