@@ -16,29 +16,17 @@ func TestKeyGeneration(t *testing.T) {
16
16
privateKey := testutils .GenerateKey ()
17
17
18
18
eg := NewTwistedElgamal ()
19
- keyPair , err := eg .KeyGen (* privateKey , DefaultTestDenom )
19
+ keyPair , err := eg .KeyGen (* privateKey )
20
20
require .Nil (t , err )
21
21
22
22
// Test that keyPair is deterministically generated
23
- keyPairAgain , err := eg .KeyGen (* privateKey , DefaultTestDenom )
23
+ keyPairAgain , err := eg .KeyGen (* privateKey )
24
24
require .Nil (t , err )
25
25
require .Equal (t , keyPair , keyPairAgain , "PK should be deterministically generated" )
26
26
27
- // Test that changing the salt should generate a different key
28
- altDenom := "factory/sei1239081236470/testToken1"
29
- keyPairDiffSalt , err := eg .KeyGen (* privateKey , altDenom )
30
- require .Nil (t , err )
31
- require .NotEqual (t , keyPair , keyPairDiffSalt , "PK should be different for different salt" )
32
-
33
- // Test same thing for salt of same length
34
- altDenom = "factory/sei1239081236470/testTokeN"
35
- keyPairDiffSalt , err = eg .KeyGen (* privateKey , altDenom )
36
- require .Nil (t , err )
37
- require .NotEqual (t , keyPair , keyPairDiffSalt , "PK should be different for different salt" )
38
-
39
27
// Test that different privateKey should generate different PK
40
28
altPrivateKey := testutils .GenerateKey ()
41
- keyPairDiffPK , err := eg .KeyGen (* altPrivateKey , altDenom )
29
+ keyPairDiffPK , err := eg .KeyGen (* altPrivateKey )
42
30
require .Nil (t , err )
43
31
require .NotEqual (t , keyPair , keyPairDiffPK , "PK should be different for different ESDCA Private Key" )
44
32
}
@@ -49,8 +37,8 @@ func TestEncryptionDecryption(t *testing.T) {
49
37
50
38
eg := NewTwistedElgamal ()
51
39
52
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
53
- altKeys , _ := eg .KeyGen (* altPrivateKey , DefaultTestDenom )
40
+ keys , _ := eg .KeyGen (* privateKey )
41
+ altKeys , _ := eg .KeyGen (* altPrivateKey )
54
42
55
43
// Happy Path
56
44
value := big .NewInt (108 )
@@ -84,7 +72,7 @@ func Test48BitEncryptionDecryption(t *testing.T) {
84
72
privateKey := testutils .GenerateKey ()
85
73
86
74
eg := NewTwistedElgamal ()
87
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
75
+ keys , _ := eg .KeyGen (* privateKey )
88
76
89
77
// First decrypt a 32 bit number (sets up the decryptor for a later test)
90
78
value := big .NewInt (108092 )
@@ -126,8 +114,8 @@ func TestAddCiphertext(t *testing.T) {
126
114
127
115
eg := NewTwistedElgamal ()
128
116
129
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
130
- altKeys , _ := eg .KeyGen (* altPrivateKey , DefaultTestDenom )
117
+ keys , _ := eg .KeyGen (* privateKey )
118
+ altKeys , _ := eg .KeyGen (* altPrivateKey )
131
119
132
120
// Happy Path
133
121
value1 := big .NewInt (30842 )
@@ -170,7 +158,7 @@ func TestAddCiphertext(t *testing.T) {
170
158
func TestTwistedElGamal_InvalidCiphertext (t * testing.T ) {
171
159
eg := NewTwistedElgamal ()
172
160
privateKey := testutils .GenerateKey ()
173
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
161
+ keys , _ := eg .KeyGen (* privateKey )
174
162
175
163
invalidCt := & Ciphertext {}
176
164
@@ -185,7 +173,7 @@ func TestTwistedElGamal_NilPrivateKey(t *testing.T) {
185
173
186
174
// Generate a valid key pair for comparison
187
175
privateKey := testutils .GenerateKey ()
188
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
176
+ keys , _ := eg .KeyGen (* privateKey )
189
177
190
178
// Encrypt a value with a valid public key
191
179
value := big .NewInt (12345 )
@@ -204,7 +192,7 @@ func TestTwistedElGamal_EncryptDecryptWithRand(t *testing.T) {
204
192
205
193
// Generate a valid key pair for comparison
206
194
privateKey := testutils .GenerateKey ()
207
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
195
+ keys , _ := eg .KeyGen (* privateKey )
208
196
209
197
message := big .NewInt (555555555 )
210
198
randomFactor := curves .ED25519 ().Scalar .Random (rand .Reader )
@@ -222,7 +210,7 @@ func TestTwistedElGamal_EncryptMessageTwice(t *testing.T) {
222
210
223
211
// Generate a valid key pair for comparison
224
212
privateKey := testutils .GenerateKey ()
225
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
213
+ keys , _ := eg .KeyGen (* privateKey )
226
214
227
215
message := big .NewInt (555555555 )
228
216
randomFactor := curve .Scalar .Random (rand .Reader )
@@ -238,7 +226,7 @@ func TestTwistedElGamal_DecryptWithZeroBits(t *testing.T) {
238
226
239
227
// Generate a valid key pair for comparison
240
228
privateKey := testutils .GenerateKey ()
241
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
229
+ keys , _ := eg .KeyGen (* privateKey )
242
230
243
231
message := big .NewInt (555555555 )
244
232
randomFactor := curve .Scalar .Random (rand .Reader )
@@ -264,7 +252,7 @@ func TestTwistedElGamal_EncryptInvalidRandomFactor(t *testing.T) {
264
252
265
253
// Generate a valid key pair for comparison
266
254
privateKey := testutils .GenerateKey ()
267
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
255
+ keys , _ := eg .KeyGen (* privateKey )
268
256
269
257
// Test with nil public key
270
258
_ , _ , err := eg .encryptWithRand (keys .PublicKey , big .NewInt (12345 ), nil )
@@ -277,7 +265,7 @@ func TestTwistedElGamal_EncryptBoundaryValues(t *testing.T) {
277
265
278
266
// Generate a valid key pair for comparison
279
267
privateKey := testutils .GenerateKey ()
280
- keys , _ := eg .KeyGen (* privateKey , DefaultTestDenom )
268
+ keys , _ := eg .KeyGen (* privateKey )
281
269
282
270
// Test with the smallest possible value (0)
283
271
_ , _ , err := eg .Encrypt (keys .PublicKey , big .NewInt (0 ))
0 commit comments