Coverage Report

Created: 2023-02-22 06:39

/src/cryptofuzz/operation.cpp
Line
Count
Source (jump to first uncovered line)
1
#include <cryptofuzz/operations.h>
2
#include <cryptofuzz/util.h>
3
#include <cryptofuzz/repository.h>
4
#include <sstream>
5
6
namespace cryptofuzz {
7
namespace operation {
8
9
0
std::string Digest::Name(void) const { return "Digest"; }
10
0
std::string Digest::ToString(void) const {
11
0
    std::stringstream ss;
12
13
0
    ss << "operation name: Digest" << std::endl;
14
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
15
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
16
17
0
    return ss.str();
18
0
}
19
20
0
nlohmann::json Digest::ToJSON(void) const {
21
0
    nlohmann::json j;
22
0
    j["operation"] = "Digest";
23
0
    j["cleartext"] = cleartext.ToJSON();
24
0
    j["digestType"] = digestType.ToJSON();
25
0
    j["modifier"] = modifier.ToJSON();
26
0
    return j;
27
0
}
28
29
0
std::string HMAC::Name(void) const { return "HMAC"; }
30
0
std::string HMAC::ToString(void) const {
31
0
    std::stringstream ss;
32
33
0
    ss << "operation name: HMAC" << std::endl;
34
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
35
0
    ss << "key: " << util::HexDump(cipher.key.Get()) << std::endl;
36
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
37
38
0
    return ss.str();
39
0
}
40
41
0
nlohmann::json HMAC::ToJSON(void) const {
42
0
    nlohmann::json j;
43
0
    j["operation"] = "HMAC";
44
0
    j["cleartext"] = cleartext.ToJSON();
45
0
    j["digestType"] = digestType.ToJSON();
46
0
    j["cipher"] = cipher.ToJSON();
47
0
    j["modifier"] = modifier.ToJSON();
48
0
    return j;
49
0
}
50
51
0
std::string UMAC::Name(void) const { return "UMAC"; }
52
0
std::string UMAC::ToString(void) const {
53
0
    std::stringstream ss;
54
55
0
    ss << "operation name: UMAC" << std::endl;
56
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
57
0
    ss << "key: " << util::HexDump(key.Get()) << std::endl;
58
0
    ss << "iv: " << util::HexDump(iv.Get()) << std::endl;
59
0
    ss << "type: " << std::to_string(type) << std::endl;
60
0
    ss << "outSize: " << std::to_string(outSize) << std::endl;
61
62
0
    return ss.str();
63
0
}
64
65
0
nlohmann::json UMAC::ToJSON(void) const {
66
0
    nlohmann::json j;
67
0
    j["operation"] = "UMAC";
68
0
    j["cleartext"] = cleartext.ToJSON();
69
0
    j["key"] = key.ToJSON();
70
0
    j["iv"] = iv.ToJSON();
71
0
    j["type"] = type;
72
0
    j["outSize"] = outSize;
73
0
    j["modifier"] = modifier.ToJSON();
74
0
    return j;
75
0
}
76
77
0
std::string SymmetricEncrypt::Name(void) const { return "SymmetricEncrypt"; }
78
0
std::string SymmetricEncrypt::ToString(void) const {
79
0
    std::stringstream ss;
80
81
0
    ss << "operation name: SymmetricEncrypt" << std::endl;
82
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
83
0
    ss << "aad: " << (aad ? util::HexDump(aad->Get()) : "nullopt") << std::endl;
84
0
    ss << "cipher iv: " << util::HexDump(cipher.iv.Get()) << std::endl;
85
0
    ss << "cipher key: " << util::HexDump(cipher.key.Get()) << std::endl;
86
0
    ss << "cipher: " << repository::CipherToString(cipher.cipherType.Get()) << std::endl;
87
0
    ss << "ciphertextSize: " << std::to_string(ciphertextSize) << std::endl;
88
0
    ss << "tagSize: " << (tagSize ? std::to_string(*tagSize) : "nullopt") << std::endl;
89
90
0
    return ss.str();
91
0
}
92
93
0
nlohmann::json SymmetricEncrypt::ToJSON(void) const {
94
0
    nlohmann::json j;
95
0
    j["operation"] = "SymmetricEncrypt";
96
0
    j["cleartext"] = cleartext.ToJSON();
97
0
    j["cipher"] = cipher.ToJSON();
98
0
    j["aad_enabled"] = (bool)(aad != std::nullopt);
99
0
    j["aad"] = aad != std::nullopt ? aad->ToJSON() : "";
100
0
    j["ciphertextSize"] = ciphertextSize;
101
0
    j["tagSize_enabled"] = (bool)(tagSize != std::nullopt);
102
0
    j["tagSize"] = tagSize != std::nullopt ? *tagSize : 0;
103
0
    j["modifier"] = modifier.ToJSON();
104
0
    return j;
105
0
}
106
107
0
std::string SymmetricDecrypt::Name(void) const { return "SymmetricDecrypt"; }
108
0
std::string SymmetricDecrypt::ToString(void) const {
109
0
    std::stringstream ss;
110
111
0
    ss << "operation name: SymmetricDecrypt" << std::endl;
112
0
    ss << "ciphertext: " << util::HexDump(ciphertext.Get()) << std::endl;
113
0
    ss << "tag: " << (tag ? util::HexDump(tag->Get()) : "nullopt") << std::endl;
114
0
    ss << "aad: " << (aad ? util::HexDump(aad->Get()) : "nullopt") << std::endl;
115
0
    ss << "cipher iv: " << util::HexDump(cipher.iv.Get()) << std::endl;
116
0
    ss << "cipher key: " << util::HexDump(cipher.key.Get()) << std::endl;
117
0
    ss << "cipher: " << repository::CipherToString(cipher.cipherType.Get()) << std::endl;
118
0
    ss << "cleartextSize: " << std::to_string(cleartextSize) << std::endl;
119
120
0
    return ss.str();
121
0
}
122
123
0
nlohmann::json SymmetricDecrypt::ToJSON(void) const {
124
0
    nlohmann::json j;
125
0
    j["operation"] = "SymmetricDecrypt";
126
0
    j["ciphertext"] = ciphertext.ToJSON();
127
0
    j["cipher"] = cipher.ToJSON();
128
0
    j["aad_enabled"] = (bool)(aad != std::nullopt);
129
0
    j["aad"] = aad != std::nullopt ? aad->ToJSON() : "";
130
0
    j["tag_enabled"] = (bool)(tag != std::nullopt);
131
0
    j["tag"] = tag != std::nullopt ? tag->ToJSON() : "";
132
0
    j["cleartextSize"] = cleartextSize;
133
0
    j["modifier"] = modifier.ToJSON();
134
0
    return j;
135
0
}
136
137
/* Construct SymmetricDecrypt from SymmetricEncrypt */
138
SymmetricDecrypt::SymmetricDecrypt(const SymmetricEncrypt& opSymmetricEncrypt, const component::Ciphertext ciphertext, const uint64_t cleartextSize, std::optional<component::AAD> aad, component::Modifier modifier) :
139
    Operation(std::move(modifier)),
140
    ciphertext(ciphertext.ciphertext),
141
    cipher(opSymmetricEncrypt.cipher),
142
    tag(ciphertext.tag),
143
    aad(aad),
144
    cleartextSize(cleartextSize)
145
0
{ }
146
147
0
std::string KDF_SCRYPT::Name(void) const { return "KDF_SCRYPT"; }
148
0
std::string KDF_SCRYPT::ToString(void) const {
149
0
    std::stringstream ss;
150
151
0
    ss << "operation name: KDF_SCRYPT" << std::endl;
152
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
153
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
154
0
    ss << "N: " << std::to_string(N) << std::endl;
155
0
    ss << "r: " << std::to_string(r) << std::endl;
156
0
    ss << "p: " << std::to_string(p) << std::endl;
157
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
158
159
0
    return ss.str();
160
0
}
161
162
0
nlohmann::json KDF_SCRYPT::ToJSON(void) const {
163
0
    nlohmann::json j;
164
0
    j["operation"] = "KDF_SCRYPT";
165
0
    j["password"] = password.ToJSON();
166
0
    j["salt"] = salt.ToJSON();
167
0
    j["N"] = N;
168
0
    j["r"] = r;
169
0
    j["p"] = p;
170
0
    j["keySize"] = keySize;
171
0
    j["modifier"] = modifier.ToJSON();
172
0
    return j;
173
0
}
174
175
0
std::string KDF_HKDF::Name(void) const { return "KDF_HKDF"; }
176
0
std::string KDF_HKDF::ToString(void) const {
177
0
    std::stringstream ss;
178
179
0
    ss << "operation name: KDF_HKDF" << std::endl;
180
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
181
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
182
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
183
0
    ss << "info: " << util::HexDump(info.Get()) << std::endl;
184
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
185
186
0
    return ss.str();
187
0
}
188
189
0
nlohmann::json KDF_HKDF::ToJSON(void) const {
190
0
    nlohmann::json j;
191
0
    j["operation"] = "KDF_HKDF";
192
0
    j["digestType"] = digestType.ToJSON();
193
0
    j["password"] = password.ToJSON();
194
0
    j["salt"] = salt.ToJSON();
195
0
    j["info"] = info.ToJSON();
196
0
    j["keySize"] = keySize;
197
0
    j["modifier"] = modifier.ToJSON();
198
0
    return j;
199
0
}
200
201
0
std::string KDF_TLS1_PRF::Name(void) const { return "KDF_TLS1_PRF"; }
202
0
std::string KDF_TLS1_PRF::ToString(void) const {
203
0
    std::stringstream ss;
204
205
0
    ss << "operation name: KDF_TLS1_PRF" << std::endl;
206
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
207
0
    ss << "secret: " << util::HexDump(secret.Get()) << std::endl;
208
0
    ss << "seed: " << util::HexDump(seed.Get()) << std::endl;
209
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
210
211
0
    return ss.str();
212
0
}
213
214
0
nlohmann::json KDF_TLS1_PRF::ToJSON(void) const {
215
0
    nlohmann::json j;
216
0
    j["operation"] = "KDF_TLS1_PRF";
217
0
    j["digestType"] = digestType.ToJSON();
218
0
    j["secret"] = secret.ToJSON();
219
0
    j["seed"] = seed.ToJSON();
220
0
    j["keySize"] = keySize;
221
0
    j["modifier"] = modifier.ToJSON();
222
0
    return j;
223
0
}
224
225
0
std::string KDF_PBKDF::Name(void) const { return "KDF_PBKDF"; }
226
0
std::string KDF_PBKDF::ToString(void) const {
227
0
    std::stringstream ss;
228
229
0
    ss << "operation name: KDF_PBKDF" << std::endl;
230
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
231
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
232
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
233
0
    ss << "iterations: " << std::to_string(iterations) << std::endl;
234
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
235
236
0
    return ss.str();
237
0
}
238
239
0
nlohmann::json KDF_PBKDF::ToJSON(void) const {
240
0
    nlohmann::json j;
241
0
    j["operation"] = "KDF_PBKDF";
242
0
    j["digestType"] = digestType.ToJSON();
243
0
    j["password"] = password.ToJSON();
244
0
    j["salt"] = salt.ToJSON();
245
0
    j["iterations"] = iterations;
246
0
    j["keySize"] = keySize;
247
0
    j["modifier"] = modifier.ToJSON();
248
0
    return j;
249
0
}
250
251
0
std::string KDF_PBKDF1::Name(void) const { return "KDF_PBKDF1"; }
252
0
std::string KDF_PBKDF1::ToString(void) const {
253
0
    std::stringstream ss;
254
255
0
    ss << "operation name: KDF_PBKDF1" << std::endl;
256
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
257
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
258
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
259
0
    ss << "iterations: " << std::to_string(iterations) << std::endl;
260
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
261
262
0
    return ss.str();
263
0
}
264
265
0
nlohmann::json KDF_PBKDF1::ToJSON(void) const {
266
0
    nlohmann::json j;
267
0
    j["operation"] = "KDF_PBKDF1";
268
0
    j["digestType"] = digestType.ToJSON();
269
0
    j["password"] = password.ToJSON();
270
0
    j["salt"] = salt.ToJSON();
271
0
    j["iterations"] = iterations;
272
0
    j["keySize"] = keySize;
273
0
    j["modifier"] = modifier.ToJSON();
274
0
    return j;
275
0
}
276
277
0
std::string KDF_PBKDF2::Name(void) const { return "KDF_PBKDF2"; }
278
0
std::string KDF_PBKDF2::ToString(void) const {
279
0
    std::stringstream ss;
280
281
0
    ss << "operation name: KDF_PBKDF2" << std::endl;
282
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
283
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
284
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
285
0
    ss << "iterations: " << std::to_string(iterations) << std::endl;
286
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
287
288
0
    return ss.str();
289
0
}
290
291
0
nlohmann::json KDF_PBKDF2::ToJSON(void) const {
292
0
    nlohmann::json j;
293
0
    j["operation"] = "KDF_PBKDF2";
294
0
    j["digestType"] = digestType.ToJSON();
295
0
    j["password"] = password.ToJSON();
296
0
    j["salt"] = salt.ToJSON();
297
0
    j["iterations"] = iterations;
298
0
    j["keySize"] = keySize;
299
0
    j["modifier"] = modifier.ToJSON();
300
0
    return j;
301
0
}
302
303
0
std::string KDF_ARGON2::Name(void) const { return "KDF_ARGON2"; }
304
0
std::string KDF_ARGON2::ToString(void) const {
305
0
    std::stringstream ss;
306
307
0
    ss << "operation name: KDF_ARGON2" << std::endl;
308
0
    ss << "password: " << util::HexDump(password.Get()) << std::endl;
309
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
310
0
    ss << "type: " << std::to_string(type) << std::endl;
311
0
    ss << "threads: " << std::to_string(threads) << std::endl;
312
0
    ss << "memory: " << std::to_string(memory) << std::endl;
313
0
    ss << "iterations: " << std::to_string(iterations) << std::endl;
314
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
315
316
0
    return ss.str();
317
0
}
318
319
0
nlohmann::json KDF_ARGON2::ToJSON(void) const {
320
0
    nlohmann::json j;
321
0
    j["operation"] = "KDF_ARGON2";
322
0
    j["password"] = password.ToJSON();
323
0
    j["salt"] = salt.ToJSON();
324
0
    j["type"] = type;
325
0
    j["threads"] = threads;
326
0
    j["memory"] = memory;
327
0
    j["iterations"] = iterations;
328
0
    j["modifier"] = modifier.ToJSON();
329
0
    return j;
330
0
}
331
332
0
std::string KDF_SSH::Name(void) const { return "KDF_SSH"; }
333
0
std::string KDF_SSH::ToString(void) const {
334
0
    std::stringstream ss;
335
336
0
    ss << "operation name: KDF_SSH" << std::endl;
337
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
338
0
    ss << "key: " << util::HexDump(key.Get()) << std::endl;
339
0
    ss << "xcghash: " << util::HexDump(xcghash.Get()) << std::endl;
340
0
    ss << "session_id: " << util::HexDump(session_id.Get()) << std::endl;
341
0
    ss << "type: " << util::HexDump(type.Get()) << std::endl;
342
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
343
344
0
    return ss.str();
345
0
}
346
347
0
nlohmann::json KDF_SSH::ToJSON(void) const {
348
0
    nlohmann::json j;
349
0
    j["operation"] = "KDF_SSH";
350
0
    j["digestType"] = digestType.ToJSON();
351
0
    j["key"] = key.ToJSON();
352
0
    j["xcghash"] = xcghash.ToJSON();
353
0
    j["session_id"] = session_id.ToJSON();
354
0
    j["type"] = type.ToJSON();
355
0
    j["keySize"] = keySize;
356
0
    j["modifier"] = modifier.ToJSON();
357
0
    return j;
358
0
}
359
360
0
std::string KDF_X963::Name(void) const { return "KDF_X963"; }
361
0
std::string KDF_X963::ToString(void) const {
362
0
    std::stringstream ss;
363
364
0
    ss << "operation name: KDF_X963" << std::endl;
365
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
366
0
    ss << "secret: " << util::HexDump(secret.Get()) << std::endl;
367
0
    ss << "info: " << util::HexDump(info.Get()) << std::endl;
368
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
369
370
0
    return ss.str();
371
0
}
372
373
0
nlohmann::json KDF_X963::ToJSON(void) const {
374
0
    nlohmann::json j;
375
0
    j["operation"] = "KDF_X963";
376
0
    j["digestType"] = digestType.ToJSON();
377
0
    j["secret"] = secret.ToJSON();
378
0
    j["info"] = info.ToJSON();
379
0
    j["keySize"] = keySize;
380
0
    j["modifier"] = modifier.ToJSON();
381
0
    return j;
382
0
}
383
384
0
std::string KDF_BCRYPT::Name(void) const { return "KDF_BCRYPT"; }
385
0
std::string KDF_BCRYPT::ToString(void) const {
386
0
    std::stringstream ss;
387
388
0
    ss << "operation name: KDF_BCRYPT" << std::endl;
389
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
390
0
    ss << "secret: " << util::HexDump(secret.Get()) << std::endl;
391
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
392
0
    ss << "iterations: " << std::to_string(iterations) << std::endl;
393
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
394
395
0
    return ss.str();
396
0
}
397
398
0
nlohmann::json KDF_BCRYPT::ToJSON(void) const {
399
0
    nlohmann::json j;
400
0
    j["operation"] = "KDF_BCRYPT";
401
0
    j["digestType"] = digestType.ToJSON();
402
0
    j["secret"] = secret.ToJSON();
403
0
    j["salt"] = salt.ToJSON();
404
0
    j["iterations"] = iterations;
405
0
    j["keySize"] = keySize;
406
0
    j["modifier"] = modifier.ToJSON();
407
0
    return j;
408
0
}
409
410
0
std::string KDF_SP_800_108::Name(void) const { return "KDF_SP_800_108"; }
411
0
std::string KDF_SP_800_108::ToString(void) const {
412
0
    std::stringstream ss;
413
414
0
    ss << "operation name: KDF_SP_800_108" << std::endl;
415
0
    ss << "hmac/cmac: " << (mech.mode ? "HMAC" : "CMAC") << std::endl;
416
0
    if ( mech.mode == true ) {
417
0
        ss << "digest: " << repository::DigestToString(mech.type.Get()) << std::endl;
418
0
    } else {
419
0
        ss << "cipher: " << repository::CipherToString(mech.type.Get()) << std::endl;
420
0
    }
421
0
    ss << "secret: " << util::HexDump(secret.Get()) << std::endl;
422
0
    ss << "salt: " << util::HexDump(salt.Get()) << std::endl;
423
0
    ss << "label: " << util::HexDump(label.Get()) << std::endl;
424
0
    ss << "mode: " << std::to_string(mode) << std::endl;
425
0
    ss << "keySize: " << std::to_string(keySize) << std::endl;
426
427
0
    return ss.str();
428
0
}
429
430
0
nlohmann::json KDF_SP_800_108::ToJSON(void) const {
431
0
    nlohmann::json j;
432
0
    j["operation"] = "KDF_SP_800_108";
433
0
    j["mech"] = mech.ToJSON();
434
0
    j["secret"] = secret.ToJSON();
435
0
    j["salt"] = salt.ToJSON();
436
0
    j["label"] = label.ToJSON();
437
0
    j["mode"] = mode;
438
0
    j["modifier"] = modifier.ToJSON();
439
0
    return j;
440
0
}
441
442
0
std::string CMAC::Name(void) const { return "CMAC"; }
443
0
std::string CMAC::ToString(void) const {
444
0
    std::stringstream ss;
445
446
0
    ss << "operation name: CMAC" << std::endl;
447
0
    ss << "cipher iv: " << util::HexDump(cipher.iv.Get()) << std::endl;
448
0
    ss << "cipher key: " << util::HexDump(cipher.key.Get()) << std::endl;
449
0
    ss << "cipher: " << repository::CipherToString(cipher.cipherType.Get()) << std::endl;
450
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
451
0
    ss << "key: " << util::HexDump(cipher.key.Get()) << std::endl;
452
453
0
    return ss.str();
454
0
}
455
456
0
nlohmann::json CMAC::ToJSON(void) const {
457
0
    nlohmann::json j;
458
0
    j["operation"] = "CMAC";
459
0
    j["cleartext"] = cleartext.ToJSON();
460
0
    j["cipher"] = cipher.ToJSON();
461
0
    j["modifier"] = modifier.ToJSON();
462
0
    return j;
463
0
}
464
465
0
std::string ECC_PrivateToPublic::Name(void) const { return "ECC_PrivateToPublic"; }
466
0
std::string ECC_PrivateToPublic::ToString(void) const {
467
0
    std::stringstream ss;
468
469
0
    ss << "operation name: ECC_PrivateToPublic" << std::endl;
470
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
471
0
    ss << "private key: " << priv.ToString() << std::endl;
472
473
0
    return ss.str();
474
0
}
475
476
0
nlohmann::json ECC_PrivateToPublic::ToJSON(void) const {
477
0
    nlohmann::json j;
478
0
    j["operation"] = "ECC_PrivateToPublic";
479
0
    j["priv"] = priv.ToJSON();
480
0
    j["curveType"] = curveType.ToJSON();
481
0
    j["modifier"] = modifier.ToJSON();
482
0
    return j;
483
0
}
484
485
0
std::string ECC_ValidatePubkey::Name(void) const { return "ECC_ValidatePubkey"; }
486
0
std::string ECC_ValidatePubkey::ToString(void) const {
487
0
    std::stringstream ss;
488
489
0
    ss << "operation name: ECC_ValidatePubkey" << std::endl;
490
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
491
0
    ss << "public key X: " << pub.first.ToString() << std::endl;
492
0
    ss << "public key Y: " << pub.second.ToString() << std::endl;
493
494
0
    return ss.str();
495
0
}
496
497
0
nlohmann::json ECC_ValidatePubkey::ToJSON(void) const {
498
0
    nlohmann::json j;
499
0
    j["operation"] = "ECC_ValidatePubkey";
500
0
    j["pub_x"] = pub.first.ToJSON();
501
0
    j["pub_y"] = pub.second.ToJSON();
502
0
    j["curveType"] = curveType.ToJSON();
503
0
    j["modifier"] = modifier.ToJSON();
504
0
    return j;
505
0
}
506
507
0
std::string ECC_GenerateKeyPair::Name(void) const { return "ECC_GenerateKeyPair"; }
508
0
std::string ECC_GenerateKeyPair::ToString(void) const {
509
0
    std::stringstream ss;
510
511
0
    ss << "operation name: ECC_GenerateKeyPair" << std::endl;
512
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
513
514
0
    return ss.str();
515
0
}
516
517
0
nlohmann::json ECC_GenerateKeyPair::ToJSON(void) const {
518
0
    nlohmann::json j;
519
0
    j["operation"] = "ECC_GenerateKeyPair";
520
0
    j["curveType"] = curveType.ToJSON();
521
0
    j["modifier"] = modifier.ToJSON();
522
0
    return j;
523
0
}
524
525
0
std::string ECCSI_Sign::Name(void) const { return "ECCSI_Sign"; }
526
0
std::string ECCSI_Sign::ToString(void) const {
527
0
    std::stringstream ss;
528
529
0
    ss << "operation name: ECCSI_Sign" << std::endl;
530
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
531
0
    ss << "private key: " << priv.ToString() << std::endl;
532
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
533
0
    ss << "id: " << util::HexDump(id.Get()) << std::endl;
534
535
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
536
537
0
    return ss.str();
538
0
}
539
540
0
nlohmann::json ECCSI_Sign::ToJSON(void) const {
541
0
    nlohmann::json j;
542
0
    j["operation"] = "ECCSI_Sign";
543
0
    j["priv"] = priv.ToJSON();
544
0
    j["curveType"] = curveType.ToJSON();
545
0
    j["cleartext"] = cleartext.ToJSON();
546
0
    j["id"] = id.ToJSON();
547
0
    j["digestType"] = digestType.ToJSON();
548
0
    j["modifier"] = modifier.ToJSON();
549
0
    return j;
550
0
}
551
552
0
std::string ECDSA_Sign::Name(void) const { return "ECDSA_Sign"; }
553
0
std::string ECDSA_Sign::ToString(void) const {
554
0
    std::stringstream ss;
555
556
0
    ss << "operation name: ECDSA_Sign" << std::endl;
557
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
558
0
    ss << "nonce: " << nonce.ToString() << std::endl;
559
0
    ss << "private key: " << priv.ToString() << std::endl;
560
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
561
0
    ss << "nonce source: ";
562
0
    if ( UseRandomNonce() ) {
563
0
        ss << "random";
564
0
    } else if ( UseRFC6979Nonce() ) {
565
0
        ss << "RFC 6979";
566
0
    } else if ( UseSpecifiedNonce() ) {
567
0
        ss << "specified";
568
0
    } else {
569
0
        ss << "(unknown)";
570
0
    }
571
0
    ss << std::endl;
572
573
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
574
575
0
    return ss.str();
576
0
}
577
578
0
nlohmann::json ECDSA_Sign::ToJSON(void) const {
579
0
    nlohmann::json j;
580
0
    j["operation"] = "ECDSA_Sign";
581
0
    j["priv"] = priv.ToJSON();
582
0
    j["nonce"] = priv.ToJSON();
583
0
    j["curveType"] = curveType.ToJSON();
584
0
    j["cleartext"] = cleartext.ToJSON();
585
0
    j["nonceSource"] = nonceSource;
586
0
    j["digestType"] = digestType.ToJSON();
587
0
    j["modifier"] = modifier.ToJSON();
588
0
    return j;
589
0
}
590
591
0
std::string ECGDSA_Sign::Name(void) const { return "ECGDSA_Sign"; }
592
0
std::string ECGDSA_Sign::ToString(void) const {
593
0
    std::stringstream ss;
594
595
0
    ss << "operation name: ECGDSA_Sign" << std::endl;
596
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
597
0
    ss << "nonce: " << nonce.ToString() << std::endl;
598
0
    ss << "private key: " << priv.ToString() << std::endl;
599
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
600
0
    ss << "nonce source: ";
601
0
    if ( UseRandomNonce() ) {
602
0
        ss << "random";
603
0
    } else if ( UseRFC6979Nonce() ) {
604
0
        ss << "RFC 6979";
605
0
    } else if ( UseSpecifiedNonce() ) {
606
0
        ss << "specified";
607
0
    } else {
608
0
        ss << "(unknown)";
609
0
    }
610
0
    ss << std::endl;
611
612
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
613
614
0
    return ss.str();
615
0
}
616
617
0
nlohmann::json ECGDSA_Sign::ToJSON(void) const {
618
0
    nlohmann::json j;
619
0
    j["operation"] = "ECGDSA_Sign";
620
0
    j["priv"] = priv.ToJSON();
621
0
    j["nonce"] = priv.ToJSON();
622
0
    j["curveType"] = curveType.ToJSON();
623
0
    j["cleartext"] = cleartext.ToJSON();
624
0
    j["nonceSource"] = nonceSource;
625
0
    j["digestType"] = digestType.ToJSON();
626
0
    j["modifier"] = modifier.ToJSON();
627
0
    return j;
628
0
}
629
630
0
std::string ECRDSA_Sign::Name(void) const { return "ECRDSA_Sign"; }
631
0
std::string ECRDSA_Sign::ToString(void) const {
632
0
    std::stringstream ss;
633
634
0
    ss << "operation name: ECRDSA_Sign" << std::endl;
635
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
636
0
    ss << "nonce: " << nonce.ToString() << std::endl;
637
0
    ss << "private key: " << priv.ToString() << std::endl;
638
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
639
0
    ss << "nonce source: ";
640
0
    if ( UseRandomNonce() ) {
641
0
        ss << "random";
642
0
    } else if ( UseRFC6979Nonce() ) {
643
0
        ss << "RFC 6979";
644
0
    } else if ( UseSpecifiedNonce() ) {
645
0
        ss << "specified";
646
0
    } else {
647
0
        ss << "(unknown)";
648
0
    }
649
0
    ss << std::endl;
650
651
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
652
653
0
    return ss.str();
654
0
}
655
656
0
nlohmann::json ECRDSA_Sign::ToJSON(void) const {
657
0
    nlohmann::json j;
658
0
    j["operation"] = "ECRDSA_Sign";
659
0
    j["priv"] = priv.ToJSON();
660
0
    j["nonce"] = priv.ToJSON();
661
0
    j["curveType"] = curveType.ToJSON();
662
0
    j["cleartext"] = cleartext.ToJSON();
663
0
    j["nonceSource"] = nonceSource;
664
0
    j["digestType"] = digestType.ToJSON();
665
0
    j["modifier"] = modifier.ToJSON();
666
0
    return j;
667
0
}
668
669
0
std::string Schnorr_Sign::Name(void) const { return "Schnorr_Sign"; }
670
0
std::string Schnorr_Sign::ToString(void) const {
671
0
    std::stringstream ss;
672
673
0
    ss << "operation name: Schnorr_Sign" << std::endl;
674
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
675
0
    ss << "nonce: " << nonce.ToString() << std::endl;
676
0
    ss << "private key: " << priv.ToString() << std::endl;
677
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
678
0
    ss << "nonce source: ";
679
0
    if ( UseRandomNonce() ) {
680
0
        ss << "random";
681
0
    } else if ( UseBIP340Nonce() ) {
682
0
        ss << "BIP 340";
683
0
    } else if ( UseSpecifiedNonce() ) {
684
0
        ss << "specified";
685
0
    } else {
686
0
        ss << "(unknown)";
687
0
    }
688
0
    ss << std::endl;
689
690
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
691
692
0
    return ss.str();
693
0
}
694
695
0
nlohmann::json Schnorr_Sign::ToJSON(void) const {
696
0
    nlohmann::json j;
697
0
    j["operation"] = "Schnorr_Sign";
698
0
    j["priv"] = priv.ToJSON();
699
0
    j["nonce"] = priv.ToJSON();
700
0
    j["curveType"] = curveType.ToJSON();
701
0
    j["cleartext"] = cleartext.ToJSON();
702
0
    j["nonceSource"] = nonceSource;
703
0
    j["digestType"] = digestType.ToJSON();
704
0
    j["modifier"] = modifier.ToJSON();
705
0
    return j;
706
0
}
707
708
0
std::string ECCSI_Verify::Name(void) const { return "ECCSI_Verify"; }
709
0
std::string ECCSI_Verify::ToString(void) const {
710
0
    std::stringstream ss;
711
712
0
    ss << "operation name: ECCSI_Verify" << std::endl;
713
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
714
0
    ss << "public key X: " << signature.pub.first.ToString() << std::endl;
715
0
    ss << "public key Y: " << signature.pub.second.ToString() << std::endl;
716
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
717
0
    ss << "id: " << util::HexDump(id.Get()) << std::endl;
718
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
719
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
720
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
721
722
0
    return ss.str();
723
0
}
724
725
0
nlohmann::json ECCSI_Verify::ToJSON(void) const {
726
0
    nlohmann::json j;
727
0
    j["operation"] = "ECCSI_Verify";
728
0
    j["curveType"] = curveType.ToJSON();
729
0
    j["pub_x"] = signature.pub.first.ToJSON();
730
0
    j["pub_y"] = signature.pub.second.ToJSON();
731
0
    j["cleartext"] = cleartext.ToJSON();
732
0
    j["id"] = id.ToJSON();
733
0
    j["sig_r"] = signature.signature.first.ToJSON();
734
0
    j["sig_s"] = signature.signature.second.ToJSON();
735
0
    j["digestType"] = digestType.ToJSON();
736
0
    j["modifier"] = modifier.ToJSON();
737
0
    return j;
738
0
}
739
740
/* Construct ECCSI_Verify from ECCSI_Sign */
741
ECCSI_Verify::ECCSI_Verify(const ECCSI_Sign& opECCSI_Sign, const component::ECCSI_Signature signature, component::Modifier modifier) :
742
    Operation(std::move(modifier)),
743
    curveType(opECCSI_Sign.curveType),
744
    cleartext(opECCSI_Sign.cleartext),
745
    id(opECCSI_Sign.id),
746
    signature(signature),
747
    digestType(opECCSI_Sign.digestType)
748
0
{ }
749
750
0
std::string ECDSA_Verify::Name(void) const { return "ECDSA_Verify"; }
751
0
std::string ECDSA_Verify::ToString(void) const {
752
0
    std::stringstream ss;
753
754
0
    ss << "operation name: ECDSA_Verify" << std::endl;
755
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
756
0
    ss << "public key X: " << signature.pub.first.ToString() << std::endl;
757
0
    ss << "public key Y: " << signature.pub.second.ToString() << std::endl;
758
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
759
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
760
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
761
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
762
763
0
    return ss.str();
764
0
}
765
766
0
nlohmann::json ECDSA_Verify::ToJSON(void) const {
767
0
    nlohmann::json j;
768
0
    j["operation"] = "ECDSA_Verify";
769
0
    j["curveType"] = curveType.ToJSON();
770
0
    j["pub_x"] = signature.pub.first.ToJSON();
771
0
    j["pub_y"] = signature.pub.second.ToJSON();
772
0
    j["cleartext"] = cleartext.ToJSON();
773
0
    j["sig_r"] = signature.signature.first.ToJSON();
774
0
    j["sig_s"] = signature.signature.second.ToJSON();
775
0
    j["digestType"] = digestType.ToJSON();
776
0
    j["modifier"] = modifier.ToJSON();
777
0
    return j;
778
0
}
779
780
/* Construct ECDSA_Verify from ECDSA_Sign */
781
ECDSA_Verify::ECDSA_Verify(const ECDSA_Sign& opECDSA_Sign, const component::ECDSA_Signature signature, component::Modifier modifier) :
782
    Operation(std::move(modifier)),
783
    curveType(opECDSA_Sign.curveType),
784
    cleartext(opECDSA_Sign.cleartext),
785
    signature(signature),
786
    digestType(opECDSA_Sign.digestType)
787
895
{ }
788
789
0
std::string ECGDSA_Verify::Name(void) const { return "ECGDSA_Verify"; }
790
0
std::string ECGDSA_Verify::ToString(void) const {
791
0
    std::stringstream ss;
792
793
0
    ss << "operation name: ECGDSA_Verify" << std::endl;
794
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
795
0
    ss << "public key X: " << signature.pub.first.ToString() << std::endl;
796
0
    ss << "public key Y: " << signature.pub.second.ToString() << std::endl;
797
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
798
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
799
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
800
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
801
802
0
    return ss.str();
803
0
}
804
805
0
nlohmann::json ECGDSA_Verify::ToJSON(void) const {
806
0
    nlohmann::json j;
807
0
    j["operation"] = "ECGDSA_Verify";
808
0
    j["curveType"] = curveType.ToJSON();
809
0
    j["pub_x"] = signature.pub.first.ToJSON();
810
0
    j["pub_y"] = signature.pub.second.ToJSON();
811
0
    j["cleartext"] = cleartext.ToJSON();
812
0
    j["sig_r"] = signature.signature.first.ToJSON();
813
0
    j["sig_s"] = signature.signature.second.ToJSON();
814
0
    j["digestType"] = digestType.ToJSON();
815
0
    j["modifier"] = modifier.ToJSON();
816
0
    return j;
817
0
}
818
819
0
std::string ECRDSA_Verify::Name(void) const { return "ECRDSA_Verify"; }
820
0
std::string ECRDSA_Verify::ToString(void) const {
821
0
    std::stringstream ss;
822
823
0
    ss << "operation name: ECRDSA_Verify" << std::endl;
824
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
825
0
    ss << "public key X: " << signature.pub.first.ToString() << std::endl;
826
0
    ss << "public key Y: " << signature.pub.second.ToString() << std::endl;
827
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
828
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
829
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
830
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
831
832
0
    return ss.str();
833
0
}
834
835
0
nlohmann::json ECRDSA_Verify::ToJSON(void) const {
836
0
    nlohmann::json j;
837
0
    j["operation"] = "ECRDSA_Verify";
838
0
    j["curveType"] = curveType.ToJSON();
839
0
    j["pub_x"] = signature.pub.first.ToJSON();
840
0
    j["pub_y"] = signature.pub.second.ToJSON();
841
0
    j["cleartext"] = cleartext.ToJSON();
842
0
    j["sig_r"] = signature.signature.first.ToJSON();
843
0
    j["sig_s"] = signature.signature.second.ToJSON();
844
0
    j["digestType"] = digestType.ToJSON();
845
0
    j["modifier"] = modifier.ToJSON();
846
0
    return j;
847
0
}
848
849
0
std::string Schnorr_Verify::Name(void) const { return "Schnorr_Verify"; }
850
0
std::string Schnorr_Verify::ToString(void) const {
851
0
    std::stringstream ss;
852
853
0
    ss << "operation name: Schnorr_Verify" << std::endl;
854
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
855
0
    ss << "public key X: " << signature.pub.first.ToString() << std::endl;
856
0
    ss << "public key Y: " << signature.pub.second.ToString() << std::endl;
857
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
858
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
859
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
860
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
861
862
0
    return ss.str();
863
0
}
864
865
0
nlohmann::json Schnorr_Verify::ToJSON(void) const {
866
0
    nlohmann::json j;
867
0
    j["operation"] = "Schnorr_Verify";
868
0
    j["curveType"] = curveType.ToJSON();
869
0
    j["pub_x"] = signature.pub.first.ToJSON();
870
0
    j["pub_y"] = signature.pub.second.ToJSON();
871
0
    j["cleartext"] = cleartext.ToJSON();
872
0
    j["sig_r"] = signature.signature.first.ToJSON();
873
0
    j["sig_s"] = signature.signature.second.ToJSON();
874
0
    j["digestType"] = digestType.ToJSON();
875
0
    j["modifier"] = modifier.ToJSON();
876
0
    return j;
877
0
}
878
879
0
std::string ECDSA_Recover::Name(void) const { return "ECDSA_Recover"; }
880
0
std::string ECDSA_Recover::ToString(void) const {
881
0
    std::stringstream ss;
882
883
0
    ss << "operation name: ECDSA_Recover" << std::endl;
884
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
885
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
886
0
    ss << "signature R: " << signature.first.ToString() << std::endl;
887
0
    ss << "signature S: " << signature.second.ToString() << std::endl;
888
0
    ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;
889
0
    ss << "recovery ID: " << std::to_string(id) << std::endl;
890
891
0
    return ss.str();
892
0
}
893
894
0
nlohmann::json ECDSA_Recover::ToJSON(void) const {
895
0
    nlohmann::json j;
896
0
    j["operation"] = "ECDSA_Recover";
897
0
    j["curveType"] = curveType.ToJSON();
898
0
    j["cleartext"] = cleartext.ToJSON();
899
0
    j["sig_r"] = signature.first.ToJSON();
900
0
    j["sig_s"] = signature.second.ToJSON();
901
0
    j["digestType"] = digestType.ToJSON();
902
0
    j["modifier"] = modifier.ToJSON();
903
0
    return j;
904
0
}
905
906
0
std::string DSA_Verify::Name(void) const { return "DSA_Verify"; }
907
0
std::string DSA_Verify::ToString(void) const {
908
0
    std::stringstream ss;
909
910
0
    ss << "operation name: DSA_Verify" << std::endl;
911
0
    ss << "p: " << parameters.p.ToString() << std::endl;
912
0
    ss << "q: " << parameters.q.ToString() << std::endl;
913
0
    ss << "g: " << parameters.g.ToString() << std::endl;
914
0
    ss << "public key: " << pub.ToString() << std::endl;
915
0
    ss << "r: " << signature.first.ToString() << std::endl;
916
0
    ss << "s: " << signature.second.ToString() << std::endl;
917
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
918
919
0
    return ss.str();
920
0
}
921
922
0
nlohmann::json DSA_Verify::ToJSON(void) const {
923
0
    nlohmann::json j;
924
0
    j["p"] = parameters.p.ToJSON();
925
0
    j["q"] = parameters.q.ToJSON();
926
0
    j["g"] = parameters.g.ToJSON();
927
0
    j["pub"] = pub.ToJSON();
928
0
    j["r"] = signature.first.ToJSON();
929
0
    j["s"] = signature.second.ToJSON();
930
0
    j["cleartext"] = cleartext.ToJSON();
931
0
    j["modifier"] = modifier.ToJSON();
932
0
    return j;
933
0
}
934
935
0
std::string DSA_Sign::Name(void) const { return "DSA_Sign"; }
936
0
std::string DSA_Sign::ToString(void) const {
937
0
    std::stringstream ss;
938
939
0
    ss << "operation name: DSA_Sign" << std::endl;
940
0
    ss << "p: " << parameters.p.ToString() << std::endl;
941
0
    ss << "q: " << parameters.q.ToString() << std::endl;
942
0
    ss << "g: " << parameters.g.ToString() << std::endl;
943
0
    ss << "private key: " << priv.ToString() << std::endl;
944
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
945
946
0
    return ss.str();
947
0
}
948
949
0
nlohmann::json DSA_Sign::ToJSON(void) const {
950
0
    nlohmann::json j;
951
0
    j["p"] = parameters.p.ToJSON();
952
0
    j["q"] = parameters.q.ToJSON();
953
0
    j["g"] = parameters.g.ToJSON();
954
0
    j["priv"] = priv.ToJSON();
955
0
    j["cleartext"] = cleartext.ToJSON();
956
0
    j["modifier"] = modifier.ToJSON();
957
0
    return j;
958
0
}
959
960
0
std::string DSA_PrivateToPublic::Name(void) const { return "DSA_PrivateToPublic"; }
961
0
std::string DSA_PrivateToPublic::ToString(void) const {
962
0
    std::stringstream ss;
963
964
0
    ss << "operation name: DSA_PrivateToPublic" << std::endl;
965
0
    ss << "priv: " << priv.ToString() << std::endl;
966
967
0
    return ss.str();
968
0
}
969
970
0
nlohmann::json DSA_PrivateToPublic::ToJSON(void) const {
971
0
    nlohmann::json j;
972
0
    j["priv"] = priv.ToJSON();
973
0
    j["modifier"] = modifier.ToJSON();
974
0
    return j;
975
0
}
976
977
0
std::string DSA_GenerateKeyPair::Name(void) const { return "DSA_GenerateKeyPair"; }
978
0
std::string DSA_GenerateKeyPair::ToString(void) const {
979
0
    std::stringstream ss;
980
981
0
    ss << "operation name: DSA_GenerateKeyPair" << std::endl;
982
0
    ss << "p: " << p.ToString() << std::endl;
983
0
    ss << "q: " << q.ToString() << std::endl;
984
0
    ss << "g: " << g.ToString() << std::endl;
985
986
0
    return ss.str();
987
0
}
988
989
0
nlohmann::json DSA_GenerateKeyPair::ToJSON(void) const {
990
0
    nlohmann::json j;
991
0
    j["p"] = p.ToJSON();
992
0
    j["q"] = q.ToJSON();
993
0
    j["g"] = g.ToJSON();
994
0
    j["modifier"] = modifier.ToJSON();
995
0
    return j;
996
0
}
997
998
0
std::string DSA_GenerateParameters::Name(void) const { return "DSA_GenerateParameters"; }
999
0
std::string DSA_GenerateParameters::ToString(void) const {
1000
0
    std::stringstream ss;
1001
1002
0
    ss << "operation name: DSA_GenerateParameters" << std::endl;
1003
1004
0
    return ss.str();
1005
0
}
1006
1007
0
nlohmann::json DSA_GenerateParameters::ToJSON(void) const {
1008
0
    nlohmann::json j;
1009
0
    j["modifier"] = modifier.ToJSON();
1010
0
    return j;
1011
0
}
1012
1013
0
std::string ECDH_Derive::Name(void) const { return "ECDH_Derive"; }
1014
0
std::string ECDH_Derive::ToString(void) const {
1015
0
    std::stringstream ss;
1016
1017
0
    ss << "operation name: ECDH_Derive" << std::endl;
1018
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1019
0
    ss << "private key: " << priv.ToString() << std::endl;
1020
0
    ss << "public key X: " << pub.first.ToString() << std::endl;
1021
0
    ss << "public key Y: " << pub.second.ToString() << std::endl;
1022
1023
0
    return ss.str();
1024
0
}
1025
1026
0
nlohmann::json ECDH_Derive::ToJSON(void) const {
1027
0
    nlohmann::json j;
1028
0
    j["operation"] = "ECDH_Derive";
1029
0
    j["curveType"] = curveType.ToJSON();
1030
0
    j["priv"] = priv.ToJSON();
1031
0
    j["pub_x"] = pub.first.ToJSON();
1032
0
    j["pub_y"] = pub.second.ToJSON();
1033
0
    j["modifier"] = modifier.ToJSON();
1034
0
    return j;
1035
0
}
1036
1037
0
std::string ECIES_Encrypt::Name(void) const { return "ECIES_Encrypt"; }
1038
0
std::string ECIES_Encrypt::ToString(void) const {
1039
0
    std::stringstream ss;
1040
1041
0
    ss << "operation name: ECIES_Encrypt" << std::endl;
1042
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
1043
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1044
0
    ss << "private key: " << priv.ToString() << std::endl;
1045
0
    ss << "public key X: " << pub.first.ToString() << std::endl;
1046
0
    ss << "public key Y: " << pub.second.ToString() << std::endl;
1047
0
    ss << "cipher: " << repository::CipherToString(cipherType.Get()) << std::endl;
1048
0
    ss << "iv: " << (iv ? util::HexDump(iv->Get()) : "nullopt") << std::endl;
1049
1050
0
    return ss.str();
1051
0
}
1052
1053
0
nlohmann::json ECIES_Encrypt::ToJSON(void) const {
1054
0
    nlohmann::json j;
1055
0
    j["operation"] = "ECIES_Encrypt";
1056
0
    j["cleartext"] = cleartext.ToJSON();
1057
0
    j["curveType"] = curveType.ToJSON();
1058
0
    j["priv"] = priv.ToJSON();
1059
0
    j["pub_x"] = pub.first.ToJSON();
1060
0
    j["pub_y"] = pub.second.ToJSON();
1061
0
    j["cipherType"] = cipherType.ToJSON();
1062
0
    j["iv_enabled"] = (bool)(iv != std::nullopt);
1063
0
    j["iv"] = iv != std::nullopt ? iv->ToJSON() : "";
1064
0
    j["modifier"] = modifier.ToJSON();
1065
0
    return j;
1066
0
}
1067
1068
0
std::string ECIES_Decrypt::Name(void) const { return "ECIES_Decrypt"; }
1069
0
std::string ECIES_Decrypt::ToString(void) const {
1070
0
    std::stringstream ss;
1071
1072
0
    ss << "operation name: ECIES_Decrypt" << std::endl;
1073
0
    ss << "ciphertext: " << util::HexDump(ciphertext.Get()) << std::endl;
1074
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1075
0
    ss << "private key: " << priv.ToString() << std::endl;
1076
0
    ss << "public key X: " << pub.first.ToString() << std::endl;
1077
0
    ss << "public key Y: " << pub.second.ToString() << std::endl;
1078
0
    ss << "cipher: " << repository::CipherToString(cipherType.Get()) << std::endl;
1079
0
    ss << "iv: " << (iv ? util::HexDump(iv->Get()) : "nullopt") << std::endl;
1080
1081
0
    return ss.str();
1082
0
}
1083
1084
0
nlohmann::json ECIES_Decrypt::ToJSON(void) const {
1085
0
    nlohmann::json j;
1086
0
    j["operation"] = "ECIES_Decrypt";
1087
0
    j["ciphertext"] = ciphertext.ToJSON();
1088
0
    j["curveType"] = curveType.ToJSON();
1089
0
    j["priv"] = priv.ToJSON();
1090
0
    j["pub_x"] = pub.first.ToJSON();
1091
0
    j["pub_y"] = pub.second.ToJSON();
1092
0
    j["cipherType"] = cipherType.ToJSON();
1093
0
    j["iv_enabled"] = (bool)(iv != std::nullopt);
1094
0
    j["iv"] = iv != std::nullopt ? iv->ToJSON() : "";
1095
0
    j["modifier"] = modifier.ToJSON();
1096
0
    return j;
1097
0
}
1098
1099
0
std::string ECC_Point_Add::Name(void) const { return "ECC_Point_Add"; }
1100
0
std::string ECC_Point_Add::ToString(void) const {
1101
0
    std::stringstream ss;
1102
1103
0
    ss << "operation name: ECC_Point_Add" << std::endl;
1104
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1105
0
    ss << "A X: " << a.first.ToString() << std::endl;
1106
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1107
0
    ss << "B X: " << b.first.ToString() << std::endl;
1108
0
    ss << "B Y: " << b.second.ToString() << std::endl;
1109
1110
0
    return ss.str();
1111
0
}
1112
1113
0
nlohmann::json ECC_Point_Add::ToJSON(void) const {
1114
0
    nlohmann::json j;
1115
0
    j["operation"] = "ECC_Point_Add";
1116
0
    j["curveType"] = curveType.ToJSON();
1117
1118
0
    j["a_x"] = a.first.ToJSON();
1119
0
    j["a_y"] = a.second.ToJSON();
1120
1121
0
    j["b_x"] = b.first.ToJSON();
1122
0
    j["b_y"] = b.second.ToJSON();
1123
1124
0
    j["modifier"] = modifier.ToJSON();
1125
0
    return j;
1126
0
}
1127
1128
0
std::string ECC_Point_Mul::Name(void) const { return "ECC_Point_Mul"; }
1129
0
std::string ECC_Point_Mul::ToString(void) const {
1130
0
    std::stringstream ss;
1131
1132
0
    ss << "operation name: ECC_Point_Mul" << std::endl;
1133
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1134
0
    ss << "A X: " << a.first.ToString() << std::endl;
1135
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1136
0
    ss << "B: " << b.ToString() << std::endl;
1137
1138
0
    return ss.str();
1139
0
}
1140
1141
0
nlohmann::json ECC_Point_Mul::ToJSON(void) const {
1142
0
    nlohmann::json j;
1143
0
    j["operation"] = "ECC_Point_Mul";
1144
0
    j["curveType"] = curveType.ToJSON();
1145
1146
0
    j["a_x"] = a.first.ToJSON();
1147
0
    j["a_y"] = a.second.ToJSON();
1148
1149
0
    j["b"] = b.ToJSON();
1150
1151
0
    j["modifier"] = modifier.ToJSON();
1152
0
    return j;
1153
0
}
1154
1155
0
std::string ECC_Point_Neg::Name(void) const { return "ECC_Point_Neg"; }
1156
0
std::string ECC_Point_Neg::ToString(void) const {
1157
0
    std::stringstream ss;
1158
1159
0
    ss << "operation name: ECC_Point_Neg" << std::endl;
1160
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1161
0
    ss << "A X: " << a.first.ToString() << std::endl;
1162
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1163
1164
0
    return ss.str();
1165
0
}
1166
1167
0
nlohmann::json ECC_Point_Neg::ToJSON(void) const {
1168
0
    nlohmann::json j;
1169
0
    j["curveType"] = curveType.ToJSON();
1170
1171
0
    j["a_x"] = a.first.ToJSON();
1172
0
    j["a_y"] = a.second.ToJSON();
1173
1174
0
    j["modifier"] = modifier.ToJSON();
1175
0
    return j;
1176
0
}
1177
1178
0
std::string ECC_Point_Dbl::Name(void) const { return "ECC_Point_Dbl"; }
1179
0
std::string ECC_Point_Dbl::ToString(void) const {
1180
0
    std::stringstream ss;
1181
1182
0
    ss << "operation name: ECC_Point_Dbl" << std::endl;
1183
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1184
0
    ss << "A X: " << a.first.ToString() << std::endl;
1185
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1186
1187
0
    return ss.str();
1188
0
}
1189
1190
0
nlohmann::json ECC_Point_Dbl::ToJSON(void) const {
1191
0
    nlohmann::json j;
1192
0
    j["curveType"] = curveType.ToJSON();
1193
1194
0
    j["a_x"] = a.first.ToJSON();
1195
0
    j["a_y"] = a.second.ToJSON();
1196
1197
0
    j["modifier"] = modifier.ToJSON();
1198
0
    return j;
1199
0
}
1200
1201
0
std::string ECC_Point_Cmp::Name(void) const { return "ECC_Point_Cmp"; }
1202
0
std::string ECC_Point_Cmp::ToString(void) const {
1203
0
    std::stringstream ss;
1204
1205
0
    ss << "operation name: ECC_Point_Cmp" << std::endl;
1206
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1207
0
    ss << "A X: " << a.first.ToString() << std::endl;
1208
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1209
0
    ss << "B X: " << b.first.ToString() << std::endl;
1210
0
    ss << "B Y: " << b.second.ToString() << std::endl;
1211
1212
0
    return ss.str();
1213
0
}
1214
1215
0
nlohmann::json ECC_Point_Cmp::ToJSON(void) const {
1216
0
    nlohmann::json j;
1217
0
    j["operation"] = "ECC_Point_Cmp";
1218
0
    j["curveType"] = curveType.ToJSON();
1219
1220
0
    j["a_x"] = a.first.ToJSON();
1221
0
    j["a_y"] = a.second.ToJSON();
1222
1223
0
    j["b_x"] = b.first.ToJSON();
1224
0
    j["b_y"] = b.second.ToJSON();
1225
1226
0
    j["modifier"] = modifier.ToJSON();
1227
0
    return j;
1228
0
}
1229
1230
0
std::string DH_GenerateKeyPair::Name(void) const { return "DH_GenerateKeyPair"; }
1231
0
std::string DH_GenerateKeyPair::ToString(void) const {
1232
0
    std::stringstream ss;
1233
1234
0
    ss << "operation name: DH_GenerateKeyPair" << std::endl;
1235
0
    ss << "prime: " << prime.ToString() << std::endl;
1236
0
    ss << "base: " << base.ToString() << std::endl;
1237
1238
0
    return ss.str();
1239
0
}
1240
1241
0
nlohmann::json DH_GenerateKeyPair::ToJSON(void) const {
1242
0
    nlohmann::json j;
1243
0
    j["operation"] = "DH_GenerateKeyPair";
1244
0
    j["prime"] = prime.ToJSON();
1245
0
    j["base"] = base.ToJSON();
1246
0
    j["modifier"] = modifier.ToJSON();
1247
0
    return j;
1248
0
}
1249
1250
0
std::string DH_Derive::Name(void) const { return "DH_Derive"; }
1251
0
std::string DH_Derive::ToString(void) const {
1252
0
    std::stringstream ss;
1253
1254
0
    ss << "operation name: DH_Derive" << std::endl;
1255
0
    ss << "prime: " << prime.ToString() << std::endl;
1256
0
    ss << "base: " << base.ToString() << std::endl;
1257
0
    ss << "public key: " << pub.ToString() << std::endl;
1258
0
    ss << "private key: " << priv.ToString() << std::endl;
1259
1260
0
    return ss.str();
1261
0
}
1262
1263
0
nlohmann::json DH_Derive::ToJSON(void) const {
1264
0
    nlohmann::json j;
1265
0
    j["operation"] = "DH_Derive";
1266
0
    j["prime"] = prime.ToJSON();
1267
0
    j["base"] = base.ToJSON();
1268
0
    j["pub"] = pub.ToJSON();
1269
0
    j["priv"] = priv.ToJSON();
1270
0
    j["modifier"] = modifier.ToJSON();
1271
0
    return j;
1272
0
}
1273
1274
0
std::string BignumCalc::Name(void) const { return "BignumCalc"; }
1275
0
std::string BignumCalc::ToString(void) const {
1276
0
    std::stringstream ss;
1277
1278
0
    ss << "operation name: BignumCalc" << std::endl;
1279
0
    ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;
1280
0
    ss << "bignum 1: " << bn0.ToString() << std::endl;
1281
0
    ss << "bignum 2: " << bn1.ToString() << std::endl;
1282
0
    ss << "bignum 3: " << bn2.ToString() << std::endl;
1283
0
    ss << "bignum 4: " << bn3.ToString() << std::endl;
1284
1285
0
    return ss.str();
1286
0
}
1287
1288
0
nlohmann::json BignumCalc::ToJSON(void) const {
1289
0
    nlohmann::json j;
1290
0
    j["operation"] = "BignumCalc";
1291
0
    j["calcOp"] = calcOp.ToJSON();
1292
0
    j["bn0"] = bn0.ToJSON();
1293
0
    j["bn1"] = bn1.ToJSON();
1294
0
    j["bn2"] = bn2.ToJSON();
1295
0
    j["bn3"] = bn3.ToJSON();
1296
0
    j["modifier"] = modifier.ToJSON();
1297
0
    return j;
1298
0
}
1299
1300
0
std::string BignumCalc_Fp2::Name(void) const { return "BignumCalc_Fp2"; }
1301
0
std::string BignumCalc_Fp2::ToString(void) const {
1302
0
    std::stringstream ss;
1303
1304
0
    ss << "operation name: BignumCalc_Fp2" << std::endl;
1305
0
    ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;
1306
0
    ss << "Fp2 1 x: " << bn0.first.ToString() << std::endl;
1307
0
    ss << "Fp2 1 x: " << bn0.second.ToString() << std::endl;
1308
0
    ss << "Fp2 2 x: " << bn1.first.ToString() << std::endl;
1309
0
    ss << "Fp2 2 x: " << bn1.second.ToString() << std::endl;
1310
0
    ss << "Fp2 3 x: " << bn2.first.ToString() << std::endl;
1311
0
    ss << "Fp2 3 x: " << bn2.second.ToString() << std::endl;
1312
0
    ss << "Fp2 4 x: " << bn3.first.ToString() << std::endl;
1313
0
    ss << "Fp2 4 x: " << bn3.second.ToString() << std::endl;
1314
1315
0
    return ss.str();
1316
0
}
1317
1318
0
nlohmann::json BignumCalc_Fp2::ToJSON(void) const {
1319
0
    nlohmann::json j;
1320
    /* TODO */
1321
0
    return j;
1322
0
}
1323
1324
0
std::string BignumCalc_Fp12::Name(void) const { return "BignumCalc_Fp12"; }
1325
0
std::string BignumCalc_Fp12::ToString(void) const {
1326
0
    std::stringstream ss;
1327
1328
0
    ss << "operation name: BignumCalc_Fp12" << std::endl;
1329
0
    ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;
1330
0
    ss << "bn0 1: " << bn0.bn1.ToString() << std::endl;
1331
0
    ss << "bn0 2: " << bn0.bn2.ToString() << std::endl;
1332
0
    ss << "bn0 3: " << bn0.bn3.ToString() << std::endl;
1333
0
    ss << "bn0 4: " << bn0.bn4.ToString() << std::endl;
1334
0
    ss << "bn0 5: " << bn0.bn5.ToString() << std::endl;
1335
0
    ss << "bn0 6: " << bn0.bn6.ToString() << std::endl;
1336
0
    ss << "bn0 7: " << bn0.bn7.ToString() << std::endl;
1337
0
    ss << "bn0 8: " << bn0.bn8.ToString() << std::endl;
1338
0
    ss << "bn0 9: " << bn0.bn9.ToString() << std::endl;
1339
0
    ss << "bn0 10: " << bn0.bn10.ToString() << std::endl;
1340
0
    ss << "bn0 11: " << bn0.bn11.ToString() << std::endl;
1341
0
    ss << "bn0 12: " << bn0.bn12.ToString() << std::endl;
1342
1343
0
    ss << std::endl;
1344
1345
0
    ss << "bn1 1: " << bn1.bn1.ToString() << std::endl;
1346
0
    ss << "bn1 2: " << bn1.bn2.ToString() << std::endl;
1347
0
    ss << "bn1 3: " << bn1.bn3.ToString() << std::endl;
1348
0
    ss << "bn1 4: " << bn1.bn4.ToString() << std::endl;
1349
0
    ss << "bn1 5: " << bn1.bn5.ToString() << std::endl;
1350
0
    ss << "bn1 6: " << bn1.bn6.ToString() << std::endl;
1351
0
    ss << "bn1 7: " << bn1.bn7.ToString() << std::endl;
1352
0
    ss << "bn1 8: " << bn1.bn8.ToString() << std::endl;
1353
0
    ss << "bn1 9: " << bn1.bn9.ToString() << std::endl;
1354
0
    ss << "bn1 10: " << bn1.bn10.ToString() << std::endl;
1355
0
    ss << "bn1 11: " << bn1.bn11.ToString() << std::endl;
1356
0
    ss << "bn1 12: " << bn1.bn12.ToString() << std::endl;
1357
1358
0
    return ss.str();
1359
0
}
1360
1361
0
nlohmann::json BignumCalc_Fp12::ToJSON(void) const {
1362
0
    nlohmann::json j;
1363
    /* TODO */
1364
0
    return j;
1365
0
}
1366
1367
0
std::string BLS_PrivateToPublic::Name(void) const { return "BLS_PrivateToPublic"; }
1368
0
std::string BLS_PrivateToPublic::ToString(void) const {
1369
0
    std::stringstream ss;
1370
1371
0
    ss << "operation name: BLS_PrivateToPublic" << std::endl;
1372
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1373
0
    ss << "private key: " << priv.ToString() << std::endl;
1374
1375
0
    return ss.str();
1376
0
}
1377
1378
0
nlohmann::json BLS_PrivateToPublic::ToJSON(void) const {
1379
0
    nlohmann::json j;
1380
0
    j["priv"] = priv.ToJSON();
1381
0
    j["curveType"] = curveType.ToJSON();
1382
0
    j["modifier"] = modifier.ToJSON();
1383
0
    return j;
1384
0
}
1385
1386
0
std::string BLS_PrivateToPublic_G2::Name(void) const { return "BLS_PrivateToPublic_G2"; }
1387
0
std::string BLS_PrivateToPublic_G2::ToString(void) const {
1388
0
    std::stringstream ss;
1389
1390
0
    ss << "operation name: BLS_PrivateToPublic_G2" << std::endl;
1391
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1392
0
    ss << "private key: " << priv.ToString() << std::endl;
1393
1394
0
    return ss.str();
1395
0
}
1396
1397
0
nlohmann::json BLS_PrivateToPublic_G2::ToJSON(void) const {
1398
0
    nlohmann::json j;
1399
0
    j["priv"] = priv.ToJSON();
1400
0
    j["curveType"] = curveType.ToJSON();
1401
0
    j["modifier"] = modifier.ToJSON();
1402
0
    return j;
1403
0
}
1404
1405
0
std::string BLS_Sign::Name(void) const { return "BLS_Sign"; }
1406
0
std::string BLS_Sign::ToString(void) const {
1407
0
    std::stringstream ss;
1408
1409
0
    ss << "operation name: BLS_Sign" << std::endl;
1410
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1411
0
    ss << "private key: " << priv.ToString() << std::endl;
1412
0
    if ( hashOrPoint == true ) {
1413
0
        ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
1414
0
    } else {
1415
0
        ss << "point V: " << point.first.first.ToString() << std::endl;
1416
0
        ss << "point W: " << point.first.second.ToString() << std::endl;
1417
0
        ss << "point X: " << point.second.first.ToString() << std::endl;
1418
0
        ss << "point Y: " << point.second.second.ToString() << std::endl;
1419
0
    }
1420
0
    ss << "dest: " << util::HexDump(dest.Get()) << std::endl;
1421
0
    ss << "aug: " << util::HexDump(aug.Get()) << std::endl;
1422
1423
0
    return ss.str();
1424
0
}
1425
1426
0
nlohmann::json BLS_Sign::ToJSON(void) const {
1427
0
    nlohmann::json j;
1428
1429
0
    j["curveType"] = curveType.ToJSON();
1430
1431
0
    j["hashOrPoint"] = hashOrPoint;
1432
1433
0
    j["priv"] = priv.ToJSON();
1434
1435
0
    if ( hashOrPoint == true ) {
1436
0
        j["cleartext"] = cleartext.ToJSON();
1437
0
    } else {
1438
0
        j["g2_v"] = point.first.first.ToJSON();
1439
0
        j["g2_w"] = point.first.second.ToJSON();
1440
0
        j["g2_x"] = point.second.first.ToJSON();
1441
0
        j["g2_y"] = point.second.second.ToJSON();
1442
0
    }
1443
0
    j["dest"] = dest.ToJSON();
1444
0
    j["aug"] = aug.ToJSON();
1445
1446
0
    j["modifier"] = modifier.ToJSON();
1447
1448
0
    return j;
1449
0
}
1450
1451
0
std::string BLS_Verify::Name(void) const { return "BLS_Verify"; }
1452
0
std::string BLS_Verify::ToString(void) const {
1453
0
    std::stringstream ss;
1454
1455
0
    ss << "operation name: BLS_Verify" << std::endl;
1456
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1457
0
    ss << "public key X: " << pub.first.ToString() << std::endl;
1458
0
    ss << "public key Y: " << pub.second.ToString() << std::endl;
1459
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
1460
0
    ss << "signature V: " << signature.first.first.ToString() << std::endl;
1461
0
    ss << "signature W: " << signature.first.second.ToString() << std::endl;
1462
0
    ss << "signature X: " << signature.second.first.ToString() << std::endl;
1463
0
    ss << "signature Y: " << signature.second.second.ToString() << std::endl;
1464
0
    ss << "dest: " << util::HexDump(dest.Get()) << std::endl;
1465
1466
0
    return ss.str();
1467
0
}
1468
1469
0
nlohmann::json BLS_Verify::ToJSON(void) const {
1470
0
    nlohmann::json j;
1471
0
    j["curveType"] = curveType.ToJSON();
1472
1473
0
    j["cleartext"] = cleartext.ToJSON();
1474
1475
0
    j["g1_x"] = pub.first.ToJSON();
1476
0
    j["g1_y"] = pub.second.ToJSON();
1477
1478
0
    j["g2_v"] = signature.first.first.ToJSON();
1479
0
    j["g2_w"] = signature.first.second.ToJSON();
1480
0
    j["g2_x"] = signature.second.first.ToJSON();
1481
0
    j["g2_y"] = signature.second.second.ToJSON();
1482
1483
0
    j["dest"] = dest.ToJSON();
1484
1485
0
    j["modifier"] = modifier.ToJSON();
1486
0
    return j;
1487
0
}
1488
1489
0
std::string BLS_BatchSign::Name(void) const { return "BLS_BatchSign"; }
1490
0
std::string BLS_BatchSign::ToString(void) const {
1491
0
    std::stringstream ss;
1492
1493
0
    ss << "operation name: BLS_BatchSign" << std::endl;
1494
1495
0
    for (const auto& cur : bf.c) {
1496
0
        ss << "priv: " << cur.priv.ToString() << std::endl;
1497
0
        ss << "G1 X: " << cur.g1.first.ToString() << std::endl;
1498
0
        ss << "G1 Y: " << cur.g1.second.ToString() << std::endl;
1499
0
    }
1500
0
    return ss.str();
1501
0
}
1502
1503
0
nlohmann::json BLS_BatchSign::ToJSON(void) const {
1504
0
    nlohmann::json j;
1505
    /* TODO */
1506
0
    return j;
1507
0
}
1508
1509
0
std::string BLS_BatchVerify::Name(void) const { return "BLS_BatchVerify"; }
1510
0
std::string BLS_BatchVerify::ToString(void) const {
1511
0
    std::stringstream ss;
1512
1513
0
    for (const auto& cur : bf.c) {
1514
0
        ss << "G1 X: " << cur.g1.first.ToString() << std::endl;
1515
0
        ss << "G1 Y: " << cur.g1.second.ToString() << std::endl;
1516
0
        ss << std::endl;
1517
0
        ss << "G2 V: " << cur.g2.first.first.ToString() << std::endl;
1518
0
        ss << "G2 W: " << cur.g2.first.second.ToString() << std::endl;
1519
0
        ss << "G2 X: " << cur.g2.second.first.ToString() << std::endl;
1520
0
        ss << "G2 Y: " << cur.g2.second.second.ToString() << std::endl;
1521
0
        ss << "----------" << std::endl;
1522
0
    }
1523
1524
    /* TODO */
1525
0
    return ss.str();
1526
0
}
1527
1528
0
nlohmann::json BLS_BatchVerify::ToJSON(void) const {
1529
0
    nlohmann::json j;
1530
0
    j["operation"] = "BLS_BatchVerify";
1531
0
    j["modifier"] = modifier.ToJSON();
1532
0
    j["bf"] = bf.ToJSON();
1533
0
    return j;
1534
0
}
1535
1536
0
std::string BLS_Pairing::Name(void) const { return "BLS_Pairing"; }
1537
0
std::string BLS_Pairing::ToString(void) const {
1538
0
    std::stringstream ss;
1539
1540
0
    ss << "operation name: BLS_Pairing" << std::endl;
1541
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1542
0
    ss << "G1 X: " << g1.first.ToString() << std::endl;
1543
0
    ss << "G1 Y: " << g1.second.ToString() << std::endl;
1544
0
    ss << "G2 V: " << g2.first.first.ToString() << std::endl;
1545
0
    ss << "G2 W: " << g2.first.second.ToString() << std::endl;
1546
0
    ss << "G2 X: " << g2.second.first.ToString() << std::endl;
1547
0
    ss << "G2 Y: " << g2.second.second.ToString() << std::endl;
1548
1549
0
    return ss.str();
1550
0
}
1551
1552
0
nlohmann::json BLS_Pairing::ToJSON(void) const {
1553
0
    nlohmann::json j;
1554
0
    j["curveType"] = curveType.ToJSON();
1555
0
    j["modifier"] = modifier.ToJSON();
1556
0
    j["g1_x"] = g1.first.ToJSON();
1557
0
    j["g1_y"] = g1.second.ToJSON();
1558
0
    j["g2_v"] = g2.first.first.ToJSON();
1559
0
    j["g2_w"] = g2.first.second.ToJSON();
1560
0
    j["g2_x"] = g2.second.first.ToJSON();
1561
0
    j["g2_y"] = g2.second.second.ToJSON();
1562
0
    return j;
1563
0
}
1564
1565
0
std::string BLS_MillerLoop::Name(void) const { return "BLS_MillerLoop"; }
1566
0
std::string BLS_MillerLoop::ToString(void) const {
1567
0
    std::stringstream ss;
1568
1569
0
    ss << "operation name: BLS_MillerLoop" << std::endl;
1570
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1571
0
    ss << "G1 X: " << g1.first.ToString() << std::endl;
1572
0
    ss << "G1 Y: " << g1.second.ToString() << std::endl;
1573
0
    ss << "G2 V: " << g2.first.first.ToString() << std::endl;
1574
0
    ss << "G2 W: " << g2.first.second.ToString() << std::endl;
1575
0
    ss << "G2 X: " << g2.second.first.ToString() << std::endl;
1576
0
    ss << "G2 Y: " << g2.second.second.ToString() << std::endl;
1577
1578
0
    return ss.str();
1579
0
}
1580
1581
0
nlohmann::json BLS_MillerLoop::ToJSON(void) const {
1582
0
    nlohmann::json j;
1583
0
    j["curveType"] = curveType.ToJSON();
1584
0
    j["modifier"] = modifier.ToJSON();
1585
0
    return j;
1586
0
}
1587
1588
0
std::string BLS_FinalExp::Name(void) const { return "BLS_FinalExp"; }
1589
0
std::string BLS_FinalExp::ToString(void) const {
1590
0
    std::stringstream ss;
1591
1592
0
    ss << "operation name: BLS_FinalExp" << std::endl;
1593
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1594
    /* TODO */
1595
1596
0
    return ss.str();
1597
0
}
1598
1599
0
nlohmann::json BLS_FinalExp::ToJSON(void) const {
1600
0
    nlohmann::json j;
1601
0
    j["curveType"] = curveType.ToJSON();
1602
0
    j["modifier"] = modifier.ToJSON();
1603
    /* TODO q,p */
1604
0
    return j;
1605
0
}
1606
1607
0
std::string BLS_Aggregate_G1::Name(void) const { return "BLS_Aggregate_G1"; }
1608
0
std::string BLS_Aggregate_G1::ToString(void) const {
1609
0
    std::stringstream ss;
1610
1611
0
    ss << "operation name: BLS_Aggregate_G1" << std::endl;
1612
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1613
1614
0
    for (const auto& g1 : points.points) {
1615
0
        ss << "    X: " << g1.first.ToString() << std::endl;
1616
0
        ss << "    Y: " << g1.second.ToString() << std::endl;
1617
0
        ss << std::endl;
1618
0
    }
1619
1620
0
    return ss.str();
1621
0
}
1622
1623
0
nlohmann::json BLS_Aggregate_G1::ToJSON(void) const {
1624
0
    nlohmann::json j;
1625
0
    j["curveType"] = curveType.ToJSON();
1626
0
    j["modifier"] = modifier.ToJSON();
1627
1628
0
    nlohmann::json points_json = nlohmann::json::array();
1629
1630
0
    for (const auto& g1 : points.points) {
1631
0
        nlohmann::json point;
1632
1633
0
        point["x"] = g1.first.ToJSON();
1634
0
        point["y"] = g1.second.ToJSON();
1635
1636
0
        points_json.push_back(point);
1637
0
    }
1638
1639
0
    j["points"] = points_json;
1640
1641
0
    return j;
1642
0
}
1643
1644
0
std::string BLS_Aggregate_G2::Name(void) const { return "BLS_Aggregate_G2"; }
1645
0
std::string BLS_Aggregate_G2::ToString(void) const {
1646
0
    std::stringstream ss;
1647
1648
0
    ss << "operation name: BLS_Aggregate_G2" << std::endl;
1649
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1650
1651
0
    for (const auto& g2 : points.points) {
1652
0
        ss << "    V:" << g2.first.first.ToString() << std::endl;
1653
0
        ss << "    W:" << g2.first.second.ToString() << std::endl;
1654
0
        ss << "    X:" << g2.second.first.ToString() << std::endl;
1655
0
        ss << "    Y:" << g2.second.second.ToString() << std::endl;
1656
0
        ss << std::endl;
1657
0
    }
1658
1659
0
    return ss.str();
1660
0
}
1661
1662
0
nlohmann::json BLS_Aggregate_G2::ToJSON(void) const {
1663
0
    nlohmann::json j;
1664
0
    j["curveType"] = curveType.ToJSON();
1665
0
    j["modifier"] = modifier.ToJSON();
1666
1667
0
    nlohmann::json points_json = nlohmann::json::array();
1668
1669
0
    for (const auto& g2 : points.points) {
1670
0
        nlohmann::json point;
1671
1672
0
        point["v"] = g2.first.first.ToJSON();
1673
0
        point["w"] = g2.first.second.ToJSON();
1674
0
        point["x"] = g2.second.first.ToJSON();
1675
0
        point["y"] = g2.second.second.ToJSON();
1676
1677
0
        points_json.push_back(point);
1678
0
    }
1679
1680
0
    j["points"] = points_json;
1681
0
    return j;
1682
0
}
1683
1684
0
std::string BLS_HashToG1::Name(void) const { return "BLS_HashToG1"; }
1685
0
std::string BLS_HashToG1::ToString(void) const {
1686
0
    std::stringstream ss;
1687
1688
0
    ss << "operation name: BLS_HashToG1" << std::endl;
1689
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1690
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
1691
0
    ss << "dest: " << util::HexDump(dest.Get()) << std::endl;
1692
0
    ss << "aug: " << util::HexDump(aug.Get()) << std::endl;
1693
1694
0
    return ss.str();
1695
0
}
1696
1697
0
nlohmann::json BLS_HashToG1::ToJSON(void) const {
1698
0
    nlohmann::json j;
1699
0
    j["curveType"] = curveType.ToJSON();
1700
0
    j["cleartext"] = cleartext.ToJSON();
1701
0
    j["dest"] = dest.ToJSON();
1702
0
    j["aug"] = aug.ToJSON();
1703
0
    j["modifier"] = modifier.ToJSON();
1704
0
    return j;
1705
0
}
1706
1707
0
std::string BLS_HashToG2::Name(void) const { return "BLS_HashToG2"; }
1708
0
std::string BLS_HashToG2::ToString(void) const {
1709
0
    std::stringstream ss;
1710
1711
0
    ss << "operation name: BLS_HashToG2" << std::endl;
1712
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1713
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
1714
0
    ss << "dest: " << util::HexDump(dest.Get()) << std::endl;
1715
0
    ss << "aug: " << util::HexDump(aug.Get()) << std::endl;
1716
1717
0
    return ss.str();
1718
0
}
1719
1720
0
nlohmann::json BLS_HashToG2::ToJSON(void) const {
1721
0
    nlohmann::json j;
1722
0
    j["curveType"] = curveType.ToJSON();
1723
0
    j["cleartext"] = cleartext.ToJSON();
1724
0
    j["dest"] = dest.ToJSON();
1725
0
    j["aug"] = aug.ToJSON();
1726
0
    j["modifier"] = modifier.ToJSON();
1727
0
    return j;
1728
0
}
1729
1730
0
std::string BLS_MapToG1::Name(void) const { return "BLS_MapToG1"; }
1731
0
std::string BLS_MapToG1::ToString(void) const {
1732
0
    std::stringstream ss;
1733
1734
0
    ss << "operation name: BLS_MapToG1" << std::endl;
1735
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1736
0
    ss << "u: " << u.ToString() << std::endl;
1737
0
    ss << "v: " << v.ToString() << std::endl;
1738
1739
0
    return ss.str();
1740
0
}
1741
1742
0
nlohmann::json BLS_MapToG1::ToJSON(void) const {
1743
0
    nlohmann::json j;
1744
0
    j["curveType"] = curveType.ToJSON();
1745
0
    j["u"] = u.ToJSON();
1746
0
    j["v"] = v.ToJSON();
1747
0
    j["modifier"] = modifier.ToJSON();
1748
0
    return j;
1749
0
}
1750
1751
0
std::string BLS_MapToG2::Name(void) const { return "BLS_MapToG2"; }
1752
0
std::string BLS_MapToG2::ToString(void) const {
1753
0
    std::stringstream ss;
1754
1755
0
    ss << "operation name: BLS_MapToG2" << std::endl;
1756
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1757
0
    ss << "u_x: " << u.first.ToString() << std::endl;
1758
0
    ss << "u_y: " << u.second.ToString() << std::endl;
1759
0
    ss << "v_x: " << v.first.ToString() << std::endl;
1760
0
    ss << "v_y: " << v.second.ToString() << std::endl;
1761
1762
0
    return ss.str();
1763
0
}
1764
1765
0
nlohmann::json BLS_MapToG2::ToJSON(void) const {
1766
0
    nlohmann::json j;
1767
1768
0
    j["u_x"] = u.first.ToJSON();
1769
0
    j["u_y"] = u.second.ToJSON();
1770
0
    j["v_x"] = v.first.ToJSON();
1771
0
    j["v_y"] = v.second.ToJSON();
1772
1773
0
    return j;
1774
0
}
1775
1776
0
std::string BLS_IsG1OnCurve::Name(void) const { return "BLS_IsG1OnCurve"; }
1777
0
std::string BLS_IsG1OnCurve::ToString(void) const {
1778
0
    std::stringstream ss;
1779
1780
0
    ss << "operation name: BLS_IsG1OnCurve" << std::endl;
1781
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1782
0
    ss << "G1 X: " << g1.first.ToString() << std::endl;
1783
0
    ss << "G1 Y: " << g1.second.ToString() << std::endl;
1784
1785
0
    return ss.str();
1786
0
}
1787
1788
0
nlohmann::json BLS_IsG1OnCurve::ToJSON(void) const {
1789
0
    nlohmann::json j;
1790
0
    j["curveType"] = curveType.ToJSON();
1791
1792
0
    j["g1_x"] = g1.first.ToJSON();
1793
0
    j["g1_y"] = g1.second.ToJSON();
1794
1795
0
    j["modifier"] = modifier.ToJSON();
1796
0
    return j;
1797
0
}
1798
1799
0
std::string BLS_IsG2OnCurve::Name(void) const { return "BLS_IsG2OnCurve"; }
1800
0
std::string BLS_IsG2OnCurve::ToString(void) const {
1801
0
    std::stringstream ss;
1802
1803
0
    ss << "operation name: BLS_IsG2OnCurve" << std::endl;
1804
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1805
0
    ss << "G2 V: " << g2.first.first.ToString() << std::endl;
1806
0
    ss << "G2 W: " << g2.first.second.ToString() << std::endl;
1807
0
    ss << "G2 X: " << g2.second.first.ToString() << std::endl;
1808
0
    ss << "G2 Y: " << g2.second.second.ToString() << std::endl;
1809
1810
0
    return ss.str();
1811
0
}
1812
1813
0
nlohmann::json BLS_IsG2OnCurve::ToJSON(void) const {
1814
0
    nlohmann::json j;
1815
0
    j["curveType"] = curveType.ToJSON();
1816
1817
0
    j["g2_v"] = g2.first.first.ToJSON();
1818
0
    j["g2_w"] = g2.first.second.ToJSON();
1819
0
    j["g2_x"] = g2.second.first.ToJSON();
1820
0
    j["g2_y"] = g2.second.second.ToJSON();
1821
1822
0
    j["modifier"] = modifier.ToJSON();
1823
0
    return j;
1824
0
}
1825
1826
0
std::string BLS_GenerateKeyPair::Name(void) const { return "BLS_GenerateKeyPair"; }
1827
0
std::string BLS_GenerateKeyPair::ToString(void) const {
1828
0
    std::stringstream ss;
1829
1830
0
    ss << "operation name: BLS_GenerateKeyPair" << std::endl;
1831
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1832
0
    ss << "ikm: " << util::HexDump(ikm.Get()) << std::endl;
1833
0
    ss << "info: " << util::HexDump(info.Get()) << std::endl;
1834
1835
0
    return ss.str();
1836
0
}
1837
1838
0
nlohmann::json BLS_GenerateKeyPair::ToJSON(void) const {
1839
0
    nlohmann::json j;
1840
0
    j["curveType"] = curveType.ToJSON();
1841
0
    j["modifier"] = modifier.ToJSON();
1842
0
    j["ikm"] = ikm.ToJSON();
1843
0
    j["info"] = info.ToJSON();
1844
0
    return j;
1845
0
}
1846
1847
0
std::string BLS_Decompress_G1::Name(void) const { return "BLS_Decompress_G1"; }
1848
0
std::string BLS_Decompress_G1::ToString(void) const {
1849
0
    std::stringstream ss;
1850
1851
0
    ss << "operation name: BLS_Decompress_G1" << std::endl;
1852
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1853
0
    ss << "compressed: " << compressed.ToString() << std::endl;
1854
1855
0
    return ss.str();
1856
0
}
1857
1858
0
nlohmann::json BLS_Decompress_G1::ToJSON(void) const {
1859
0
    nlohmann::json j;
1860
0
    j["curveType"] = curveType.ToJSON();
1861
0
    j["compressed"] = compressed.ToJSON();
1862
0
    j["modifier"] = modifier.ToJSON();
1863
0
    return j;
1864
0
}
1865
1866
0
std::string BLS_Compress_G1::Name(void) const { return "BLS_Compress_G1"; }
1867
0
std::string BLS_Compress_G1::ToString(void) const {
1868
0
    std::stringstream ss;
1869
1870
0
    ss << "operation name: BLS_Compress_G1" << std::endl;
1871
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1872
0
    ss << "uncompressed X:" << uncompressed.first.ToString() << std::endl;
1873
0
    ss << "uncompressed Y:" << uncompressed.second.ToString() << std::endl;
1874
1875
0
    return ss.str();
1876
0
}
1877
1878
0
nlohmann::json BLS_Compress_G1::ToJSON(void) const {
1879
0
    nlohmann::json j;
1880
0
    j["curveType"] = curveType.ToJSON();
1881
0
    j["g1_x"] = uncompressed.first.ToJSON();
1882
0
    j["g1_y"] = uncompressed.second.ToJSON();
1883
0
    j["modifier"] = modifier.ToJSON();
1884
0
    return j;
1885
0
}
1886
1887
0
std::string BLS_Decompress_G2::Name(void) const { return "BLS_Decompress_G2"; }
1888
0
std::string BLS_Decompress_G2::ToString(void) const {
1889
0
    std::stringstream ss;
1890
1891
0
    ss << "operation name: BLS_Decompress_G2" << std::endl;
1892
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1893
0
    ss << "compressed X: " << compressed.first.ToString() << std::endl;
1894
0
    ss << "compressed Y: " << compressed.second.ToString() << std::endl;
1895
1896
0
    return ss.str();
1897
0
}
1898
1899
0
nlohmann::json BLS_Decompress_G2::ToJSON(void) const {
1900
0
    nlohmann::json j;
1901
0
    j["curveType"] = curveType.ToJSON();
1902
0
    j["g1_x"] = compressed.first.ToJSON();
1903
0
    j["g1_y"] = compressed.second.ToJSON();
1904
0
    j["modifier"] = modifier.ToJSON();
1905
0
    return j;
1906
0
}
1907
1908
0
std::string BLS_Compress_G2::Name(void) const { return "BLS_Compress_G2"; }
1909
0
std::string BLS_Compress_G2::ToString(void) const {
1910
0
    std::stringstream ss;
1911
1912
0
    ss << "operation name: BLS_Compress_G2" << std::endl;
1913
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1914
0
    ss << "uncompressed V:" << uncompressed.first.first.ToString() << std::endl;
1915
0
    ss << "uncompressed W:" << uncompressed.first.second.ToString() << std::endl;
1916
0
    ss << "uncompressed X:" << uncompressed.second.first.ToString() << std::endl;
1917
0
    ss << "uncompressed Y:" << uncompressed.second.second.ToString() << std::endl;
1918
1919
0
    return ss.str();
1920
0
}
1921
1922
0
nlohmann::json BLS_Compress_G2::ToJSON(void) const {
1923
0
    nlohmann::json j;
1924
0
    j["curveType"] = curveType.ToJSON();
1925
0
    j["g2_v"] = uncompressed.first.first.ToJSON();
1926
0
    j["g2_w"] = uncompressed.first.second.ToJSON();
1927
0
    j["g2_x"] = uncompressed.second.first.ToJSON();
1928
0
    j["g2_y"] = uncompressed.second.second.ToJSON();
1929
0
    j["modifier"] = modifier.ToJSON();
1930
0
    return j;
1931
0
}
1932
1933
0
std::string BLS_G1_Add::Name(void) const { return "BLS_G1_Add"; }
1934
0
std::string BLS_G1_Add::ToString(void) const {
1935
0
    std::stringstream ss;
1936
1937
0
    ss << "operation name: BLS_G1_Add" << std::endl;
1938
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1939
0
    ss << "A X: " << a.first.ToString() << std::endl;
1940
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1941
0
    ss << "B X: " << b.first.ToString() << std::endl;
1942
0
    ss << "B Y: " << b.second.ToString() << std::endl;
1943
1944
0
    return ss.str();
1945
0
}
1946
1947
0
nlohmann::json BLS_G1_Add::ToJSON(void) const {
1948
0
    nlohmann::json j;
1949
0
    j["operation"] = "BLS_G1_Add";
1950
0
    j["curveType"] = curveType.ToJSON();
1951
1952
0
    j["a_x"] = a.first.ToJSON();
1953
0
    j["a_y"] = a.second.ToJSON();
1954
1955
0
    j["b_x"] = b.first.ToJSON();
1956
0
    j["b_y"] = b.second.ToJSON();
1957
1958
0
    j["modifier"] = modifier.ToJSON();
1959
0
    return j;
1960
0
}
1961
1962
0
std::string BLS_G1_Mul::Name(void) const { return "BLS_G1_Mul"; }
1963
0
std::string BLS_G1_Mul::ToString(void) const {
1964
0
    std::stringstream ss;
1965
1966
0
    ss << "operation name: BLS_G1_Mul" << std::endl;
1967
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1968
0
    ss << "A X: " << a.first.ToString() << std::endl;
1969
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1970
0
    ss << "B: " << b.ToString() << std::endl;
1971
1972
0
    return ss.str();
1973
0
}
1974
1975
0
nlohmann::json BLS_G1_Mul::ToJSON(void) const {
1976
0
    nlohmann::json j;
1977
0
    j["operation"] = "BLS_G1_Mul";
1978
0
    j["curveType"] = curveType.ToJSON();
1979
1980
0
    j["a_x"] = a.first.ToJSON();
1981
0
    j["a_y"] = a.second.ToJSON();
1982
1983
0
    j["b"] = b.ToJSON();
1984
1985
0
    j["modifier"] = modifier.ToJSON();
1986
0
    return j;
1987
0
}
1988
1989
0
std::string BLS_G1_IsEq::Name(void) const { return "BLS_G1_IsEq"; }
1990
0
std::string BLS_G1_IsEq::ToString(void) const {
1991
0
    std::stringstream ss;
1992
1993
0
    ss << "operation name: BLS_G1_IsEq" << std::endl;
1994
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
1995
0
    ss << "A X: " << a.first.ToString() << std::endl;
1996
0
    ss << "A Y: " << a.second.ToString() << std::endl;
1997
0
    ss << "B X: " << b.first.ToString() << std::endl;
1998
0
    ss << "B Y: " << b.second.ToString() << std::endl;
1999
2000
0
    return ss.str();
2001
0
}
2002
2003
0
nlohmann::json BLS_G1_IsEq::ToJSON(void) const {
2004
0
    nlohmann::json j;
2005
0
    j["curveType"] = curveType.ToJSON();
2006
2007
0
    j["a_x"] = a.first.ToJSON();
2008
0
    j["a_y"] = a.second.ToJSON();
2009
2010
0
    j["b_x"] = b.first.ToJSON();
2011
0
    j["b_y"] = b.second.ToJSON();
2012
2013
0
    j["modifier"] = modifier.ToJSON();
2014
0
    return j;
2015
0
}
2016
2017
0
std::string BLS_G1_Neg::Name(void) const { return "BLS_G1_Neg"; }
2018
0
std::string BLS_G1_Neg::ToString(void) const {
2019
0
    std::stringstream ss;
2020
2021
0
    ss << "operation name: BLS_G1_Neg" << std::endl;
2022
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
2023
0
    ss << "A X: " << a.first.ToString() << std::endl;
2024
0
    ss << "A Y: " << a.second.ToString() << std::endl;
2025
2026
0
    return ss.str();
2027
0
}
2028
2029
0
nlohmann::json BLS_G1_Neg::ToJSON(void) const {
2030
0
    nlohmann::json j;
2031
0
    j["curveType"] = curveType.ToJSON();
2032
2033
0
    j["a_x"] = a.first.ToJSON();
2034
0
    j["a_y"] = a.second.ToJSON();
2035
2036
0
    j["modifier"] = modifier.ToJSON();
2037
0
    return j;
2038
0
}
2039
2040
0
std::string BLS_G2_Add::Name(void) const { return "BLS_G2_Add"; }
2041
0
std::string BLS_G2_Add::ToString(void) const {
2042
0
    std::stringstream ss;
2043
2044
0
    ss << "operation name: BLS_G2_Add" << std::endl;
2045
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
2046
0
    ss << "A V:" << a.first.first.ToString() << std::endl;
2047
0
    ss << "A W:" << a.first.second.ToString() << std::endl;
2048
0
    ss << "A X:" << a.second.first.ToString() << std::endl;
2049
0
    ss << "A Y:" << a.second.second.ToString() << std::endl;
2050
0
    ss << "B V:" << b.first.first.ToString() << std::endl;
2051
0
    ss << "B W:" << b.first.second.ToString() << std::endl;
2052
0
    ss << "B X:" << b.second.first.ToString() << std::endl;
2053
0
    ss << "B Y:" << b.second.second.ToString() << std::endl;
2054
2055
0
    return ss.str();
2056
0
}
2057
2058
0
nlohmann::json BLS_G2_Add::ToJSON(void) const {
2059
0
    nlohmann::json j;
2060
0
    j["curveType"] = curveType.ToJSON();
2061
2062
0
    j["a_v"] = a.first.first.ToJSON();
2063
0
    j["a_w"] = a.first.second.ToJSON();
2064
0
    j["a_x"] = a.second.first.ToJSON();
2065
0
    j["a_y"] = a.second.second.ToJSON();
2066
2067
0
    j["b_v"] = b.first.first.ToJSON();
2068
0
    j["b_w"] = b.first.second.ToJSON();
2069
0
    j["b_x"] = b.second.first.ToJSON();
2070
0
    j["b_y"] = b.second.second.ToJSON();
2071
2072
0
    j["modifier"] = modifier.ToJSON();
2073
0
    return j;
2074
0
}
2075
2076
0
std::string BLS_G2_Mul::Name(void) const { return "BLS_G2_Mul"; }
2077
0
std::string BLS_G2_Mul::ToString(void) const {
2078
0
    std::stringstream ss;
2079
2080
0
    ss << "operation name: BLS_G2_Mul" << std::endl;
2081
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
2082
0
    ss << "A V:" << a.first.first.ToString() << std::endl;
2083
0
    ss << "A W:" << a.first.second.ToString() << std::endl;
2084
0
    ss << "A X:" << a.second.first.ToString() << std::endl;
2085
0
    ss << "A Y:" << a.second.second.ToString() << std::endl;
2086
0
    ss << "B: " << b.ToString() << std::endl;
2087
2088
0
    return ss.str();
2089
0
}
2090
2091
0
nlohmann::json BLS_G2_Mul::ToJSON(void) const {
2092
0
    nlohmann::json j;
2093
0
    j["curveType"] = curveType.ToJSON();
2094
2095
0
    j["a_v"] = a.first.first.ToJSON();
2096
0
    j["a_w"] = a.first.second.ToJSON();
2097
0
    j["a_x"] = a.second.first.ToJSON();
2098
0
    j["a_y"] = a.second.second.ToJSON();
2099
2100
0
    j["b"] = b.ToJSON();
2101
2102
0
    j["modifier"] = modifier.ToJSON();
2103
0
    return j;
2104
0
}
2105
2106
0
std::string BLS_G2_IsEq::Name(void) const { return "BLS_G2_IsEq"; }
2107
0
std::string BLS_G2_IsEq::ToString(void) const {
2108
0
    std::stringstream ss;
2109
2110
0
    ss << "operation name: BLS_G2_IsEq" << std::endl;
2111
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
2112
0
    ss << "A V:" << a.first.first.ToString() << std::endl;
2113
0
    ss << "A W:" << a.first.second.ToString() << std::endl;
2114
0
    ss << "A X:" << a.second.first.ToString() << std::endl;
2115
0
    ss << "A Y:" << a.second.second.ToString() << std::endl;
2116
0
    ss << "B V:" << b.first.first.ToString() << std::endl;
2117
0
    ss << "B W:" << b.first.second.ToString() << std::endl;
2118
0
    ss << "B X:" << b.second.first.ToString() << std::endl;
2119
0
    ss << "B Y:" << b.second.second.ToString() << std::endl;
2120
2121
0
    return ss.str();
2122
0
}
2123
2124
0
nlohmann::json BLS_G2_IsEq::ToJSON(void) const {
2125
0
    nlohmann::json j;
2126
0
    j["curveType"] = curveType.ToJSON();
2127
2128
0
    j["a_v"] = a.first.first.ToJSON();
2129
0
    j["a_w"] = a.first.second.ToJSON();
2130
0
    j["a_x"] = a.second.first.ToJSON();
2131
0
    j["a_y"] = a.second.second.ToJSON();
2132
2133
0
    j["b_v"] = b.first.first.ToJSON();
2134
0
    j["b_w"] = b.first.second.ToJSON();
2135
0
    j["b_x"] = b.second.first.ToJSON();
2136
0
    j["b_y"] = b.second.second.ToJSON();
2137
2138
0
    j["modifier"] = modifier.ToJSON();
2139
0
    return j;
2140
0
}
2141
2142
0
std::string BLS_G2_Neg::Name(void) const { return "BLS_G2_Neg"; }
2143
0
std::string BLS_G2_Neg::ToString(void) const {
2144
0
    std::stringstream ss;
2145
2146
0
    ss << "operation name: BLS_G2_Neg" << std::endl;
2147
0
    ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;
2148
0
    ss << "A V:" << a.first.first.ToString() << std::endl;
2149
0
    ss << "A W:" << a.first.second.ToString() << std::endl;
2150
0
    ss << "A X:" << a.second.first.ToString() << std::endl;
2151
0
    ss << "A Y:" << a.second.second.ToString() << std::endl;
2152
2153
0
    return ss.str();
2154
0
}
2155
2156
0
nlohmann::json BLS_G2_Neg::ToJSON(void) const {
2157
0
    nlohmann::json j;
2158
0
    j["curveType"] = curveType.ToJSON();
2159
2160
0
    j["a_v"] = a.first.first.ToJSON();
2161
0
    j["a_w"] = a.first.second.ToJSON();
2162
0
    j["a_x"] = a.second.first.ToJSON();
2163
0
    j["a_y"] = a.second.second.ToJSON();
2164
2165
0
    j["modifier"] = modifier.ToJSON();
2166
0
    return j;
2167
0
}
2168
2169
0
std::string Misc::Name(void) const { return "Misc"; }
2170
0
std::string Misc::ToString(void) const {
2171
0
    std::stringstream ss;
2172
2173
0
    ss << "operation name: Misc" << std::endl;
2174
0
    ss << "operation: " << std::to_string(operation.Get()) << std::endl;
2175
2176
0
    return ss.str();
2177
0
}
2178
2179
0
nlohmann::json Misc::ToJSON(void) const {
2180
0
    nlohmann::json j;
2181
0
    j["operation"] = operation.ToJSON();
2182
0
    j["modifier"] = modifier.ToJSON();
2183
0
    return j;
2184
0
}
2185
2186
0
std::string SR25519_Verify::Name(void) const { return "ECDSA_Verify"; }
2187
0
std::string SR25519_Verify::ToString(void) const {
2188
0
    std::stringstream ss;
2189
2190
0
    ss << "operation name: SR25519_Verify" << std::endl;
2191
0
    ss << "public key: " << signature.pub.ToString() << std::endl;
2192
0
    ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;
2193
0
    ss << "signature R: " << signature.signature.first.ToString() << std::endl;
2194
0
    ss << "signature S: " << signature.signature.second.ToString() << std::endl;
2195
2196
0
    return ss.str();
2197
0
}
2198
2199
0
nlohmann::json SR25519_Verify::ToJSON(void) const {
2200
0
    nlohmann::json j;
2201
0
    j["operation"] = "SR25519_Verify";
2202
0
    j["pub"] = signature.pub.ToJSON();
2203
0
    j["cleartext"] = cleartext.ToJSON();
2204
0
    j["sig_r"] = signature.signature.first.ToJSON();
2205
0
    j["sig_s"] = signature.signature.second.ToJSON();
2206
0
    j["modifier"] = modifier.ToJSON();
2207
0
    return j;
2208
0
}
2209
2210
} /* namespace operation */
2211
} /* namespace cryptofuzz */