-
Notifications
You must be signed in to change notification settings - Fork 12
/
gpg_test.go
41 lines (37 loc) · 1.89 KB
/
gpg_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
package gpg
import (
"crypto/rsa"
"math/big"
"testing"
)
var pubKey = rsa.PublicKey{
N: (&big.Int{}).SetBytes([]byte{
0xc9, 0xfb, 0x82, 0x73, 0xbe, 0x34, 0x74, 0x3c, 0xf6, 0x72, 0xee, 0x45,
0xfd, 0x8e, 0xd7, 0x82, 0xa, 0x0, 0x30, 0xfa, 0x82, 0x98, 0xb, 0x1a, 0x72,
0x22, 0xe7, 0xdd, 0xb, 0x75, 0x69, 0x2d, 0xae, 0xb2, 0xdc, 0xd9, 0xd0,
0x39, 0x26, 0x80, 0x8, 0x30, 0x7d, 0x1b, 0x16, 0xf6, 0xcc, 0xcf, 0xfa,
0xdd, 0xb4, 0xfc, 0x73, 0xd8, 0x7, 0x4f, 0xaa, 0x1, 0x83, 0xbd, 0xfd,
0xea, 0x4c, 0xa7, 0xa, 0x1b, 0xe, 0x2f, 0x3b, 0x69, 0x5f, 0x2e, 0x12,
0xa9, 0xe3, 0x99, 0x27, 0x4, 0x71, 0xef, 0xde, 0x9a, 0xcc, 0xcf, 0x89,
0xb5, 0xb6, 0xec, 0xe6, 0xad, 0x1c, 0x6c, 0x18, 0xf9, 0xc0, 0x3b, 0xa7,
0xfa, 0xa5, 0x54, 0x52, 0x37, 0x89, 0xe1, 0x65, 0x6d, 0x41, 0x13, 0xe4,
0x2a, 0xb1, 0x22, 0x7e, 0x92, 0xe, 0xad, 0xcd, 0x73, 0x5b, 0x8d, 0x53,
0x50, 0x4a, 0xd1, 0x1a, 0x62, 0x10, 0xcd, 0xa6, 0x69, 0x16, 0x3c, 0xb5,
0x24, 0x26, 0xed, 0x96, 0xe4, 0x92, 0xbc, 0x9b, 0x62, 0x30, 0xdf, 0xff,
0xb8, 0x10, 0xc6, 0x2d, 0xee, 0x4b, 0x73, 0x52, 0xf9, 0x2d, 0x95, 0x69,
0x55, 0x4f, 0xd1, 0x22, 0x40, 0x62, 0xf9, 0x4a, 0xa2, 0x22, 0xe9, 0x38,
0x3, 0xbf, 0xd7, 0x63, 0x69, 0x2e, 0x33, 0xc5, 0xcd, 0x36, 0x4, 0x94, 0xdd,
0xa2, 0xb3, 0x28, 0x45, 0x3, 0x9f, 0xf9, 0x53, 0xe1, 0xeb, 0x20, 0x96,
0xf9, 0xa9, 0x2a, 0x47, 0x6c, 0x65, 0xb8, 0x79, 0xac, 0x7a, 0x9b, 0x2b,
0xf7, 0xf, 0x39, 0xe2, 0x64, 0x8c, 0x5b, 0x59, 0x11, 0x4a, 0x2, 0x94, 0xb9,
0xf2, 0xd, 0xe9, 0x3d, 0x57, 0x4a, 0x35, 0x94, 0x8d, 0xd, 0x6c, 0xc1, 0xb,
0xba, 0xd3, 0xd5, 0x14, 0x97, 0xed, 0xbd, 0x58, 0xd9, 0x80, 0xc, 0x3f,
0xb5, 0xa8, 0xfc, 0x9d, 0x5d, 0x6c, 0x2a, 0xe5, 0xff, 0xc1, 0xf0, 0x6f}),
E: 65537,
}
func TestKeygrip(t *testing.T) {
expectedKeyGrip := "C729393956A1361239C64EFB3DAC4D3735A003ED"
if keygrip := Keygrip(pubKey); keygrip != expectedKeyGrip {
t.Errorf("expected keygrip %q, but got %q", expectedKeyGrip, keygrip)
}
}