/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 KDF_SRTP::Name(void) const { return "KDF_SRTP"; } | 
443  | 0  | std::string KDF_SRTP::ToString(void) const { | 
444  | 0  |     std::stringstream ss;  | 
445  |  | 
  | 
446  | 0  |     ss << "operation name: KDF_SRTP" << std::endl;  | 
447  | 0  |     ss << "key: " << util::HexDump(key.Get()) << std::endl;  | 
448  | 0  |     ss << "salt: " << util::HexDump(salt.Get()) << std::endl;  | 
449  | 0  |     ss << "kdr: " << std::to_string(kdr) << std::endl;  | 
450  | 0  |     ss << "index: " << std::to_string(index) << std::endl;  | 
451  | 0  |     ss << "key1Size: " << std::to_string(key1Size) << std::endl;  | 
452  | 0  |     ss << "key2Size: " << std::to_string(key2Size) << std::endl;  | 
453  | 0  |     ss << "key3Size: " << std::to_string(key3Size) << std::endl;  | 
454  |  | 
  | 
455  | 0  |     return ss.str();  | 
456  | 0  | }  | 
457  |  |  | 
458  | 0  | nlohmann::json KDF_SRTP::ToJSON(void) const { | 
459  | 0  |     nlohmann::json j;  | 
460  | 0  |     j["operation"] = "KDF_SRTP";  | 
461  | 0  |     j["key"] = key.ToJSON();  | 
462  | 0  |     j["salt"] = salt.ToJSON();  | 
463  | 0  |     j["kdr"] = kdr;  | 
464  | 0  |     j["index"] = index;  | 
465  | 0  |     j["key1Size"] = key1Size;  | 
466  | 0  |     j["key2Size"] = key2Size;  | 
467  | 0  |     j["key3Size"] = key3Size;  | 
468  | 0  |     j["modifier"] = modifier.ToJSON();  | 
469  | 0  |     return j;  | 
470  | 0  | }  | 
471  |  |  | 
472  | 0  | std::string KDF_SRTCP::Name(void) const { return "KDF_SRTCP"; } | 
473  | 0  | std::string KDF_SRTCP::ToString(void) const { | 
474  | 0  |     std::stringstream ss;  | 
475  |  | 
  | 
476  | 0  |     ss << "operation name: KDF_SRTCP" << std::endl;  | 
477  | 0  |     ss << "key: " << util::HexDump(key.Get()) << std::endl;  | 
478  | 0  |     ss << "salt: " << util::HexDump(salt.Get()) << std::endl;  | 
479  | 0  |     ss << "kdr: " << std::to_string(kdr) << std::endl;  | 
480  | 0  |     ss << "index: " << std::to_string(index) << std::endl;  | 
481  | 0  |     ss << "key1Size: " << std::to_string(key1Size) << std::endl;  | 
482  | 0  |     ss << "key2Size: " << std::to_string(key2Size) << std::endl;  | 
483  | 0  |     ss << "key3Size: " << std::to_string(key3Size) << std::endl;  | 
484  |  | 
  | 
485  | 0  |     return ss.str();  | 
486  | 0  | }  | 
487  |  |  | 
488  | 0  | nlohmann::json KDF_SRTCP::ToJSON(void) const { | 
489  | 0  |     nlohmann::json j;  | 
490  | 0  |     j["operation"] = "KDF_SRTCP";  | 
491  | 0  |     j["key"] = key.ToJSON();  | 
492  | 0  |     j["salt"] = salt.ToJSON();  | 
493  | 0  |     j["kdr"] = kdr;  | 
494  | 0  |     j["index"] = index;  | 
495  | 0  |     j["key1Size"] = key1Size;  | 
496  | 0  |     j["key2Size"] = key2Size;  | 
497  | 0  |     j["key3Size"] = key3Size;  | 
498  | 0  |     j["modifier"] = modifier.ToJSON();  | 
499  | 0  |     return j;  | 
500  | 0  | }  | 
501  |  |  | 
502  | 0  | std::string CMAC::Name(void) const { return "CMAC"; } | 
503  | 0  | std::string CMAC::ToString(void) const { | 
504  | 0  |     std::stringstream ss;  | 
505  |  | 
  | 
506  | 0  |     ss << "operation name: CMAC" << std::endl;  | 
507  | 0  |     ss << "cipher iv: " << util::HexDump(cipher.iv.Get()) << std::endl;  | 
508  | 0  |     ss << "cipher key: " << util::HexDump(cipher.key.Get()) << std::endl;  | 
509  | 0  |     ss << "cipher: " << repository::CipherToString(cipher.cipherType.Get()) << std::endl;  | 
510  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
511  | 0  |     ss << "key: " << util::HexDump(cipher.key.Get()) << std::endl;  | 
512  |  | 
  | 
513  | 0  |     return ss.str();  | 
514  | 0  | }  | 
515  |  |  | 
516  | 0  | nlohmann::json CMAC::ToJSON(void) const { | 
517  | 0  |     nlohmann::json j;  | 
518  | 0  |     j["operation"] = "CMAC";  | 
519  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
520  | 0  |     j["cipher"] = cipher.ToJSON();  | 
521  | 0  |     j["modifier"] = modifier.ToJSON();  | 
522  | 0  |     return j;  | 
523  | 0  | }  | 
524  |  |  | 
525  | 0  | std::string ECC_PrivateToPublic::Name(void) const { return "ECC_PrivateToPublic"; } | 
526  | 0  | std::string ECC_PrivateToPublic::ToString(void) const { | 
527  | 0  |     std::stringstream ss;  | 
528  |  | 
  | 
529  | 0  |     ss << "operation name: ECC_PrivateToPublic" << std::endl;  | 
530  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
531  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
532  |  | 
  | 
533  | 0  |     return ss.str();  | 
534  | 0  | }  | 
535  |  |  | 
536  | 0  | nlohmann::json ECC_PrivateToPublic::ToJSON(void) const { | 
537  | 0  |     nlohmann::json j;  | 
538  | 0  |     j["operation"] = "ECC_PrivateToPublic";  | 
539  | 0  |     j["priv"] = priv.ToJSON();  | 
540  | 0  |     j["curveType"] = curveType.ToJSON();  | 
541  | 0  |     j["modifier"] = modifier.ToJSON();  | 
542  | 0  |     return j;  | 
543  | 0  | }  | 
544  |  |  | 
545  | 0  | std::string ECC_ValidatePubkey::Name(void) const { return "ECC_ValidatePubkey"; } | 
546  | 0  | std::string ECC_ValidatePubkey::ToString(void) const { | 
547  | 0  |     std::stringstream ss;  | 
548  |  | 
  | 
549  | 0  |     ss << "operation name: ECC_ValidatePubkey" << std::endl;  | 
550  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
551  | 0  |     ss << "public key X: " << pub.first.ToString() << std::endl;  | 
552  | 0  |     ss << "public key Y: " << pub.second.ToString() << std::endl;  | 
553  |  | 
  | 
554  | 0  |     return ss.str();  | 
555  | 0  | }  | 
556  |  |  | 
557  | 0  | nlohmann::json ECC_ValidatePubkey::ToJSON(void) const { | 
558  | 0  |     nlohmann::json j;  | 
559  | 0  |     j["operation"] = "ECC_ValidatePubkey";  | 
560  | 0  |     j["pub_x"] = pub.first.ToJSON();  | 
561  | 0  |     j["pub_y"] = pub.second.ToJSON();  | 
562  | 0  |     j["curveType"] = curveType.ToJSON();  | 
563  | 0  |     j["modifier"] = modifier.ToJSON();  | 
564  | 0  |     return j;  | 
565  | 0  | }  | 
566  |  |  | 
567  |  | ECC_ValidatePubkey::ECC_ValidatePubkey(  | 
568  |  |         const component::CurveType curveType,  | 
569  |  |         const component::ECC_PublicKey& pub,  | 
570  |  |         component::Modifier& modifier) :  | 
571  |  |     Operation(std::move(modifier)),  | 
572  |  |     curveType(curveType),  | 
573  |  |     pub(pub)  | 
574  | 0  | { } | 
575  |  |  | 
576  | 0  | std::string ECC_GenerateKeyPair::Name(void) const { return "ECC_GenerateKeyPair"; } | 
577  | 0  | std::string ECC_GenerateKeyPair::ToString(void) const { | 
578  | 0  |     std::stringstream ss;  | 
579  |  | 
  | 
580  | 0  |     ss << "operation name: ECC_GenerateKeyPair" << std::endl;  | 
581  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
582  |  | 
  | 
583  | 0  |     return ss.str();  | 
584  | 0  | }  | 
585  |  |  | 
586  | 0  | nlohmann::json ECC_GenerateKeyPair::ToJSON(void) const { | 
587  | 0  |     nlohmann::json j;  | 
588  | 0  |     j["operation"] = "ECC_GenerateKeyPair";  | 
589  | 0  |     j["curveType"] = curveType.ToJSON();  | 
590  | 0  |     j["modifier"] = modifier.ToJSON();  | 
591  | 0  |     return j;  | 
592  | 0  | }  | 
593  |  |  | 
594  | 0  | std::string ECCSI_Sign::Name(void) const { return "ECCSI_Sign"; } | 
595  | 0  | std::string ECCSI_Sign::ToString(void) const { | 
596  | 0  |     std::stringstream ss;  | 
597  |  | 
  | 
598  | 0  |     ss << "operation name: ECCSI_Sign" << std::endl;  | 
599  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
600  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
601  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
602  | 0  |     ss << "id: " << util::HexDump(id.Get()) << std::endl;  | 
603  |  | 
  | 
604  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
605  |  | 
  | 
606  | 0  |     return ss.str();  | 
607  | 0  | }  | 
608  |  |  | 
609  | 0  | nlohmann::json ECCSI_Sign::ToJSON(void) const { | 
610  | 0  |     nlohmann::json j;  | 
611  | 0  |     j["operation"] = "ECCSI_Sign";  | 
612  | 0  |     j["priv"] = priv.ToJSON();  | 
613  | 0  |     j["curveType"] = curveType.ToJSON();  | 
614  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
615  | 0  |     j["id"] = id.ToJSON();  | 
616  | 0  |     j["digestType"] = digestType.ToJSON();  | 
617  | 0  |     j["modifier"] = modifier.ToJSON();  | 
618  | 0  |     return j;  | 
619  | 0  | }  | 
620  |  |  | 
621  | 0  | std::string ECDSA_Sign::Name(void) const { return "ECDSA_Sign"; } | 
622  | 0  | std::string ECDSA_Sign::ToString(void) const { | 
623  | 0  |     std::stringstream ss;  | 
624  |  | 
  | 
625  | 0  |     ss << "operation name: ECDSA_Sign" << std::endl;  | 
626  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
627  | 0  |     ss << "nonce: " << nonce.ToString() << std::endl;  | 
628  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
629  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
630  | 0  |     ss << "nonce source: ";  | 
631  | 0  |     if ( UseRandomNonce() ) { | 
632  | 0  |         ss << "random";  | 
633  | 0  |     } else if ( UseRFC6979Nonce() ) { | 
634  | 0  |         ss << "RFC 6979";  | 
635  | 0  |     } else if ( UseSpecifiedNonce() ) { | 
636  | 0  |         ss << "specified";  | 
637  | 0  |     } else { | 
638  | 0  |         ss << "(unknown)";  | 
639  | 0  |     }  | 
640  | 0  |     ss << std::endl;  | 
641  |  | 
  | 
642  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
643  |  | 
  | 
644  | 0  |     return ss.str();  | 
645  | 0  | }  | 
646  |  |  | 
647  | 0  | nlohmann::json ECDSA_Sign::ToJSON(void) const { | 
648  | 0  |     nlohmann::json j;  | 
649  | 0  |     j["operation"] = "ECDSA_Sign";  | 
650  | 0  |     j["priv"] = priv.ToJSON();  | 
651  | 0  |     j["nonce"] = priv.ToJSON();  | 
652  | 0  |     j["curveType"] = curveType.ToJSON();  | 
653  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
654  | 0  |     j["nonceSource"] = nonceSource;  | 
655  | 0  |     j["digestType"] = digestType.ToJSON();  | 
656  | 0  |     j["modifier"] = modifier.ToJSON();  | 
657  | 0  |     return j;  | 
658  | 0  | }  | 
659  |  |  | 
660  | 0  | std::string ECGDSA_Sign::Name(void) const { return "ECGDSA_Sign"; } | 
661  | 0  | std::string ECGDSA_Sign::ToString(void) const { | 
662  | 0  |     std::stringstream ss;  | 
663  |  | 
  | 
664  | 0  |     ss << "operation name: ECGDSA_Sign" << std::endl;  | 
665  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
666  | 0  |     ss << "nonce: " << nonce.ToString() << std::endl;  | 
667  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
668  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
669  | 0  |     ss << "nonce source: ";  | 
670  | 0  |     if ( UseRandomNonce() ) { | 
671  | 0  |         ss << "random";  | 
672  | 0  |     } else if ( UseRFC6979Nonce() ) { | 
673  | 0  |         ss << "RFC 6979";  | 
674  | 0  |     } else if ( UseSpecifiedNonce() ) { | 
675  | 0  |         ss << "specified";  | 
676  | 0  |     } else { | 
677  | 0  |         ss << "(unknown)";  | 
678  | 0  |     }  | 
679  | 0  |     ss << std::endl;  | 
680  |  | 
  | 
681  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
682  |  | 
  | 
683  | 0  |     return ss.str();  | 
684  | 0  | }  | 
685  |  |  | 
686  | 0  | nlohmann::json ECGDSA_Sign::ToJSON(void) const { | 
687  | 0  |     nlohmann::json j;  | 
688  | 0  |     j["operation"] = "ECGDSA_Sign";  | 
689  | 0  |     j["priv"] = priv.ToJSON();  | 
690  | 0  |     j["nonce"] = priv.ToJSON();  | 
691  | 0  |     j["curveType"] = curveType.ToJSON();  | 
692  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
693  | 0  |     j["nonceSource"] = nonceSource;  | 
694  | 0  |     j["digestType"] = digestType.ToJSON();  | 
695  | 0  |     j["modifier"] = modifier.ToJSON();  | 
696  | 0  |     return j;  | 
697  | 0  | }  | 
698  |  |  | 
699  | 0  | std::string ECRDSA_Sign::Name(void) const { return "ECRDSA_Sign"; } | 
700  | 0  | std::string ECRDSA_Sign::ToString(void) const { | 
701  | 0  |     std::stringstream ss;  | 
702  |  | 
  | 
703  | 0  |     ss << "operation name: ECRDSA_Sign" << std::endl;  | 
704  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
705  | 0  |     ss << "nonce: " << nonce.ToString() << std::endl;  | 
706  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
707  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
708  | 0  |     ss << "nonce source: ";  | 
709  | 0  |     if ( UseRandomNonce() ) { | 
710  | 0  |         ss << "random";  | 
711  | 0  |     } else if ( UseRFC6979Nonce() ) { | 
712  | 0  |         ss << "RFC 6979";  | 
713  | 0  |     } else if ( UseSpecifiedNonce() ) { | 
714  | 0  |         ss << "specified";  | 
715  | 0  |     } else { | 
716  | 0  |         ss << "(unknown)";  | 
717  | 0  |     }  | 
718  | 0  |     ss << std::endl;  | 
719  |  | 
  | 
720  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
721  |  | 
  | 
722  | 0  |     return ss.str();  | 
723  | 0  | }  | 
724  |  |  | 
725  | 0  | nlohmann::json ECRDSA_Sign::ToJSON(void) const { | 
726  | 0  |     nlohmann::json j;  | 
727  | 0  |     j["operation"] = "ECRDSA_Sign";  | 
728  | 0  |     j["priv"] = priv.ToJSON();  | 
729  | 0  |     j["nonce"] = priv.ToJSON();  | 
730  | 0  |     j["curveType"] = curveType.ToJSON();  | 
731  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
732  | 0  |     j["nonceSource"] = nonceSource;  | 
733  | 0  |     j["digestType"] = digestType.ToJSON();  | 
734  | 0  |     j["modifier"] = modifier.ToJSON();  | 
735  | 0  |     return j;  | 
736  | 0  | }  | 
737  |  |  | 
738  | 0  | std::string Schnorr_Sign::Name(void) const { return "Schnorr_Sign"; } | 
739  | 0  | std::string Schnorr_Sign::ToString(void) const { | 
740  | 0  |     std::stringstream ss;  | 
741  |  | 
  | 
742  | 0  |     ss << "operation name: Schnorr_Sign" << std::endl;  | 
743  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
744  | 0  |     ss << "nonce: " << nonce.ToString() << std::endl;  | 
745  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
746  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
747  | 0  |     ss << "nonce source: ";  | 
748  | 0  |     if ( UseRandomNonce() ) { | 
749  | 0  |         ss << "random";  | 
750  | 0  |     } else if ( UseBIP340Nonce() ) { | 
751  | 0  |         ss << "BIP 340";  | 
752  | 0  |     } else if ( UseSpecifiedNonce() ) { | 
753  | 0  |         ss << "specified";  | 
754  | 0  |     } else { | 
755  | 0  |         ss << "(unknown)";  | 
756  | 0  |     }  | 
757  | 0  |     ss << std::endl;  | 
758  |  | 
  | 
759  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
760  |  | 
  | 
761  | 0  |     return ss.str();  | 
762  | 0  | }  | 
763  |  |  | 
764  | 0  | nlohmann::json Schnorr_Sign::ToJSON(void) const { | 
765  | 0  |     nlohmann::json j;  | 
766  | 0  |     j["operation"] = "Schnorr_Sign";  | 
767  | 0  |     j["priv"] = priv.ToJSON();  | 
768  | 0  |     j["nonce"] = priv.ToJSON();  | 
769  | 0  |     j["curveType"] = curveType.ToJSON();  | 
770  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
771  | 0  |     j["nonceSource"] = nonceSource;  | 
772  | 0  |     j["digestType"] = digestType.ToJSON();  | 
773  | 0  |     j["modifier"] = modifier.ToJSON();  | 
774  | 0  |     return j;  | 
775  | 0  | }  | 
776  |  |  | 
777  | 0  | std::string ECCSI_Verify::Name(void) const { return "ECCSI_Verify"; } | 
778  | 0  | std::string ECCSI_Verify::ToString(void) const { | 
779  | 0  |     std::stringstream ss;  | 
780  |  | 
  | 
781  | 0  |     ss << "operation name: ECCSI_Verify" << std::endl;  | 
782  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
783  | 0  |     ss << "public key X: " << signature.pub.first.ToString() << std::endl;  | 
784  | 0  |     ss << "public key Y: " << signature.pub.second.ToString() << std::endl;  | 
785  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
786  | 0  |     ss << "id: " << util::HexDump(id.Get()) << std::endl;  | 
787  | 0  |     ss << "signature R: " << signature.signature.first.ToString() << std::endl;  | 
788  | 0  |     ss << "signature S: " << signature.signature.second.ToString() << std::endl;  | 
789  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
790  |  | 
  | 
791  | 0  |     return ss.str();  | 
792  | 0  | }  | 
793  |  |  | 
794  | 0  | nlohmann::json ECCSI_Verify::ToJSON(void) const { | 
795  | 0  |     nlohmann::json j;  | 
796  | 0  |     j["operation"] = "ECCSI_Verify";  | 
797  | 0  |     j["curveType"] = curveType.ToJSON();  | 
798  | 0  |     j["pub_x"] = signature.pub.first.ToJSON();  | 
799  | 0  |     j["pub_y"] = signature.pub.second.ToJSON();  | 
800  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
801  | 0  |     j["id"] = id.ToJSON();  | 
802  | 0  |     j["sig_r"] = signature.signature.first.ToJSON();  | 
803  | 0  |     j["sig_s"] = signature.signature.second.ToJSON();  | 
804  | 0  |     j["digestType"] = digestType.ToJSON();  | 
805  | 0  |     j["modifier"] = modifier.ToJSON();  | 
806  | 0  |     return j;  | 
807  | 0  | }  | 
808  |  |  | 
809  |  | /* Construct ECCSI_Verify from ECCSI_Sign */  | 
810  |  | ECCSI_Verify::ECCSI_Verify(const ECCSI_Sign& opECCSI_Sign, const component::ECCSI_Signature signature, component::Modifier modifier) :  | 
811  |  |     Operation(std::move(modifier)),  | 
812  |  |     curveType(opECCSI_Sign.curveType),  | 
813  |  |     cleartext(opECCSI_Sign.cleartext),  | 
814  |  |     id(opECCSI_Sign.id),  | 
815  |  |     signature(signature),  | 
816  |  |     digestType(opECCSI_Sign.digestType)  | 
817  | 0  | { } | 
818  |  |  | 
819  | 0  | std::string ECDSA_Verify::Name(void) const { return "ECDSA_Verify"; } | 
820  | 0  | std::string ECDSA_Verify::ToString(void) const { | 
821  | 0  |     std::stringstream ss;  | 
822  |  | 
  | 
823  | 0  |     ss << "operation name: ECDSA_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 ECDSA_Verify::ToJSON(void) const { | 
836  | 0  |     nlohmann::json j;  | 
837  | 0  |     j["operation"] = "ECDSA_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  |  | /* Construct ECDSA_Verify from ECDSA_Sign */  | 
850  |  | ECDSA_Verify::ECDSA_Verify(const ECDSA_Sign& opECDSA_Sign, const component::ECDSA_Signature signature, component::Modifier modifier) :  | 
851  |  |     Operation(std::move(modifier)),  | 
852  |  |     curveType(opECDSA_Sign.curveType),  | 
853  |  |     cleartext(opECDSA_Sign.cleartext),  | 
854  |  |     signature(signature),  | 
855  |  |     digestType(opECDSA_Sign.digestType)  | 
856  | 0  | { } | 
857  |  |  | 
858  | 0  | std::string ECGDSA_Verify::Name(void) const { return "ECGDSA_Verify"; } | 
859  | 0  | std::string ECGDSA_Verify::ToString(void) const { | 
860  | 0  |     std::stringstream ss;  | 
861  |  | 
  | 
862  | 0  |     ss << "operation name: ECGDSA_Verify" << std::endl;  | 
863  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
864  | 0  |     ss << "public key X: " << signature.pub.first.ToString() << std::endl;  | 
865  | 0  |     ss << "public key Y: " << signature.pub.second.ToString() << std::endl;  | 
866  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
867  | 0  |     ss << "signature R: " << signature.signature.first.ToString() << std::endl;  | 
868  | 0  |     ss << "signature S: " << signature.signature.second.ToString() << std::endl;  | 
869  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
870  |  | 
  | 
871  | 0  |     return ss.str();  | 
872  | 0  | }  | 
873  |  |  | 
874  | 0  | nlohmann::json ECGDSA_Verify::ToJSON(void) const { | 
875  | 0  |     nlohmann::json j;  | 
876  | 0  |     j["operation"] = "ECGDSA_Verify";  | 
877  | 0  |     j["curveType"] = curveType.ToJSON();  | 
878  | 0  |     j["pub_x"] = signature.pub.first.ToJSON();  | 
879  | 0  |     j["pub_y"] = signature.pub.second.ToJSON();  | 
880  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
881  | 0  |     j["sig_r"] = signature.signature.first.ToJSON();  | 
882  | 0  |     j["sig_s"] = signature.signature.second.ToJSON();  | 
883  | 0  |     j["digestType"] = digestType.ToJSON();  | 
884  | 0  |     j["modifier"] = modifier.ToJSON();  | 
885  | 0  |     return j;  | 
886  | 0  | }  | 
887  |  |  | 
888  | 0  | std::string ECRDSA_Verify::Name(void) const { return "ECRDSA_Verify"; } | 
889  | 0  | std::string ECRDSA_Verify::ToString(void) const { | 
890  | 0  |     std::stringstream ss;  | 
891  |  | 
  | 
892  | 0  |     ss << "operation name: ECRDSA_Verify" << std::endl;  | 
893  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
894  | 0  |     ss << "public key X: " << signature.pub.first.ToString() << std::endl;  | 
895  | 0  |     ss << "public key Y: " << signature.pub.second.ToString() << std::endl;  | 
896  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
897  | 0  |     ss << "signature R: " << signature.signature.first.ToString() << std::endl;  | 
898  | 0  |     ss << "signature S: " << signature.signature.second.ToString() << std::endl;  | 
899  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
900  |  | 
  | 
901  | 0  |     return ss.str();  | 
902  | 0  | }  | 
903  |  |  | 
904  | 0  | nlohmann::json ECRDSA_Verify::ToJSON(void) const { | 
905  | 0  |     nlohmann::json j;  | 
906  | 0  |     j["operation"] = "ECRDSA_Verify";  | 
907  | 0  |     j["curveType"] = curveType.ToJSON();  | 
908  | 0  |     j["pub_x"] = signature.pub.first.ToJSON();  | 
909  | 0  |     j["pub_y"] = signature.pub.second.ToJSON();  | 
910  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
911  | 0  |     j["sig_r"] = signature.signature.first.ToJSON();  | 
912  | 0  |     j["sig_s"] = signature.signature.second.ToJSON();  | 
913  | 0  |     j["digestType"] = digestType.ToJSON();  | 
914  | 0  |     j["modifier"] = modifier.ToJSON();  | 
915  | 0  |     return j;  | 
916  | 0  | }  | 
917  |  |  | 
918  | 0  | std::string Schnorr_Verify::Name(void) const { return "Schnorr_Verify"; } | 
919  | 0  | std::string Schnorr_Verify::ToString(void) const { | 
920  | 0  |     std::stringstream ss;  | 
921  |  | 
  | 
922  | 0  |     ss << "operation name: Schnorr_Verify" << std::endl;  | 
923  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
924  | 0  |     ss << "public key X: " << signature.pub.first.ToString() << std::endl;  | 
925  | 0  |     ss << "public key Y: " << signature.pub.second.ToString() << std::endl;  | 
926  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
927  | 0  |     ss << "signature R: " << signature.signature.first.ToString() << std::endl;  | 
928  | 0  |     ss << "signature S: " << signature.signature.second.ToString() << std::endl;  | 
929  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
930  |  | 
  | 
931  | 0  |     return ss.str();  | 
932  | 0  | }  | 
933  |  |  | 
934  | 0  | nlohmann::json Schnorr_Verify::ToJSON(void) const { | 
935  | 0  |     nlohmann::json j;  | 
936  | 0  |     j["operation"] = "Schnorr_Verify";  | 
937  | 0  |     j["curveType"] = curveType.ToJSON();  | 
938  | 0  |     j["pub_x"] = signature.pub.first.ToJSON();  | 
939  | 0  |     j["pub_y"] = signature.pub.second.ToJSON();  | 
940  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
941  | 0  |     j["sig_r"] = signature.signature.first.ToJSON();  | 
942  | 0  |     j["sig_s"] = signature.signature.second.ToJSON();  | 
943  | 0  |     j["digestType"] = digestType.ToJSON();  | 
944  | 0  |     j["modifier"] = modifier.ToJSON();  | 
945  | 0  |     return j;  | 
946  | 0  | }  | 
947  |  |  | 
948  | 0  | std::string ECDSA_Recover::Name(void) const { return "ECDSA_Recover"; } | 
949  | 0  | std::string ECDSA_Recover::ToString(void) const { | 
950  | 0  |     std::stringstream ss;  | 
951  |  | 
  | 
952  | 0  |     ss << "operation name: ECDSA_Recover" << std::endl;  | 
953  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
954  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
955  | 0  |     ss << "signature R: " << signature.first.ToString() << std::endl;  | 
956  | 0  |     ss << "signature S: " << signature.second.ToString() << std::endl;  | 
957  | 0  |     ss << "digest: " << repository::DigestToString(digestType.Get()) << std::endl;  | 
958  | 0  |     ss << "recovery ID: " << std::to_string(id) << std::endl;  | 
959  |  | 
  | 
960  | 0  |     return ss.str();  | 
961  | 0  | }  | 
962  |  |  | 
963  | 0  | nlohmann::json ECDSA_Recover::ToJSON(void) const { | 
964  | 0  |     nlohmann::json j;  | 
965  | 0  |     j["operation"] = "ECDSA_Recover";  | 
966  | 0  |     j["curveType"] = curveType.ToJSON();  | 
967  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
968  | 0  |     j["sig_r"] = signature.first.ToJSON();  | 
969  | 0  |     j["sig_s"] = signature.second.ToJSON();  | 
970  | 0  |     j["id"] = id;  | 
971  | 0  |     j["digestType"] = digestType.ToJSON();  | 
972  | 0  |     j["modifier"] = modifier.ToJSON();  | 
973  | 0  |     return j;  | 
974  | 0  | }  | 
975  |  |  | 
976  | 0  | std::string DSA_Verify::Name(void) const { return "DSA_Verify"; } | 
977  | 0  | std::string DSA_Verify::ToString(void) const { | 
978  | 0  |     std::stringstream ss;  | 
979  |  | 
  | 
980  | 0  |     ss << "operation name: DSA_Verify" << std::endl;  | 
981  | 0  |     ss << "p: " << parameters.p.ToString() << std::endl;  | 
982  | 0  |     ss << "q: " << parameters.q.ToString() << std::endl;  | 
983  | 0  |     ss << "g: " << parameters.g.ToString() << std::endl;  | 
984  | 0  |     ss << "public key: " << pub.ToString() << std::endl;  | 
985  | 0  |     ss << "r: " << signature.first.ToString() << std::endl;  | 
986  | 0  |     ss << "s: " << signature.second.ToString() << std::endl;  | 
987  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
988  |  | 
  | 
989  | 0  |     return ss.str();  | 
990  | 0  | }  | 
991  |  |  | 
992  | 0  | nlohmann::json DSA_Verify::ToJSON(void) const { | 
993  | 0  |     nlohmann::json j;  | 
994  | 0  |     j["p"] = parameters.p.ToJSON();  | 
995  | 0  |     j["q"] = parameters.q.ToJSON();  | 
996  | 0  |     j["g"] = parameters.g.ToJSON();  | 
997  | 0  |     j["pub"] = pub.ToJSON();  | 
998  | 0  |     j["r"] = signature.first.ToJSON();  | 
999  | 0  |     j["s"] = signature.second.ToJSON();  | 
1000  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1001  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1002  | 0  |     return j;  | 
1003  | 0  | }  | 
1004  |  |  | 
1005  | 0  | std::string DSA_Sign::Name(void) const { return "DSA_Sign"; } | 
1006  | 0  | std::string DSA_Sign::ToString(void) const { | 
1007  | 0  |     std::stringstream ss;  | 
1008  |  | 
  | 
1009  | 0  |     ss << "operation name: DSA_Sign" << std::endl;  | 
1010  | 0  |     ss << "p: " << parameters.p.ToString() << std::endl;  | 
1011  | 0  |     ss << "q: " << parameters.q.ToString() << std::endl;  | 
1012  | 0  |     ss << "g: " << parameters.g.ToString() << std::endl;  | 
1013  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1014  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1015  |  | 
  | 
1016  | 0  |     return ss.str();  | 
1017  | 0  | }  | 
1018  |  |  | 
1019  | 0  | nlohmann::json DSA_Sign::ToJSON(void) const { | 
1020  | 0  |     nlohmann::json j;  | 
1021  | 0  |     j["p"] = parameters.p.ToJSON();  | 
1022  | 0  |     j["q"] = parameters.q.ToJSON();  | 
1023  | 0  |     j["g"] = parameters.g.ToJSON();  | 
1024  | 0  |     j["priv"] = priv.ToJSON();  | 
1025  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1026  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1027  | 0  |     return j;  | 
1028  | 0  | }  | 
1029  |  |  | 
1030  | 0  | std::string DSA_PrivateToPublic::Name(void) const { return "DSA_PrivateToPublic"; } | 
1031  | 0  | std::string DSA_PrivateToPublic::ToString(void) const { | 
1032  | 0  |     std::stringstream ss;  | 
1033  |  | 
  | 
1034  | 0  |     ss << "operation name: DSA_PrivateToPublic" << std::endl;  | 
1035  | 0  |     ss << "priv: " << priv.ToString() << std::endl;  | 
1036  |  | 
  | 
1037  | 0  |     return ss.str();  | 
1038  | 0  | }  | 
1039  |  |  | 
1040  | 0  | nlohmann::json DSA_PrivateToPublic::ToJSON(void) const { | 
1041  | 0  |     nlohmann::json j;  | 
1042  | 0  |     j["priv"] = priv.ToJSON();  | 
1043  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1044  | 0  |     return j;  | 
1045  | 0  | }  | 
1046  |  |  | 
1047  | 0  | std::string DSA_GenerateKeyPair::Name(void) const { return "DSA_GenerateKeyPair"; } | 
1048  | 0  | std::string DSA_GenerateKeyPair::ToString(void) const { | 
1049  | 0  |     std::stringstream ss;  | 
1050  |  | 
  | 
1051  | 0  |     ss << "operation name: DSA_GenerateKeyPair" << std::endl;  | 
1052  | 0  |     ss << "p: " << p.ToString() << std::endl;  | 
1053  | 0  |     ss << "q: " << q.ToString() << std::endl;  | 
1054  | 0  |     ss << "g: " << g.ToString() << std::endl;  | 
1055  |  | 
  | 
1056  | 0  |     return ss.str();  | 
1057  | 0  | }  | 
1058  |  |  | 
1059  | 0  | nlohmann::json DSA_GenerateKeyPair::ToJSON(void) const { | 
1060  | 0  |     nlohmann::json j;  | 
1061  | 0  |     j["p"] = p.ToJSON();  | 
1062  | 0  |     j["q"] = q.ToJSON();  | 
1063  | 0  |     j["g"] = g.ToJSON();  | 
1064  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1065  | 0  |     return j;  | 
1066  | 0  | }  | 
1067  |  |  | 
1068  | 0  | std::string DSA_GenerateParameters::Name(void) const { return "DSA_GenerateParameters"; } | 
1069  | 0  | std::string DSA_GenerateParameters::ToString(void) const { | 
1070  | 0  |     std::stringstream ss;  | 
1071  |  | 
  | 
1072  | 0  |     ss << "operation name: DSA_GenerateParameters" << std::endl;  | 
1073  |  | 
  | 
1074  | 0  |     return ss.str();  | 
1075  | 0  | }  | 
1076  |  |  | 
1077  | 0  | nlohmann::json DSA_GenerateParameters::ToJSON(void) const { | 
1078  | 0  |     nlohmann::json j;  | 
1079  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1080  | 0  |     return j;  | 
1081  | 0  | }  | 
1082  |  |  | 
1083  | 0  | std::string ECDH_Derive::Name(void) const { return "ECDH_Derive"; } | 
1084  | 0  | std::string ECDH_Derive::ToString(void) const { | 
1085  | 0  |     std::stringstream ss;  | 
1086  |  | 
  | 
1087  | 0  |     ss << "operation name: ECDH_Derive" << std::endl;  | 
1088  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1089  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1090  | 0  |     ss << "public key X: " << pub.first.ToString() << std::endl;  | 
1091  | 0  |     ss << "public key Y: " << pub.second.ToString() << std::endl;  | 
1092  |  | 
  | 
1093  | 0  |     return ss.str();  | 
1094  | 0  | }  | 
1095  |  |  | 
1096  | 0  | nlohmann::json ECDH_Derive::ToJSON(void) const { | 
1097  | 0  |     nlohmann::json j;  | 
1098  | 0  |     j["operation"] = "ECDH_Derive";  | 
1099  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1100  | 0  |     j["priv"] = priv.ToJSON();  | 
1101  | 0  |     j["pub_x"] = pub.first.ToJSON();  | 
1102  | 0  |     j["pub_y"] = pub.second.ToJSON();  | 
1103  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1104  | 0  |     return j;  | 
1105  | 0  | }  | 
1106  |  |  | 
1107  | 0  | std::string ECIES_Encrypt::Name(void) const { return "ECIES_Encrypt"; } | 
1108  | 0  | std::string ECIES_Encrypt::ToString(void) const { | 
1109  | 0  |     std::stringstream ss;  | 
1110  |  | 
  | 
1111  | 0  |     ss << "operation name: ECIES_Encrypt" << std::endl;  | 
1112  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1113  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1114  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1115  | 0  |     ss << "public key X: " << pub.first.ToString() << std::endl;  | 
1116  | 0  |     ss << "public key Y: " << pub.second.ToString() << std::endl;  | 
1117  | 0  |     ss << "cipher: " << repository::CipherToString(cipherType.Get()) << std::endl;  | 
1118  | 0  |     ss << "iv: " << (iv ? util::HexDump(iv->Get()) : "nullopt") << std::endl;  | 
1119  |  | 
  | 
1120  | 0  |     return ss.str();  | 
1121  | 0  | }  | 
1122  |  |  | 
1123  | 0  | nlohmann::json ECIES_Encrypt::ToJSON(void) const { | 
1124  | 0  |     nlohmann::json j;  | 
1125  | 0  |     j["operation"] = "ECIES_Encrypt";  | 
1126  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1127  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1128  | 0  |     j["priv"] = priv.ToJSON();  | 
1129  | 0  |     j["pub_x"] = pub.first.ToJSON();  | 
1130  | 0  |     j["pub_y"] = pub.second.ToJSON();  | 
1131  | 0  |     j["cipherType"] = cipherType.ToJSON();  | 
1132  | 0  |     j["iv_enabled"] = (bool)(iv != std::nullopt);  | 
1133  | 0  |     j["iv"] = iv != std::nullopt ? iv->ToJSON() : "";  | 
1134  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1135  | 0  |     return j;  | 
1136  | 0  | }  | 
1137  |  |  | 
1138  | 0  | std::string ECIES_Decrypt::Name(void) const { return "ECIES_Decrypt"; } | 
1139  | 0  | std::string ECIES_Decrypt::ToString(void) const { | 
1140  | 0  |     std::stringstream ss;  | 
1141  |  | 
  | 
1142  | 0  |     ss << "operation name: ECIES_Decrypt" << std::endl;  | 
1143  | 0  |     ss << "ciphertext: " << util::HexDump(ciphertext.Get()) << std::endl;  | 
1144  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1145  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1146  | 0  |     ss << "public key X: " << pub.first.ToString() << std::endl;  | 
1147  | 0  |     ss << "public key Y: " << pub.second.ToString() << std::endl;  | 
1148  | 0  |     ss << "cipher: " << repository::CipherToString(cipherType.Get()) << std::endl;  | 
1149  | 0  |     ss << "iv: " << (iv ? util::HexDump(iv->Get()) : "nullopt") << std::endl;  | 
1150  |  | 
  | 
1151  | 0  |     return ss.str();  | 
1152  | 0  | }  | 
1153  |  |  | 
1154  | 0  | nlohmann::json ECIES_Decrypt::ToJSON(void) const { | 
1155  | 0  |     nlohmann::json j;  | 
1156  | 0  |     j["operation"] = "ECIES_Decrypt";  | 
1157  | 0  |     j["ciphertext"] = ciphertext.ToJSON();  | 
1158  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1159  | 0  |     j["priv"] = priv.ToJSON();  | 
1160  | 0  |     j["pub_x"] = pub.first.ToJSON();  | 
1161  | 0  |     j["pub_y"] = pub.second.ToJSON();  | 
1162  | 0  |     j["cipherType"] = cipherType.ToJSON();  | 
1163  | 0  |     j["iv_enabled"] = (bool)(iv != std::nullopt);  | 
1164  | 0  |     j["iv"] = iv != std::nullopt ? iv->ToJSON() : "";  | 
1165  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1166  | 0  |     return j;  | 
1167  | 0  | }  | 
1168  |  |  | 
1169  | 0  | std::string ECC_Point_Add::Name(void) const { return "ECC_Point_Add"; } | 
1170  | 0  | std::string ECC_Point_Add::ToString(void) const { | 
1171  | 0  |     std::stringstream ss;  | 
1172  |  | 
  | 
1173  | 0  |     ss << "operation name: ECC_Point_Add" << std::endl;  | 
1174  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1175  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1176  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1177  | 0  |     ss << "B X: " << b.first.ToString() << std::endl;  | 
1178  | 0  |     ss << "B Y: " << b.second.ToString() << std::endl;  | 
1179  |  | 
  | 
1180  | 0  |     return ss.str();  | 
1181  | 0  | }  | 
1182  |  |  | 
1183  | 0  | nlohmann::json ECC_Point_Add::ToJSON(void) const { | 
1184  | 0  |     nlohmann::json j;  | 
1185  | 0  |     j["operation"] = "ECC_Point_Add";  | 
1186  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1187  |  | 
  | 
1188  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1189  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1190  |  | 
  | 
1191  | 0  |     j["b_x"] = b.first.ToJSON();  | 
1192  | 0  |     j["b_y"] = b.second.ToJSON();  | 
1193  |  | 
  | 
1194  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1195  | 0  |     return j;  | 
1196  | 0  | }  | 
1197  |  |  | 
1198  | 0  | std::string ECC_Point_Sub::Name(void) const { return "ECC_Point_Sub"; } | 
1199  | 0  | std::string ECC_Point_Sub::ToString(void) const { | 
1200  | 0  |     std::stringstream ss;  | 
1201  |  | 
  | 
1202  | 0  |     ss << "operation name: ECC_Point_Sub" << std::endl;  | 
1203  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1204  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1205  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1206  | 0  |     ss << "B X: " << b.first.ToString() << std::endl;  | 
1207  | 0  |     ss << "B Y: " << b.second.ToString() << std::endl;  | 
1208  |  | 
  | 
1209  | 0  |     return ss.str();  | 
1210  | 0  | }  | 
1211  |  |  | 
1212  | 0  | nlohmann::json ECC_Point_Sub::ToJSON(void) const { | 
1213  | 0  |     nlohmann::json j;  | 
1214  | 0  |     j["operation"] = "ECC_Point_Sub";  | 
1215  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1216  |  | 
  | 
1217  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1218  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1219  |  | 
  | 
1220  | 0  |     j["b_x"] = b.first.ToJSON();  | 
1221  | 0  |     j["b_y"] = b.second.ToJSON();  | 
1222  |  | 
  | 
1223  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1224  | 0  |     return j;  | 
1225  | 0  | }  | 
1226  |  |  | 
1227  | 0  | std::string ECC_Point_Mul::Name(void) const { return "ECC_Point_Mul"; } | 
1228  | 0  | std::string ECC_Point_Mul::ToString(void) const { | 
1229  | 0  |     std::stringstream ss;  | 
1230  |  | 
  | 
1231  | 0  |     ss << "operation name: ECC_Point_Mul" << std::endl;  | 
1232  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1233  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1234  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1235  | 0  |     ss << "B: " << b.ToString() << std::endl;  | 
1236  |  | 
  | 
1237  | 0  |     return ss.str();  | 
1238  | 0  | }  | 
1239  |  |  | 
1240  | 0  | nlohmann::json ECC_Point_Mul::ToJSON(void) const { | 
1241  | 0  |     nlohmann::json j;  | 
1242  | 0  |     j["operation"] = "ECC_Point_Mul";  | 
1243  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1244  |  | 
  | 
1245  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1246  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1247  |  | 
  | 
1248  | 0  |     j["b"] = b.ToJSON();  | 
1249  |  | 
  | 
1250  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1251  | 0  |     return j;  | 
1252  | 0  | }  | 
1253  |  |  | 
1254  | 0  | std::string ECC_Point_Neg::Name(void) const { return "ECC_Point_Neg"; } | 
1255  | 0  | std::string ECC_Point_Neg::ToString(void) const { | 
1256  | 0  |     std::stringstream ss;  | 
1257  |  | 
  | 
1258  | 0  |     ss << "operation name: ECC_Point_Neg" << std::endl;  | 
1259  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1260  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1261  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1262  |  | 
  | 
1263  | 0  |     return ss.str();  | 
1264  | 0  | }  | 
1265  |  |  | 
1266  | 0  | nlohmann::json ECC_Point_Neg::ToJSON(void) const { | 
1267  | 0  |     nlohmann::json j;  | 
1268  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1269  |  | 
  | 
1270  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1271  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1272  |  | 
  | 
1273  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1274  | 0  |     return j;  | 
1275  | 0  | }  | 
1276  |  |  | 
1277  | 0  | std::string ECC_Point_Dbl::Name(void) const { return "ECC_Point_Dbl"; } | 
1278  | 0  | std::string ECC_Point_Dbl::ToString(void) const { | 
1279  | 0  |     std::stringstream ss;  | 
1280  |  | 
  | 
1281  | 0  |     ss << "operation name: ECC_Point_Dbl" << std::endl;  | 
1282  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1283  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1284  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1285  |  | 
  | 
1286  | 0  |     return ss.str();  | 
1287  | 0  | }  | 
1288  |  |  | 
1289  | 0  | nlohmann::json ECC_Point_Dbl::ToJSON(void) const { | 
1290  | 0  |     nlohmann::json j;  | 
1291  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1292  |  | 
  | 
1293  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1294  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1295  |  | 
  | 
1296  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1297  | 0  |     return j;  | 
1298  | 0  | }  | 
1299  |  |  | 
1300  | 0  | std::string ECC_Point_Cmp::Name(void) const { return "ECC_Point_Cmp"; } | 
1301  | 0  | std::string ECC_Point_Cmp::ToString(void) const { | 
1302  | 0  |     std::stringstream ss;  | 
1303  |  | 
  | 
1304  | 0  |     ss << "operation name: ECC_Point_Cmp" << std::endl;  | 
1305  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1306  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
1307  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
1308  | 0  |     ss << "B X: " << b.first.ToString() << std::endl;  | 
1309  | 0  |     ss << "B Y: " << b.second.ToString() << std::endl;  | 
1310  |  | 
  | 
1311  | 0  |     return ss.str();  | 
1312  | 0  | }  | 
1313  |  |  | 
1314  | 0  | nlohmann::json ECC_Point_Cmp::ToJSON(void) const { | 
1315  | 0  |     nlohmann::json j;  | 
1316  | 0  |     j["operation"] = "ECC_Point_Cmp";  | 
1317  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1318  |  | 
  | 
1319  | 0  |     j["a_x"] = a.first.ToJSON();  | 
1320  | 0  |     j["a_y"] = a.second.ToJSON();  | 
1321  |  | 
  | 
1322  | 0  |     j["b_x"] = b.first.ToJSON();  | 
1323  | 0  |     j["b_y"] = b.second.ToJSON();  | 
1324  |  | 
  | 
1325  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1326  | 0  |     return j;  | 
1327  | 0  | }  | 
1328  |  |  | 
1329  | 0  | std::string DH_GenerateKeyPair::Name(void) const { return "DH_GenerateKeyPair"; } | 
1330  | 0  | std::string DH_GenerateKeyPair::ToString(void) const { | 
1331  | 0  |     std::stringstream ss;  | 
1332  |  | 
  | 
1333  | 0  |     ss << "operation name: DH_GenerateKeyPair" << std::endl;  | 
1334  | 0  |     ss << "prime: " << prime.ToString() << std::endl;  | 
1335  | 0  |     ss << "base: " << base.ToString() << std::endl;  | 
1336  |  | 
  | 
1337  | 0  |     return ss.str();  | 
1338  | 0  | }  | 
1339  |  |  | 
1340  | 0  | nlohmann::json DH_GenerateKeyPair::ToJSON(void) const { | 
1341  | 0  |     nlohmann::json j;  | 
1342  | 0  |     j["operation"] = "DH_GenerateKeyPair";  | 
1343  | 0  |     j["prime"] = prime.ToJSON();  | 
1344  | 0  |     j["base"] = base.ToJSON();  | 
1345  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1346  | 0  |     return j;  | 
1347  | 0  | }  | 
1348  |  |  | 
1349  | 0  | std::string DH_Derive::Name(void) const { return "DH_Derive"; } | 
1350  | 0  | std::string DH_Derive::ToString(void) const { | 
1351  | 0  |     std::stringstream ss;  | 
1352  |  | 
  | 
1353  | 0  |     ss << "operation name: DH_Derive" << std::endl;  | 
1354  | 0  |     ss << "prime: " << prime.ToString() << std::endl;  | 
1355  | 0  |     ss << "base: " << base.ToString() << std::endl;  | 
1356  | 0  |     ss << "public key: " << pub.ToString() << std::endl;  | 
1357  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1358  |  | 
  | 
1359  | 0  |     return ss.str();  | 
1360  | 0  | }  | 
1361  |  |  | 
1362  | 0  | nlohmann::json DH_Derive::ToJSON(void) const { | 
1363  | 0  |     nlohmann::json j;  | 
1364  | 0  |     j["operation"] = "DH_Derive";  | 
1365  | 0  |     j["prime"] = prime.ToJSON();  | 
1366  | 0  |     j["base"] = base.ToJSON();  | 
1367  | 0  |     j["pub"] = pub.ToJSON();  | 
1368  | 0  |     j["priv"] = priv.ToJSON();  | 
1369  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1370  | 0  |     return j;  | 
1371  | 0  | }  | 
1372  |  |  | 
1373  | 0  | std::string BignumCalc::Name(void) const { return "BignumCalc"; } | 
1374  | 0  | std::string BignumCalc::ToString(void) const { | 
1375  | 0  |     std::stringstream ss;  | 
1376  |  | 
  | 
1377  | 0  |     ss << "operation name: BignumCalc" << std::endl;  | 
1378  | 0  |     ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;  | 
1379  | 0  |     ss << "bignum 1: " << bn0.ToString() << std::endl;  | 
1380  | 0  |     ss << "bignum 2: " << bn1.ToString() << std::endl;  | 
1381  | 0  |     ss << "bignum 3: " << bn2.ToString() << std::endl;  | 
1382  | 0  |     ss << "bignum 4: " << bn3.ToString() << std::endl;  | 
1383  |  | 
  | 
1384  | 0  |     return ss.str();  | 
1385  | 0  | }  | 
1386  |  |  | 
1387  | 0  | nlohmann::json BignumCalc::ToJSON(void) const { | 
1388  | 0  |     nlohmann::json j;  | 
1389  | 0  |     j["operation"] = "BignumCalc";  | 
1390  | 0  |     j["calcOp"] = calcOp.ToJSON();  | 
1391  | 0  |     j["bn0"] = bn0.ToJSON();  | 
1392  | 0  |     j["bn1"] = bn1.ToJSON();  | 
1393  | 0  |     j["bn2"] = bn2.ToJSON();  | 
1394  | 0  |     j["bn3"] = bn3.ToJSON();  | 
1395  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1396  | 0  |     return j;  | 
1397  | 0  | }  | 
1398  |  |  | 
1399  | 0  | std::string BignumCalc_Fp2::Name(void) const { return "BignumCalc_Fp2"; } | 
1400  | 0  | std::string BignumCalc_Fp2::ToString(void) const { | 
1401  | 0  |     std::stringstream ss;  | 
1402  |  | 
  | 
1403  | 0  |     ss << "operation name: BignumCalc_Fp2" << std::endl;  | 
1404  | 0  |     ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;  | 
1405  | 0  |     ss << "Fp2 1 x: " << bn0.first.ToString() << std::endl;  | 
1406  | 0  |     ss << "Fp2 1 x: " << bn0.second.ToString() << std::endl;  | 
1407  | 0  |     ss << "Fp2 2 x: " << bn1.first.ToString() << std::endl;  | 
1408  | 0  |     ss << "Fp2 2 x: " << bn1.second.ToString() << std::endl;  | 
1409  | 0  |     ss << "Fp2 3 x: " << bn2.first.ToString() << std::endl;  | 
1410  | 0  |     ss << "Fp2 3 x: " << bn2.second.ToString() << std::endl;  | 
1411  | 0  |     ss << "Fp2 4 x: " << bn3.first.ToString() << std::endl;  | 
1412  | 0  |     ss << "Fp2 4 x: " << bn3.second.ToString() << std::endl;  | 
1413  |  | 
  | 
1414  | 0  |     return ss.str();  | 
1415  | 0  | }  | 
1416  |  |  | 
1417  | 0  | nlohmann::json BignumCalc_Fp2::ToJSON(void) const { | 
1418  | 0  |     nlohmann::json j;  | 
1419  | 0  |     j["operation"] = "BignumCalc";  | 
1420  | 0  |     j["calcOp"] = calcOp.ToJSON();  | 
1421  | 0  |     j["bn0"] = bn0.ToJSON();  | 
1422  | 0  |     j["bn1"] = bn1.ToJSON();  | 
1423  | 0  |     j["bn2"] = bn2.ToJSON();  | 
1424  | 0  |     j["bn3"] = bn3.ToJSON();  | 
1425  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1426  | 0  |     return j;  | 
1427  | 0  | }  | 
1428  |  |  | 
1429  | 0  | std::string BignumCalc_Fp12::Name(void) const { return "BignumCalc_Fp12"; } | 
1430  | 0  | std::string BignumCalc_Fp12::ToString(void) const { | 
1431  | 0  |     std::stringstream ss;  | 
1432  |  | 
  | 
1433  | 0  |     ss << "operation name: BignumCalc_Fp12" << std::endl;  | 
1434  | 0  |     ss << "calc operation: " << repository::CalcOpToString(calcOp.Get()) << std::endl;  | 
1435  | 0  |     ss << "bn0 1: " << bn0.bn1.ToString() << std::endl;  | 
1436  | 0  |     ss << "bn0 2: " << bn0.bn2.ToString() << std::endl;  | 
1437  | 0  |     ss << "bn0 3: " << bn0.bn3.ToString() << std::endl;  | 
1438  | 0  |     ss << "bn0 4: " << bn0.bn4.ToString() << std::endl;  | 
1439  | 0  |     ss << "bn0 5: " << bn0.bn5.ToString() << std::endl;  | 
1440  | 0  |     ss << "bn0 6: " << bn0.bn6.ToString() << std::endl;  | 
1441  | 0  |     ss << "bn0 7: " << bn0.bn7.ToString() << std::endl;  | 
1442  | 0  |     ss << "bn0 8: " << bn0.bn8.ToString() << std::endl;  | 
1443  | 0  |     ss << "bn0 9: " << bn0.bn9.ToString() << std::endl;  | 
1444  | 0  |     ss << "bn0 10: " << bn0.bn10.ToString() << std::endl;  | 
1445  | 0  |     ss << "bn0 11: " << bn0.bn11.ToString() << std::endl;  | 
1446  | 0  |     ss << "bn0 12: " << bn0.bn12.ToString() << std::endl;  | 
1447  |  | 
  | 
1448  | 0  |     ss << std::endl;  | 
1449  |  | 
  | 
1450  | 0  |     ss << "bn1 1: " << bn1.bn1.ToString() << std::endl;  | 
1451  | 0  |     ss << "bn1 2: " << bn1.bn2.ToString() << std::endl;  | 
1452  | 0  |     ss << "bn1 3: " << bn1.bn3.ToString() << std::endl;  | 
1453  | 0  |     ss << "bn1 4: " << bn1.bn4.ToString() << std::endl;  | 
1454  | 0  |     ss << "bn1 5: " << bn1.bn5.ToString() << std::endl;  | 
1455  | 0  |     ss << "bn1 6: " << bn1.bn6.ToString() << std::endl;  | 
1456  | 0  |     ss << "bn1 7: " << bn1.bn7.ToString() << std::endl;  | 
1457  | 0  |     ss << "bn1 8: " << bn1.bn8.ToString() << std::endl;  | 
1458  | 0  |     ss << "bn1 9: " << bn1.bn9.ToString() << std::endl;  | 
1459  | 0  |     ss << "bn1 10: " << bn1.bn10.ToString() << std::endl;  | 
1460  | 0  |     ss << "bn1 11: " << bn1.bn11.ToString() << std::endl;  | 
1461  | 0  |     ss << "bn1 12: " << bn1.bn12.ToString() << std::endl;  | 
1462  |  | 
  | 
1463  | 0  |     return ss.str();  | 
1464  | 0  | }  | 
1465  |  |  | 
1466  | 0  | nlohmann::json BignumCalc_Fp12::ToJSON(void) const { | 
1467  | 0  |     nlohmann::json j;  | 
1468  | 0  |     j["operation"] = "BignumCalc";  | 
1469  | 0  |     j["calcOp"] = calcOp.ToJSON();  | 
1470  | 0  |     j["bn0"] = bn0.ToJSON();  | 
1471  | 0  |     j["bn1"] = bn1.ToJSON();  | 
1472  | 0  |     j["bn2"] = bn2.ToJSON();  | 
1473  | 0  |     j["bn3"] = bn3.ToJSON();  | 
1474  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1475  | 0  |     return j;  | 
1476  | 0  | }  | 
1477  |  |  | 
1478  | 0  | std::string BLS_PrivateToPublic::Name(void) const { return "BLS_PrivateToPublic"; } | 
1479  | 0  | std::string BLS_PrivateToPublic::ToString(void) const { | 
1480  | 0  |     std::stringstream ss;  | 
1481  |  | 
  | 
1482  | 0  |     ss << "operation name: BLS_PrivateToPublic" << std::endl;  | 
1483  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1484  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1485  |  | 
  | 
1486  | 0  |     return ss.str();  | 
1487  | 0  | }  | 
1488  |  |  | 
1489  | 0  | nlohmann::json BLS_PrivateToPublic::ToJSON(void) const { | 
1490  | 0  |     nlohmann::json j;  | 
1491  | 0  |     j["priv"] = priv.ToJSON();  | 
1492  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1493  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1494  | 0  |     return j;  | 
1495  | 0  | }  | 
1496  |  |  | 
1497  | 0  | std::string BLS_PrivateToPublic_G2::Name(void) const { return "BLS_PrivateToPublic_G2"; } | 
1498  | 0  | std::string BLS_PrivateToPublic_G2::ToString(void) const { | 
1499  | 0  |     std::stringstream ss;  | 
1500  |  | 
  | 
1501  | 0  |     ss << "operation name: BLS_PrivateToPublic_G2" << std::endl;  | 
1502  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1503  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1504  |  | 
  | 
1505  | 0  |     return ss.str();  | 
1506  | 0  | }  | 
1507  |  |  | 
1508  | 0  | nlohmann::json BLS_PrivateToPublic_G2::ToJSON(void) const { | 
1509  | 0  |     nlohmann::json j;  | 
1510  | 0  |     j["priv"] = priv.ToJSON();  | 
1511  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1512  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1513  | 0  |     return j;  | 
1514  | 0  | }  | 
1515  |  |  | 
1516  | 0  | std::string BLS_Sign::Name(void) const { return "BLS_Sign"; } | 
1517  | 0  | std::string BLS_Sign::ToString(void) const { | 
1518  | 0  |     std::stringstream ss;  | 
1519  |  | 
  | 
1520  | 0  |     ss << "operation name: BLS_Sign" << std::endl;  | 
1521  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1522  | 0  |     ss << "private key: " << priv.ToString() << std::endl;  | 
1523  | 0  |     if ( hashOrPoint == true ) { | 
1524  | 0  |         ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1525  | 0  |     } else { | 
1526  | 0  |         ss << "point V: " << point.first.first.ToString() << std::endl;  | 
1527  | 0  |         ss << "point W: " << point.first.second.ToString() << std::endl;  | 
1528  | 0  |         ss << "point X: " << point.second.first.ToString() << std::endl;  | 
1529  | 0  |         ss << "point Y: " << point.second.second.ToString() << std::endl;  | 
1530  | 0  |     }  | 
1531  | 0  |     ss << "dest: " << util::HexDump(dest.Get()) << std::endl;  | 
1532  | 0  |     ss << "aug: " << util::HexDump(aug.Get()) << std::endl;  | 
1533  |  | 
  | 
1534  | 0  |     return ss.str();  | 
1535  | 0  | }  | 
1536  |  |  | 
1537  | 0  | nlohmann::json BLS_Sign::ToJSON(void) const { | 
1538  | 0  |     nlohmann::json j;  | 
1539  |  | 
  | 
1540  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1541  |  | 
  | 
1542  | 0  |     j["hashOrPoint"] = hashOrPoint;  | 
1543  |  | 
  | 
1544  | 0  |     j["priv"] = priv.ToJSON();  | 
1545  |  | 
  | 
1546  | 0  |     if ( hashOrPoint == true ) { | 
1547  | 0  |         j["cleartext"] = cleartext.ToJSON();  | 
1548  | 0  |     } else { | 
1549  | 0  |         j["g2_v"] = point.first.first.ToJSON();  | 
1550  | 0  |         j["g2_w"] = point.first.second.ToJSON();  | 
1551  | 0  |         j["g2_x"] = point.second.first.ToJSON();  | 
1552  | 0  |         j["g2_y"] = point.second.second.ToJSON();  | 
1553  | 0  |     }  | 
1554  | 0  |     j["dest"] = dest.ToJSON();  | 
1555  | 0  |     j["aug"] = aug.ToJSON();  | 
1556  |  | 
  | 
1557  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1558  |  | 
  | 
1559  | 0  |     return j;  | 
1560  | 0  | }  | 
1561  |  |  | 
1562  | 0  | std::string BLS_Verify::Name(void) const { return "BLS_Verify"; } | 
1563  | 0  | std::string BLS_Verify::ToString(void) const { | 
1564  | 0  |     std::stringstream ss;  | 
1565  |  | 
  | 
1566  | 0  |     ss << "operation name: BLS_Verify" << std::endl;  | 
1567  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1568  | 0  |     ss << "public key X: " << pub.first.ToString() << std::endl;  | 
1569  | 0  |     ss << "public key Y: " << pub.second.ToString() << std::endl;  | 
1570  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1571  | 0  |     ss << "signature V: " << signature.first.first.ToString() << std::endl;  | 
1572  | 0  |     ss << "signature W: " << signature.first.second.ToString() << std::endl;  | 
1573  | 0  |     ss << "signature X: " << signature.second.first.ToString() << std::endl;  | 
1574  | 0  |     ss << "signature Y: " << signature.second.second.ToString() << std::endl;  | 
1575  | 0  |     ss << "dest: " << util::HexDump(dest.Get()) << std::endl;  | 
1576  |  | 
  | 
1577  | 0  |     return ss.str();  | 
1578  | 0  | }  | 
1579  |  |  | 
1580  | 0  | nlohmann::json BLS_Verify::ToJSON(void) const { | 
1581  | 0  |     nlohmann::json j;  | 
1582  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1583  |  | 
  | 
1584  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1585  |  | 
  | 
1586  | 0  |     j["g1_x"] = pub.first.ToJSON();  | 
1587  | 0  |     j["g1_y"] = pub.second.ToJSON();  | 
1588  |  | 
  | 
1589  | 0  |     j["g2_v"] = signature.first.first.ToJSON();  | 
1590  | 0  |     j["g2_w"] = signature.first.second.ToJSON();  | 
1591  | 0  |     j["g2_x"] = signature.second.first.ToJSON();  | 
1592  | 0  |     j["g2_y"] = signature.second.second.ToJSON();  | 
1593  |  | 
  | 
1594  | 0  |     j["dest"] = dest.ToJSON();  | 
1595  |  | 
  | 
1596  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1597  | 0  |     return j;  | 
1598  | 0  | }  | 
1599  |  |  | 
1600  | 0  | std::string BLS_BatchSign::Name(void) const { return "BLS_BatchSign"; } | 
1601  | 0  | std::string BLS_BatchSign::ToString(void) const { | 
1602  | 0  |     std::stringstream ss;  | 
1603  |  | 
  | 
1604  | 0  |     ss << "operation name: BLS_BatchSign" << std::endl;  | 
1605  |  | 
  | 
1606  | 0  |     for (const auto& cur : bf.c) { | 
1607  | 0  |         ss << "priv: " << cur.priv.ToString() << std::endl;  | 
1608  | 0  |         ss << "G1 X: " << cur.g1.first.ToString() << std::endl;  | 
1609  | 0  |         ss << "G1 Y: " << cur.g1.second.ToString() << std::endl;  | 
1610  | 0  |     }  | 
1611  | 0  |     return ss.str();  | 
1612  | 0  | }  | 
1613  |  |  | 
1614  | 0  | nlohmann::json BLS_BatchSign::ToJSON(void) const { | 
1615  | 0  |     nlohmann::json j;  | 
1616  |  |     /* TODO */  | 
1617  | 0  |     return j;  | 
1618  | 0  | }  | 
1619  |  |  | 
1620  | 0  | std::string BLS_BatchVerify::Name(void) const { return "BLS_BatchVerify"; } | 
1621  | 0  | std::string BLS_BatchVerify::ToString(void) const { | 
1622  | 0  |     std::stringstream ss;  | 
1623  |  | 
  | 
1624  | 0  |     for (const auto& cur : bf.c) { | 
1625  | 0  |         ss << "G1 X: " << cur.g1.first.ToString() << std::endl;  | 
1626  | 0  |         ss << "G1 Y: " << cur.g1.second.ToString() << std::endl;  | 
1627  | 0  |         ss << std::endl;  | 
1628  | 0  |         ss << "G2 V: " << cur.g2.first.first.ToString() << std::endl;  | 
1629  | 0  |         ss << "G2 W: " << cur.g2.first.second.ToString() << std::endl;  | 
1630  | 0  |         ss << "G2 X: " << cur.g2.second.first.ToString() << std::endl;  | 
1631  | 0  |         ss << "G2 Y: " << cur.g2.second.second.ToString() << std::endl;  | 
1632  | 0  |         ss << "----------" << std::endl;  | 
1633  | 0  |     }  | 
1634  |  |  | 
1635  |  |     /* TODO */  | 
1636  | 0  |     return ss.str();  | 
1637  | 0  | }  | 
1638  |  |  | 
1639  | 0  | nlohmann::json BLS_BatchVerify::ToJSON(void) const { | 
1640  | 0  |     nlohmann::json j;  | 
1641  | 0  |     j["operation"] = "BLS_BatchVerify";  | 
1642  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1643  | 0  |     j["bf"] = bf.ToJSON();  | 
1644  | 0  |     return j;  | 
1645  | 0  | }  | 
1646  |  |  | 
1647  | 0  | std::string BLS_Pairing::Name(void) const { return "BLS_Pairing"; } | 
1648  | 0  | std::string BLS_Pairing::ToString(void) const { | 
1649  | 0  |     std::stringstream ss;  | 
1650  |  | 
  | 
1651  | 0  |     ss << "operation name: BLS_Pairing" << std::endl;  | 
1652  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1653  | 0  |     ss << "G1 X: " << g1.first.ToString() << std::endl;  | 
1654  | 0  |     ss << "G1 Y: " << g1.second.ToString() << std::endl;  | 
1655  | 0  |     ss << "G2 V: " << g2.first.first.ToString() << std::endl;  | 
1656  | 0  |     ss << "G2 W: " << g2.first.second.ToString() << std::endl;  | 
1657  | 0  |     ss << "G2 X: " << g2.second.first.ToString() << std::endl;  | 
1658  | 0  |     ss << "G2 Y: " << g2.second.second.ToString() << std::endl;  | 
1659  |  | 
  | 
1660  | 0  |     return ss.str();  | 
1661  | 0  | }  | 
1662  |  |  | 
1663  | 0  | nlohmann::json BLS_Pairing::ToJSON(void) const { | 
1664  | 0  |     nlohmann::json j;  | 
1665  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1666  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1667  | 0  |     j["g1_x"] = g1.first.ToJSON();  | 
1668  | 0  |     j["g1_y"] = g1.second.ToJSON();  | 
1669  | 0  |     j["g2_v"] = g2.first.first.ToJSON();  | 
1670  | 0  |     j["g2_w"] = g2.first.second.ToJSON();  | 
1671  | 0  |     j["g2_x"] = g2.second.first.ToJSON();  | 
1672  | 0  |     j["g2_y"] = g2.second.second.ToJSON();  | 
1673  | 0  |     return j;  | 
1674  | 0  | }  | 
1675  |  |  | 
1676  | 0  | std::string BLS_MillerLoop::Name(void) const { return "BLS_MillerLoop"; } | 
1677  | 0  | std::string BLS_MillerLoop::ToString(void) const { | 
1678  | 0  |     std::stringstream ss;  | 
1679  |  | 
  | 
1680  | 0  |     ss << "operation name: BLS_MillerLoop" << std::endl;  | 
1681  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1682  | 0  |     ss << "G1 X: " << g1.first.ToString() << std::endl;  | 
1683  | 0  |     ss << "G1 Y: " << g1.second.ToString() << std::endl;  | 
1684  | 0  |     ss << "G2 V: " << g2.first.first.ToString() << std::endl;  | 
1685  | 0  |     ss << "G2 W: " << g2.first.second.ToString() << std::endl;  | 
1686  | 0  |     ss << "G2 X: " << g2.second.first.ToString() << std::endl;  | 
1687  | 0  |     ss << "G2 Y: " << g2.second.second.ToString() << std::endl;  | 
1688  |  | 
  | 
1689  | 0  |     return ss.str();  | 
1690  | 0  | }  | 
1691  |  |  | 
1692  | 0  | nlohmann::json BLS_MillerLoop::ToJSON(void) const { | 
1693  | 0  |     nlohmann::json j;  | 
1694  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1695  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1696  | 0  |     return j;  | 
1697  | 0  | }  | 
1698  |  |  | 
1699  | 0  | std::string BLS_FinalExp::Name(void) const { return "BLS_FinalExp"; } | 
1700  | 0  | std::string BLS_FinalExp::ToString(void) const { | 
1701  | 0  |     std::stringstream ss;  | 
1702  |  | 
  | 
1703  | 0  |     ss << "operation name: BLS_FinalExp" << std::endl;  | 
1704  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1705  | 0  |     ss << "Fp12 c0.b0.a0: " << fp12.bn1.ToString() << std::endl;  | 
1706  | 0  |     ss << "Fp12 c0.b0.a1: " << fp12.bn2.ToString() << std::endl;  | 
1707  | 0  |     ss << "Fp12 c0.b1.a0: " << fp12.bn3.ToString() << std::endl;  | 
1708  | 0  |     ss << "Fp12 c0.b1.a1: " << fp12.bn4.ToString() << std::endl;  | 
1709  | 0  |     ss << "Fp12 c0.b2.a0: " << fp12.bn5.ToString() << std::endl;  | 
1710  | 0  |     ss << "Fp12 c0.b2.a1: " << fp12.bn6.ToString() << std::endl;  | 
1711  | 0  |     ss << "Fp12 c1.b0.a0: " << fp12.bn7.ToString() << std::endl;  | 
1712  | 0  |     ss << "Fp12 c1.b0.a1: " << fp12.bn8.ToString() << std::endl;  | 
1713  | 0  |     ss << "Fp12 c1.b1.a0: " << fp12.bn9.ToString() << std::endl;  | 
1714  | 0  |     ss << "Fp12 c1.b1.a1: " << fp12.bn10.ToString() << std::endl;  | 
1715  | 0  |     ss << "Fp12 c1.b2.a0: " << fp12.bn11.ToString() << std::endl;  | 
1716  | 0  |     ss << "Fp12 c1.b2.a1: " << fp12.bn12.ToString() << std::endl;  | 
1717  |  | 
  | 
1718  | 0  |     return ss.str();  | 
1719  | 0  | }  | 
1720  |  |  | 
1721  | 0  | nlohmann::json BLS_FinalExp::ToJSON(void) const { | 
1722  | 0  |     nlohmann::json j;  | 
1723  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1724  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1725  | 0  |     j["fp12"] = fp12.ToJSON();  | 
1726  | 0  |     return j;  | 
1727  | 0  | }  | 
1728  | 0  | std::string BLS_Aggregate_G1::Name(void) const { return "BLS_Aggregate_G1"; } | 
1729  | 0  | std::string BLS_Aggregate_G1::ToString(void) const { | 
1730  | 0  |     std::stringstream ss;  | 
1731  |  | 
  | 
1732  | 0  |     ss << "operation name: BLS_Aggregate_G1" << std::endl;  | 
1733  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1734  |  | 
  | 
1735  | 0  |     for (const auto& g1 : points.points) { | 
1736  | 0  |         ss << "    X: " << g1.first.ToString() << std::endl;  | 
1737  | 0  |         ss << "    Y: " << g1.second.ToString() << std::endl;  | 
1738  | 0  |         ss << std::endl;  | 
1739  | 0  |     }  | 
1740  |  | 
  | 
1741  | 0  |     return ss.str();  | 
1742  | 0  | }  | 
1743  |  |  | 
1744  | 0  | nlohmann::json BLS_Aggregate_G1::ToJSON(void) const { | 
1745  | 0  |     nlohmann::json j;  | 
1746  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1747  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1748  |  | 
  | 
1749  | 0  |     nlohmann::json points_json = nlohmann::json::array();  | 
1750  |  | 
  | 
1751  | 0  |     for (const auto& g1 : points.points) { | 
1752  | 0  |         nlohmann::json point;  | 
1753  |  | 
  | 
1754  | 0  |         point["x"] = g1.first.ToJSON();  | 
1755  | 0  |         point["y"] = g1.second.ToJSON();  | 
1756  |  | 
  | 
1757  | 0  |         points_json.push_back(point);  | 
1758  | 0  |     }  | 
1759  |  | 
  | 
1760  | 0  |     j["points"] = points_json;  | 
1761  |  | 
  | 
1762  | 0  |     return j;  | 
1763  | 0  | }  | 
1764  |  |  | 
1765  | 0  | std::string BLS_Aggregate_G2::Name(void) const { return "BLS_Aggregate_G2"; } | 
1766  | 0  | std::string BLS_Aggregate_G2::ToString(void) const { | 
1767  | 0  |     std::stringstream ss;  | 
1768  |  | 
  | 
1769  | 0  |     ss << "operation name: BLS_Aggregate_G2" << std::endl;  | 
1770  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1771  |  | 
  | 
1772  | 0  |     for (const auto& g2 : points.points) { | 
1773  | 0  |         ss << "    V:" << g2.first.first.ToString() << std::endl;  | 
1774  | 0  |         ss << "    W:" << g2.first.second.ToString() << std::endl;  | 
1775  | 0  |         ss << "    X:" << g2.second.first.ToString() << std::endl;  | 
1776  | 0  |         ss << "    Y:" << g2.second.second.ToString() << std::endl;  | 
1777  | 0  |         ss << std::endl;  | 
1778  | 0  |     }  | 
1779  |  | 
  | 
1780  | 0  |     return ss.str();  | 
1781  | 0  | }  | 
1782  |  |  | 
1783  | 0  | nlohmann::json BLS_Aggregate_G2::ToJSON(void) const { | 
1784  | 0  |     nlohmann::json j;  | 
1785  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1786  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1787  |  | 
  | 
1788  | 0  |     nlohmann::json points_json = nlohmann::json::array();  | 
1789  |  | 
  | 
1790  | 0  |     for (const auto& g2 : points.points) { | 
1791  | 0  |         nlohmann::json point;  | 
1792  |  | 
  | 
1793  | 0  |         point["v"] = g2.first.first.ToJSON();  | 
1794  | 0  |         point["w"] = g2.first.second.ToJSON();  | 
1795  | 0  |         point["x"] = g2.second.first.ToJSON();  | 
1796  | 0  |         point["y"] = g2.second.second.ToJSON();  | 
1797  |  | 
  | 
1798  | 0  |         points_json.push_back(point);  | 
1799  | 0  |     }  | 
1800  |  | 
  | 
1801  | 0  |     j["points"] = points_json;  | 
1802  | 0  |     return j;  | 
1803  | 0  | }  | 
1804  |  |  | 
1805  | 0  | std::string BLS_HashToG1::Name(void) const { return "BLS_HashToG1"; } | 
1806  | 0  | std::string BLS_HashToG1::ToString(void) const { | 
1807  | 0  |     std::stringstream ss;  | 
1808  |  | 
  | 
1809  | 0  |     ss << "operation name: BLS_HashToG1" << std::endl;  | 
1810  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1811  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1812  | 0  |     ss << "dest: " << util::HexDump(dest.Get()) << std::endl;  | 
1813  | 0  |     ss << "aug: " << util::HexDump(aug.Get()) << std::endl;  | 
1814  |  | 
  | 
1815  | 0  |     return ss.str();  | 
1816  | 0  | }  | 
1817  |  |  | 
1818  | 0  | nlohmann::json BLS_HashToG1::ToJSON(void) const { | 
1819  | 0  |     nlohmann::json j;  | 
1820  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1821  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1822  | 0  |     j["dest"] = dest.ToJSON();  | 
1823  | 0  |     j["aug"] = aug.ToJSON();  | 
1824  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1825  | 0  |     return j;  | 
1826  | 0  | }  | 
1827  |  |  | 
1828  | 0  | std::string BLS_HashToG2::Name(void) const { return "BLS_HashToG2"; } | 
1829  | 0  | std::string BLS_HashToG2::ToString(void) const { | 
1830  | 0  |     std::stringstream ss;  | 
1831  |  | 
  | 
1832  | 0  |     ss << "operation name: BLS_HashToG2" << std::endl;  | 
1833  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1834  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
1835  | 0  |     ss << "dest: " << util::HexDump(dest.Get()) << std::endl;  | 
1836  | 0  |     ss << "aug: " << util::HexDump(aug.Get()) << std::endl;  | 
1837  |  | 
  | 
1838  | 0  |     return ss.str();  | 
1839  | 0  | }  | 
1840  |  |  | 
1841  | 0  | nlohmann::json BLS_HashToG2::ToJSON(void) const { | 
1842  | 0  |     nlohmann::json j;  | 
1843  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1844  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
1845  | 0  |     j["dest"] = dest.ToJSON();  | 
1846  | 0  |     j["aug"] = aug.ToJSON();  | 
1847  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1848  | 0  |     return j;  | 
1849  | 0  | }  | 
1850  |  |  | 
1851  | 0  | std::string BLS_MapToG1::Name(void) const { return "BLS_MapToG1"; } | 
1852  | 0  | std::string BLS_MapToG1::ToString(void) const { | 
1853  | 0  |     std::stringstream ss;  | 
1854  |  | 
  | 
1855  | 0  |     ss << "operation name: BLS_MapToG1" << std::endl;  | 
1856  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1857  | 0  |     ss << "u: " << u.ToString() << std::endl;  | 
1858  | 0  |     ss << "v: " << v.ToString() << std::endl;  | 
1859  |  | 
  | 
1860  | 0  |     return ss.str();  | 
1861  | 0  | }  | 
1862  |  |  | 
1863  | 0  | nlohmann::json BLS_MapToG1::ToJSON(void) const { | 
1864  | 0  |     nlohmann::json j;  | 
1865  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1866  | 0  |     j["u"] = u.ToJSON();  | 
1867  | 0  |     j["v"] = v.ToJSON();  | 
1868  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1869  | 0  |     return j;  | 
1870  | 0  | }  | 
1871  |  |  | 
1872  | 0  | std::string BLS_MapToG2::Name(void) const { return "BLS_MapToG2"; } | 
1873  | 0  | std::string BLS_MapToG2::ToString(void) const { | 
1874  | 0  |     std::stringstream ss;  | 
1875  |  | 
  | 
1876  | 0  |     ss << "operation name: BLS_MapToG2" << std::endl;  | 
1877  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1878  | 0  |     ss << "u_x: " << u.first.ToString() << std::endl;  | 
1879  | 0  |     ss << "u_y: " << u.second.ToString() << std::endl;  | 
1880  | 0  |     ss << "v_x: " << v.first.ToString() << std::endl;  | 
1881  | 0  |     ss << "v_y: " << v.second.ToString() << std::endl;  | 
1882  |  | 
  | 
1883  | 0  |     return ss.str();  | 
1884  | 0  | }  | 
1885  |  |  | 
1886  | 0  | nlohmann::json BLS_MapToG2::ToJSON(void) const { | 
1887  | 0  |     nlohmann::json j;  | 
1888  |  | 
  | 
1889  | 0  |     j["u_x"] = u.first.ToJSON();  | 
1890  | 0  |     j["u_y"] = u.second.ToJSON();  | 
1891  | 0  |     j["v_x"] = v.first.ToJSON();  | 
1892  | 0  |     j["v_y"] = v.second.ToJSON();  | 
1893  |  | 
  | 
1894  | 0  |     return j;  | 
1895  | 0  | }  | 
1896  |  |  | 
1897  | 0  | std::string BLS_IsG1OnCurve::Name(void) const { return "BLS_IsG1OnCurve"; } | 
1898  | 0  | std::string BLS_IsG1OnCurve::ToString(void) const { | 
1899  | 0  |     std::stringstream ss;  | 
1900  |  | 
  | 
1901  | 0  |     ss << "operation name: BLS_IsG1OnCurve" << std::endl;  | 
1902  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1903  | 0  |     ss << "G1 X: " << g1.first.ToString() << std::endl;  | 
1904  | 0  |     ss << "G1 Y: " << g1.second.ToString() << std::endl;  | 
1905  |  | 
  | 
1906  | 0  |     return ss.str();  | 
1907  | 0  | }  | 
1908  |  |  | 
1909  | 0  | nlohmann::json BLS_IsG1OnCurve::ToJSON(void) const { | 
1910  | 0  |     nlohmann::json j;  | 
1911  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1912  |  | 
  | 
1913  | 0  |     j["g1_x"] = g1.first.ToJSON();  | 
1914  | 0  |     j["g1_y"] = g1.second.ToJSON();  | 
1915  |  | 
  | 
1916  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1917  | 0  |     return j;  | 
1918  | 0  | }  | 
1919  |  |  | 
1920  | 0  | std::string BLS_IsG2OnCurve::Name(void) const { return "BLS_IsG2OnCurve"; } | 
1921  | 0  | std::string BLS_IsG2OnCurve::ToString(void) const { | 
1922  | 0  |     std::stringstream ss;  | 
1923  |  | 
  | 
1924  | 0  |     ss << "operation name: BLS_IsG2OnCurve" << std::endl;  | 
1925  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1926  | 0  |     ss << "G2 V: " << g2.first.first.ToString() << std::endl;  | 
1927  | 0  |     ss << "G2 W: " << g2.first.second.ToString() << std::endl;  | 
1928  | 0  |     ss << "G2 X: " << g2.second.first.ToString() << std::endl;  | 
1929  | 0  |     ss << "G2 Y: " << g2.second.second.ToString() << std::endl;  | 
1930  |  | 
  | 
1931  | 0  |     return ss.str();  | 
1932  | 0  | }  | 
1933  |  |  | 
1934  | 0  | nlohmann::json BLS_IsG2OnCurve::ToJSON(void) const { | 
1935  | 0  |     nlohmann::json j;  | 
1936  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1937  |  | 
  | 
1938  | 0  |     j["g2_v"] = g2.first.first.ToJSON();  | 
1939  | 0  |     j["g2_w"] = g2.first.second.ToJSON();  | 
1940  | 0  |     j["g2_x"] = g2.second.first.ToJSON();  | 
1941  | 0  |     j["g2_y"] = g2.second.second.ToJSON();  | 
1942  |  | 
  | 
1943  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1944  | 0  |     return j;  | 
1945  | 0  | }  | 
1946  |  |  | 
1947  | 0  | std::string BLS_GenerateKeyPair::Name(void) const { return "BLS_GenerateKeyPair"; } | 
1948  | 0  | std::string BLS_GenerateKeyPair::ToString(void) const { | 
1949  | 0  |     std::stringstream ss;  | 
1950  |  | 
  | 
1951  | 0  |     ss << "operation name: BLS_GenerateKeyPair" << std::endl;  | 
1952  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1953  | 0  |     ss << "ikm: " << util::HexDump(ikm.Get()) << std::endl;  | 
1954  | 0  |     ss << "info: " << util::HexDump(info.Get()) << std::endl;  | 
1955  |  | 
  | 
1956  | 0  |     return ss.str();  | 
1957  | 0  | }  | 
1958  |  |  | 
1959  | 0  | nlohmann::json BLS_GenerateKeyPair::ToJSON(void) const { | 
1960  | 0  |     nlohmann::json j;  | 
1961  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1962  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1963  | 0  |     j["ikm"] = ikm.ToJSON();  | 
1964  | 0  |     j["info"] = info.ToJSON();  | 
1965  | 0  |     return j;  | 
1966  | 0  | }  | 
1967  |  |  | 
1968  | 0  | std::string BLS_Decompress_G1::Name(void) const { return "BLS_Decompress_G1"; } | 
1969  | 0  | std::string BLS_Decompress_G1::ToString(void) const { | 
1970  | 0  |     std::stringstream ss;  | 
1971  |  | 
  | 
1972  | 0  |     ss << "operation name: BLS_Decompress_G1" << std::endl;  | 
1973  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1974  | 0  |     ss << "compressed: " << compressed.ToString() << std::endl;  | 
1975  |  | 
  | 
1976  | 0  |     return ss.str();  | 
1977  | 0  | }  | 
1978  |  |  | 
1979  | 0  | nlohmann::json BLS_Decompress_G1::ToJSON(void) const { | 
1980  | 0  |     nlohmann::json j;  | 
1981  | 0  |     j["curveType"] = curveType.ToJSON();  | 
1982  | 0  |     j["compressed"] = compressed.ToJSON();  | 
1983  | 0  |     j["modifier"] = modifier.ToJSON();  | 
1984  | 0  |     return j;  | 
1985  | 0  | }  | 
1986  |  |  | 
1987  | 0  | std::string BLS_Compress_G1::Name(void) const { return "BLS_Compress_G1"; } | 
1988  | 0  | std::string BLS_Compress_G1::ToString(void) const { | 
1989  | 0  |     std::stringstream ss;  | 
1990  |  | 
  | 
1991  | 0  |     ss << "operation name: BLS_Compress_G1" << std::endl;  | 
1992  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
1993  | 0  |     ss << "uncompressed X:" << uncompressed.first.ToString() << std::endl;  | 
1994  | 0  |     ss << "uncompressed Y:" << uncompressed.second.ToString() << std::endl;  | 
1995  |  | 
  | 
1996  | 0  |     return ss.str();  | 
1997  | 0  | }  | 
1998  |  |  | 
1999  | 0  | nlohmann::json BLS_Compress_G1::ToJSON(void) const { | 
2000  | 0  |     nlohmann::json j;  | 
2001  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2002  | 0  |     j["g1_x"] = uncompressed.first.ToJSON();  | 
2003  | 0  |     j["g1_y"] = uncompressed.second.ToJSON();  | 
2004  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2005  | 0  |     return j;  | 
2006  | 0  | }  | 
2007  |  |  | 
2008  | 0  | std::string BLS_Decompress_G2::Name(void) const { return "BLS_Decompress_G2"; } | 
2009  | 0  | std::string BLS_Decompress_G2::ToString(void) const { | 
2010  | 0  |     std::stringstream ss;  | 
2011  |  | 
  | 
2012  | 0  |     ss << "operation name: BLS_Decompress_G2" << std::endl;  | 
2013  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2014  | 0  |     ss << "compressed X: " << compressed.first.ToString() << std::endl;  | 
2015  | 0  |     ss << "compressed Y: " << compressed.second.ToString() << std::endl;  | 
2016  |  | 
  | 
2017  | 0  |     return ss.str();  | 
2018  | 0  | }  | 
2019  |  |  | 
2020  | 0  | nlohmann::json BLS_Decompress_G2::ToJSON(void) const { | 
2021  | 0  |     nlohmann::json j;  | 
2022  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2023  | 0  |     j["g1_x"] = compressed.first.ToJSON();  | 
2024  | 0  |     j["g1_y"] = compressed.second.ToJSON();  | 
2025  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2026  | 0  |     return j;  | 
2027  | 0  | }  | 
2028  |  |  | 
2029  | 0  | std::string BLS_Compress_G2::Name(void) const { return "BLS_Compress_G2"; } | 
2030  | 0  | std::string BLS_Compress_G2::ToString(void) const { | 
2031  | 0  |     std::stringstream ss;  | 
2032  |  | 
  | 
2033  | 0  |     ss << "operation name: BLS_Compress_G2" << std::endl;  | 
2034  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2035  | 0  |     ss << "uncompressed V:" << uncompressed.first.first.ToString() << std::endl;  | 
2036  | 0  |     ss << "uncompressed W:" << uncompressed.first.second.ToString() << std::endl;  | 
2037  | 0  |     ss << "uncompressed X:" << uncompressed.second.first.ToString() << std::endl;  | 
2038  | 0  |     ss << "uncompressed Y:" << uncompressed.second.second.ToString() << std::endl;  | 
2039  |  | 
  | 
2040  | 0  |     return ss.str();  | 
2041  | 0  | }  | 
2042  |  |  | 
2043  | 0  | nlohmann::json BLS_Compress_G2::ToJSON(void) const { | 
2044  | 0  |     nlohmann::json j;  | 
2045  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2046  | 0  |     j["g2_v"] = uncompressed.first.first.ToJSON();  | 
2047  | 0  |     j["g2_w"] = uncompressed.first.second.ToJSON();  | 
2048  | 0  |     j["g2_x"] = uncompressed.second.first.ToJSON();  | 
2049  | 0  |     j["g2_y"] = uncompressed.second.second.ToJSON();  | 
2050  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2051  | 0  |     return j;  | 
2052  | 0  | }  | 
2053  |  |  | 
2054  | 0  | std::string BLS_G1_Add::Name(void) const { return "BLS_G1_Add"; } | 
2055  | 0  | std::string BLS_G1_Add::ToString(void) const { | 
2056  | 0  |     std::stringstream ss;  | 
2057  |  | 
  | 
2058  | 0  |     ss << "operation name: BLS_G1_Add" << std::endl;  | 
2059  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2060  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
2061  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
2062  | 0  |     ss << "B X: " << b.first.ToString() << std::endl;  | 
2063  | 0  |     ss << "B Y: " << b.second.ToString() << std::endl;  | 
2064  |  | 
  | 
2065  | 0  |     return ss.str();  | 
2066  | 0  | }  | 
2067  |  |  | 
2068  | 0  | nlohmann::json BLS_G1_Add::ToJSON(void) const { | 
2069  | 0  |     nlohmann::json j;  | 
2070  | 0  |     j["operation"] = "BLS_G1_Add";  | 
2071  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2072  |  | 
  | 
2073  | 0  |     j["a_x"] = a.first.ToJSON();  | 
2074  | 0  |     j["a_y"] = a.second.ToJSON();  | 
2075  |  | 
  | 
2076  | 0  |     j["b_x"] = b.first.ToJSON();  | 
2077  | 0  |     j["b_y"] = b.second.ToJSON();  | 
2078  |  | 
  | 
2079  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2080  | 0  |     return j;  | 
2081  | 0  | }  | 
2082  |  |  | 
2083  | 0  | std::string BLS_G1_Mul::Name(void) const { return "BLS_G1_Mul"; } | 
2084  | 0  | std::string BLS_G1_Mul::ToString(void) const { | 
2085  | 0  |     std::stringstream ss;  | 
2086  |  | 
  | 
2087  | 0  |     ss << "operation name: BLS_G1_Mul" << std::endl;  | 
2088  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2089  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
2090  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
2091  | 0  |     ss << "B: " << b.ToString() << std::endl;  | 
2092  |  | 
  | 
2093  | 0  |     return ss.str();  | 
2094  | 0  | }  | 
2095  |  |  | 
2096  | 0  | nlohmann::json BLS_G1_Mul::ToJSON(void) const { | 
2097  | 0  |     nlohmann::json j;  | 
2098  | 0  |     j["operation"] = "BLS_G1_Mul";  | 
2099  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2100  |  | 
  | 
2101  | 0  |     j["a_x"] = a.first.ToJSON();  | 
2102  | 0  |     j["a_y"] = a.second.ToJSON();  | 
2103  |  | 
  | 
2104  | 0  |     j["b"] = b.ToJSON();  | 
2105  |  | 
  | 
2106  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2107  | 0  |     return j;  | 
2108  | 0  | }  | 
2109  |  |  | 
2110  | 0  | std::string BLS_G1_IsEq::Name(void) const { return "BLS_G1_IsEq"; } | 
2111  | 0  | std::string BLS_G1_IsEq::ToString(void) const { | 
2112  | 0  |     std::stringstream ss;  | 
2113  |  | 
  | 
2114  | 0  |     ss << "operation name: BLS_G1_IsEq" << std::endl;  | 
2115  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2116  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
2117  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
2118  | 0  |     ss << "B X: " << b.first.ToString() << std::endl;  | 
2119  | 0  |     ss << "B Y: " << b.second.ToString() << std::endl;  | 
2120  |  | 
  | 
2121  | 0  |     return ss.str();  | 
2122  | 0  | }  | 
2123  |  |  | 
2124  | 0  | nlohmann::json BLS_G1_IsEq::ToJSON(void) const { | 
2125  | 0  |     nlohmann::json j;  | 
2126  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2127  |  | 
  | 
2128  | 0  |     j["a_x"] = a.first.ToJSON();  | 
2129  | 0  |     j["a_y"] = a.second.ToJSON();  | 
2130  |  | 
  | 
2131  | 0  |     j["b_x"] = b.first.ToJSON();  | 
2132  | 0  |     j["b_y"] = b.second.ToJSON();  | 
2133  |  | 
  | 
2134  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2135  | 0  |     return j;  | 
2136  | 0  | }  | 
2137  |  |  | 
2138  | 0  | std::string BLS_G1_Neg::Name(void) const { return "BLS_G1_Neg"; } | 
2139  | 0  | std::string BLS_G1_Neg::ToString(void) const { | 
2140  | 0  |     std::stringstream ss;  | 
2141  |  | 
  | 
2142  | 0  |     ss << "operation name: BLS_G1_Neg" << std::endl;  | 
2143  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2144  | 0  |     ss << "A X: " << a.first.ToString() << std::endl;  | 
2145  | 0  |     ss << "A Y: " << a.second.ToString() << std::endl;  | 
2146  |  | 
  | 
2147  | 0  |     return ss.str();  | 
2148  | 0  | }  | 
2149  |  |  | 
2150  | 0  | nlohmann::json BLS_G1_Neg::ToJSON(void) const { | 
2151  | 0  |     nlohmann::json j;  | 
2152  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2153  |  | 
  | 
2154  | 0  |     j["a_x"] = a.first.ToJSON();  | 
2155  | 0  |     j["a_y"] = a.second.ToJSON();  | 
2156  |  | 
  | 
2157  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2158  | 0  |     return j;  | 
2159  | 0  | }  | 
2160  |  |  | 
2161  | 0  | std::string BLS_G2_Add::Name(void) const { return "BLS_G2_Add"; } | 
2162  | 0  | std::string BLS_G2_Add::ToString(void) const { | 
2163  | 0  |     std::stringstream ss;  | 
2164  |  | 
  | 
2165  | 0  |     ss << "operation name: BLS_G2_Add" << std::endl;  | 
2166  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2167  | 0  |     ss << "A V:" << a.first.first.ToString() << std::endl;  | 
2168  | 0  |     ss << "A W:" << a.first.second.ToString() << std::endl;  | 
2169  | 0  |     ss << "A X:" << a.second.first.ToString() << std::endl;  | 
2170  | 0  |     ss << "A Y:" << a.second.second.ToString() << std::endl;  | 
2171  | 0  |     ss << "B V:" << b.first.first.ToString() << std::endl;  | 
2172  | 0  |     ss << "B W:" << b.first.second.ToString() << std::endl;  | 
2173  | 0  |     ss << "B X:" << b.second.first.ToString() << std::endl;  | 
2174  | 0  |     ss << "B Y:" << b.second.second.ToString() << std::endl;  | 
2175  |  | 
  | 
2176  | 0  |     return ss.str();  | 
2177  | 0  | }  | 
2178  |  |  | 
2179  | 0  | nlohmann::json BLS_G2_Add::ToJSON(void) const { | 
2180  | 0  |     nlohmann::json j;  | 
2181  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2182  |  | 
  | 
2183  | 0  |     j["a_v"] = a.first.first.ToJSON();  | 
2184  | 0  |     j["a_w"] = a.first.second.ToJSON();  | 
2185  | 0  |     j["a_x"] = a.second.first.ToJSON();  | 
2186  | 0  |     j["a_y"] = a.second.second.ToJSON();  | 
2187  |  | 
  | 
2188  | 0  |     j["b_v"] = b.first.first.ToJSON();  | 
2189  | 0  |     j["b_w"] = b.first.second.ToJSON();  | 
2190  | 0  |     j["b_x"] = b.second.first.ToJSON();  | 
2191  | 0  |     j["b_y"] = b.second.second.ToJSON();  | 
2192  |  | 
  | 
2193  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2194  | 0  |     return j;  | 
2195  | 0  | }  | 
2196  |  |  | 
2197  | 0  | std::string BLS_G2_Mul::Name(void) const { return "BLS_G2_Mul"; } | 
2198  | 0  | std::string BLS_G2_Mul::ToString(void) const { | 
2199  | 0  |     std::stringstream ss;  | 
2200  |  | 
  | 
2201  | 0  |     ss << "operation name: BLS_G2_Mul" << std::endl;  | 
2202  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2203  | 0  |     ss << "A V:" << a.first.first.ToString() << std::endl;  | 
2204  | 0  |     ss << "A W:" << a.first.second.ToString() << std::endl;  | 
2205  | 0  |     ss << "A X:" << a.second.first.ToString() << std::endl;  | 
2206  | 0  |     ss << "A Y:" << a.second.second.ToString() << std::endl;  | 
2207  | 0  |     ss << "B: " << b.ToString() << std::endl;  | 
2208  |  | 
  | 
2209  | 0  |     return ss.str();  | 
2210  | 0  | }  | 
2211  |  |  | 
2212  | 0  | nlohmann::json BLS_G2_Mul::ToJSON(void) const { | 
2213  | 0  |     nlohmann::json j;  | 
2214  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2215  |  | 
  | 
2216  | 0  |     j["a_v"] = a.first.first.ToJSON();  | 
2217  | 0  |     j["a_w"] = a.first.second.ToJSON();  | 
2218  | 0  |     j["a_x"] = a.second.first.ToJSON();  | 
2219  | 0  |     j["a_y"] = a.second.second.ToJSON();  | 
2220  |  | 
  | 
2221  | 0  |     j["b"] = b.ToJSON();  | 
2222  |  | 
  | 
2223  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2224  | 0  |     return j;  | 
2225  | 0  | }  | 
2226  |  |  | 
2227  | 0  | std::string BLS_G2_IsEq::Name(void) const { return "BLS_G2_IsEq"; } | 
2228  | 0  | std::string BLS_G2_IsEq::ToString(void) const { | 
2229  | 0  |     std::stringstream ss;  | 
2230  |  | 
  | 
2231  | 0  |     ss << "operation name: BLS_G2_IsEq" << std::endl;  | 
2232  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2233  | 0  |     ss << "A V:" << a.first.first.ToString() << std::endl;  | 
2234  | 0  |     ss << "A W:" << a.first.second.ToString() << std::endl;  | 
2235  | 0  |     ss << "A X:" << a.second.first.ToString() << std::endl;  | 
2236  | 0  |     ss << "A Y:" << a.second.second.ToString() << std::endl;  | 
2237  | 0  |     ss << "B V:" << b.first.first.ToString() << std::endl;  | 
2238  | 0  |     ss << "B W:" << b.first.second.ToString() << std::endl;  | 
2239  | 0  |     ss << "B X:" << b.second.first.ToString() << std::endl;  | 
2240  | 0  |     ss << "B Y:" << b.second.second.ToString() << std::endl;  | 
2241  |  | 
  | 
2242  | 0  |     return ss.str();  | 
2243  | 0  | }  | 
2244  |  |  | 
2245  | 0  | nlohmann::json BLS_G2_IsEq::ToJSON(void) const { | 
2246  | 0  |     nlohmann::json j;  | 
2247  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2248  |  | 
  | 
2249  | 0  |     j["a_v"] = a.first.first.ToJSON();  | 
2250  | 0  |     j["a_w"] = a.first.second.ToJSON();  | 
2251  | 0  |     j["a_x"] = a.second.first.ToJSON();  | 
2252  | 0  |     j["a_y"] = a.second.second.ToJSON();  | 
2253  |  | 
  | 
2254  | 0  |     j["b_v"] = b.first.first.ToJSON();  | 
2255  | 0  |     j["b_w"] = b.first.second.ToJSON();  | 
2256  | 0  |     j["b_x"] = b.second.first.ToJSON();  | 
2257  | 0  |     j["b_y"] = b.second.second.ToJSON();  | 
2258  |  | 
  | 
2259  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2260  | 0  |     return j;  | 
2261  | 0  | }  | 
2262  |  |  | 
2263  | 0  | std::string BLS_G2_Neg::Name(void) const { return "BLS_G2_Neg"; } | 
2264  | 0  | std::string BLS_G2_Neg::ToString(void) const { | 
2265  | 0  |     std::stringstream ss;  | 
2266  |  | 
  | 
2267  | 0  |     ss << "operation name: BLS_G2_Neg" << std::endl;  | 
2268  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2269  | 0  |     ss << "A V:" << a.first.first.ToString() << std::endl;  | 
2270  | 0  |     ss << "A W:" << a.first.second.ToString() << std::endl;  | 
2271  | 0  |     ss << "A X:" << a.second.first.ToString() << std::endl;  | 
2272  | 0  |     ss << "A Y:" << a.second.second.ToString() << std::endl;  | 
2273  |  | 
  | 
2274  | 0  |     return ss.str();  | 
2275  | 0  | }  | 
2276  |  |  | 
2277  | 0  | nlohmann::json BLS_G2_Neg::ToJSON(void) const { | 
2278  | 0  |     nlohmann::json j;  | 
2279  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2280  |  | 
  | 
2281  | 0  |     j["a_v"] = a.first.first.ToJSON();  | 
2282  | 0  |     j["a_w"] = a.first.second.ToJSON();  | 
2283  | 0  |     j["a_x"] = a.second.first.ToJSON();  | 
2284  | 0  |     j["a_y"] = a.second.second.ToJSON();  | 
2285  |  | 
  | 
2286  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2287  | 0  |     return j;  | 
2288  | 0  | }  | 
2289  |  |  | 
2290  | 0  | std::string BLS_G1_MultiExp::Name(void) const { return "BLS_G1_MultiExp"; } | 
2291  | 0  | std::string BLS_G1_MultiExp::ToString(void) const { | 
2292  | 0  |     std::stringstream ss;  | 
2293  |  | 
  | 
2294  | 0  |     ss << "operation name: BLS_G1_MultiExp" << std::endl;  | 
2295  | 0  |     ss << "ecc curve: " << repository::ECC_CurveToString(curveType.Get()) << std::endl;  | 
2296  |  | 
  | 
2297  | 0  |     for (const auto& point_scalar : points_scalars.points_scalars) { | 
2298  | 0  |         ss << "    X: " << point_scalar.first.first.ToString() << std::endl;  | 
2299  | 0  |         ss << "    Y: " << point_scalar.first.second.ToString() << std::endl;  | 
2300  | 0  |         ss << "    scalar: " << point_scalar.second.ToString() << std::endl;  | 
2301  | 0  |         ss << std::endl;  | 
2302  | 0  |     }  | 
2303  |  | 
  | 
2304  | 0  |     return ss.str();  | 
2305  | 0  | }  | 
2306  |  |  | 
2307  | 0  | nlohmann::json BLS_G1_MultiExp::ToJSON(void) const { | 
2308  | 0  |     nlohmann::json j;  | 
2309  | 0  |     j["curveType"] = curveType.ToJSON();  | 
2310  |  | 
  | 
2311  | 0  |     nlohmann::json points_scalars_json = nlohmann::json::array();  | 
2312  |  | 
  | 
2313  | 0  |     for (const auto& point_scalar : points_scalars.points_scalars) { | 
2314  | 0  |         nlohmann::json ps;  | 
2315  | 0  |         ps["x"] = point_scalar.first.first.ToJSON();  | 
2316  | 0  |         ps["y"] = point_scalar.first.second.ToJSON();  | 
2317  | 0  |         ps["scalar"] = point_scalar.second.ToJSON();  | 
2318  |  | 
  | 
2319  | 0  |         points_scalars_json.push_back(ps);  | 
2320  | 0  |     }  | 
2321  |  | 
  | 
2322  | 0  |     j["points_scalars"] = points_scalars_json;  | 
2323  |  | 
  | 
2324  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2325  | 0  |     return j;  | 
2326  | 0  | }  | 
2327  |  |  | 
2328  | 0  | std::string Misc::Name(void) const { return "Misc"; } | 
2329  | 0  | std::string Misc::ToString(void) const { | 
2330  | 0  |     std::stringstream ss;  | 
2331  |  | 
  | 
2332  | 0  |     ss << "operation name: Misc" << std::endl;  | 
2333  | 0  |     ss << "operation: " << std::to_string(operation.Get()) << std::endl;  | 
2334  |  | 
  | 
2335  | 0  |     return ss.str();  | 
2336  | 0  | }  | 
2337  |  |  | 
2338  | 0  | nlohmann::json Misc::ToJSON(void) const { | 
2339  | 0  |     nlohmann::json j;  | 
2340  | 0  |     j["operation"] = operation.ToJSON();  | 
2341  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2342  | 0  |     return j;  | 
2343  | 0  | }  | 
2344  |  |  | 
2345  | 0  | std::string SR25519_Verify::Name(void) const { return "ECDSA_Verify"; } | 
2346  | 0  | std::string SR25519_Verify::ToString(void) const { | 
2347  | 0  |     std::stringstream ss;  | 
2348  |  | 
  | 
2349  | 0  |     ss << "operation name: SR25519_Verify" << std::endl;  | 
2350  | 0  |     ss << "public key: " << signature.pub.ToString() << std::endl;  | 
2351  | 0  |     ss << "cleartext: " << util::HexDump(cleartext.Get()) << std::endl;  | 
2352  | 0  |     ss << "signature R: " << signature.signature.first.ToString() << std::endl;  | 
2353  | 0  |     ss << "signature S: " << signature.signature.second.ToString() << std::endl;  | 
2354  |  | 
  | 
2355  | 0  |     return ss.str();  | 
2356  | 0  | }  | 
2357  |  |  | 
2358  | 0  | nlohmann::json SR25519_Verify::ToJSON(void) const { | 
2359  | 0  |     nlohmann::json j;  | 
2360  | 0  |     j["operation"] = "SR25519_Verify";  | 
2361  | 0  |     j["pub"] = signature.pub.ToJSON();  | 
2362  | 0  |     j["cleartext"] = cleartext.ToJSON();  | 
2363  | 0  |     j["sig_r"] = signature.signature.first.ToJSON();  | 
2364  | 0  |     j["sig_s"] = signature.signature.second.ToJSON();  | 
2365  | 0  |     j["modifier"] = modifier.ToJSON();  | 
2366  | 0  |     return j;  | 
2367  | 0  | }  | 
2368  |  |  | 
2369  |  | } /* namespace operation */  | 
2370  |  | } /* namespace cryptofuzz */  |