-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdecrypt_test.go
152 lines (134 loc) · 15.9 KB
/
decrypt_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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* Copyright (c) 2019 Zenichi Amano
*
* This file is part of http-ece, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
package httpece
import (
"crypto/ecdh"
"github.com/stretchr/testify/assert"
"strings"
"testing"
)
func TestDecryptWithAESGCM(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
salt := d("mRGYnIzSJGeZnJ19lgQcfw==")
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc8PHBwU=")
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("vOjpVgZE4IYn/uEJKk3DzZ4X+Qr1dgSSUkuIzQE=")
plaintext, err := Decrypt(content,
WithEncoding(AESGCM),
WithSalt(salt),
WithAuthSecret(authSecret),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
if assert.Nil(t, err) {
assert.Equal(t, "hello world", string(plaintext))
}
}
func TestDecryptWithAESGCM_2record(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
salt := d("mRGYnIzSJGeZnJ19lgQcfw==")
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc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NMdHvveFozFG5FWbyyeCaGTmUGcnrW7UDj7YqUeM30NMu6SydDB05HYp5nO7WIlGBY6rdvqYeCrRBn0kH0Op8xTkdZAqZAMBQCF+POUdUi8P//gDocw633HFcZ8fNGyHgKSWAHLTeFXNcLbpEXPEZPyKoFe0CGqRG4N0EHw/HaMgfdxPrQTe4u8OiGpViZQZqz8zRPHssuE")
plaintext, err := Decrypt(content,
WithEncoding(AESGCM),
WithSalt(salt),
WithAuthSecret(authSecret),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
if assert.Nil(t, err) {
assert.Equal(t, strings.Repeat("a", 4095), string(plaintext))
}
}
func TestDecryptWithAESGCM_WrongKey(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
salt := d("mRGYnIzSJGeZnJ19lgQcfw==")
privateKey, _ := randomKey(ecdh.P256())
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("vOjpVgZE4IYn/uEJKk3DzZ4X+Qr1dgSSUkuIzQE=")
plaintext, err := Decrypt(content,
WithEncoding(AESGCM),
WithSalt(salt),
WithAuthSecret(authSecret),
WithPrivate(privateKey.Bytes()),
WithDh(senderPublicKey),
)
assert.EqualError(t, err, "cipher: message authentication failed")
assert.Nil(t, plaintext)
}
func TestDecryptWithAESGCM_NoAuthSecret(t *testing.T) {
salt := d("mRGYnIzSJGeZnJ19lgQcfw==")
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc8PHBwU=")
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("oK6DiDHgs7kq5E+kzbbgJ14m5j9NhR0zYa8YY/c=")
plaintext, err := Decrypt(content,
WithEncoding(AESGCM),
WithSalt(salt),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
if assert.Nil(t, err) {
assert.Equal(t, "hello world", string(plaintext))
}
}
func TestDecryptWithAES128GCM(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc8PHBwU=")
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("mRGYnIzSJGeZnJ19lgQcfwAAEABBBGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhPF+Ah4eiBMGQcXDvtjM/2s1KUn64dsYvM2ljQ1")
plaintext, err := Decrypt(content,
WithEncoding(AES128GCM),
WithAuthSecret(authSecret),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
if assert.Nil(t, err) {
assert.Equalf(t, "hello world", string(plaintext), "")
}
}
func TestDecryptWithAES128GCM_WrongKey(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
privateKey, _ := randomKey(ecdh.P256())
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("mRGYnIzSJGeZnJ19lgQcfwAAEABBBGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhPF+Ah4eiBMGQcXDvtjM/2s1KUn64dsYvM2ljQ1")
plaintext, err := Decrypt(content,
WithEncoding(AES128GCM),
WithAuthSecret(authSecret),
WithPrivate(privateKey.Bytes()),
WithDh(senderPublicKey),
)
assert.EqualError(t, err, "cipher: message authentication failed")
assert.Nil(t, plaintext)
}
func TestDecryptWithAES128GCM_NoAuthSecret(t *testing.T) {
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc8PHBwU=")
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("mRGYnIzSJGeZnJ19lgQcfwAAEABBBGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhPF+Ah4eiBMGQcXDvtjM/2s1KUn64dsYvM2ljQ1")
plaintext, err := Decrypt(content,
WithEncoding(AES128GCM),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
assert.EqualError(t, err, "no authentication secret for webpush")
assert.Nil(t, plaintext)
}
func TestDecryptWithAES128GCMBigRecordSize(t *testing.T) {
authSecret := d("9HcXsQe3xLMG/w2HsYKrOA==")
privateKey := d("yfSYB+/vCEoWklHCG7F99cQ1vRwemFYn87jZc8PHBwU=")
senderPublicKey := d("BGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhM=")
content := d("mRGYnIzSJGeZnJ19lgQcfwAAKABBBGJXZ4zDA04RfSgTufdauZXcNYbe3oF/yEri5ETSuZLDx70gYi7w2ytak8U82H01P1HYnIvr2fEeX7NZpeHdnhPM/AV1dGFaFxQaC5ikxKTLH66XzLRD6a3CrSiDJiVQILaskQ5KTWyD3IT1kCRUkIPQhgHXqQgD4z2RIXxu7OVM3tGTKHKJwhZBj/5CSJvAssg3XRNSzSX2fMv73AdUrY0juSS3PNEDbHbgETzbvIxkdF62YjpJjfcdQgSoLyzzGHfW23P/xYn7wUkqD4qWLz0oN0kuDMPDvoOezjtJbzirQWFP+W3ck9pVV3d1q9Gz/cCSPTL1i7/jL8ZCmjevH9n35tBPH4I+sA3th19g9mh/3QcvK5OHF/I12qBaRl3dVzh42vHIvwwx2DldHloAVADNpC78dYrRggsuvYcFcWBcMJZvF07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kqnNUhVYf+1uWWB9RMk5+4nt6DN9QcjjIE1x/0du+fpNHvW07fGJF13oIYRIqaG8o9UY2saHfwBH7d8EMjXEDkrs8Moo52c/4Le47k2VhoQpKprppVAwtCiw5ZMIpcEmS40HOdQS8eEr+GX6IA4HW3Wg5kkrnocwnIJhGr5Cmy/SHHnTFQw0GUljgum4YpEmbUMRIhjNdpF99YGyTmU5wbcTC0yri7rUqZBkNPZa4CVEjihpNzhNy6OR3it2Ms7PWEHjUu4W8T/04GbUJR+FQrAEVwUZQPjBQoMh6fyvY+yn4Dmkk4GYgOtNQ32u+5sw0jPTMf/UJ6oaRxWjpkEbaOpLziMfMRKx9Gsw7gHFlbutCknyxxo+WLOpzEIx2K2kue3tSe3Q4kk8cR4AvsmovXCv7S2NH/t0fV2INGsMGDImne5GFoXfYCa8uKGCpGMsbe/F8ZRC8loyA5laPKltx6JTvsEt0WT2A8lw3DZ58zQz0XkKuoji0br/m6E/uRUGWoMLsfCslrMHFHNt9ojg0yJLiHXIrUXobG1XQANac84N6+56Z2pmgQkaF6NvV0p1FP6mepLsB3q/YYqzSermCymtuF8BSKc3qqkiqGfwcN03Y9MFsL2/qFB1vO9Ou39URVNv43RVyKsEx4MNeM7y3hbMtngv3JYW7jZ72tCXZ4UAi8xywEMy1Sbl5dHBx2zo32oXqAhXs7ijokoYETT3KGlg54aIdf3tcEtUh6UtP/X7yuPLEwpvCr6JHfY+h5tsyo90389Ri9qHqD+Jki6/H6mlV+3NY5o=")
plaintext, err := Decrypt(content,
WithEncoding(AES128GCM),
WithAuthSecret(authSecret),
WithPrivate(privateKey),
WithDh(senderPublicKey),
)
if assert.Nil(t, err) {
assert.Equalf(t, strings.Repeat("a", 4081), string(plaintext), "")
}
}