Crypto++  7.0
Free C++ class library of cryptographic schemes
bench2.cpp
1 // bench2.cpp - originally written and placed in the public domain by Wei Dai
2 // CryptoPP::Test namespace added by JW in February 2017
3 
4 #include "cryptlib.h"
5 #include "bench.h"
6 #include "validate.h"
7 
8 #include "pubkey.h"
9 #include "gfpcrypt.h"
10 #include "eccrypto.h"
11 #include "pkcspad.h"
12 
13 #include "files.h"
14 #include "filters.h"
15 #include "hex.h"
16 #include "rsa.h"
17 #include "nr.h"
18 #include "dsa.h"
19 #include "luc.h"
20 #include "rw.h"
21 #include "ecp.h"
22 #include "ec2n.h"
23 #include "asn.h"
24 #include "dh.h"
25 #include "mqv.h"
26 #include "hmqv.h"
27 #include "fhmqv.h"
28 #include "xtrcrypt.h"
29 #include "esign.h"
30 #include "pssr.h"
31 #include "oids.h"
32 #include "randpool.h"
33 #include "stdcpp.h"
34 #include "hrtimer.h"
35 
36 #if CRYPTOPP_MSC_VERSION
37 # pragma warning(disable: 4505 4355)
38 #endif
39 
40 NAMESPACE_BEGIN(CryptoPP)
41 NAMESPACE_BEGIN(Test)
42 
43 void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
44 {
45  unsigned int len = 16;
46  SecByteBlock plaintext(len), ciphertext(key.CiphertextLength(len));
47  Test::GlobalRNG().GenerateBlock(plaintext, len);
48 
49  unsigned int i = 0;
50  double timeTaken;
51 
52  ThreadUserTimer timer;
53  timer.StartTimer();
54 
55  do
56  {
57  key.Encrypt(Test::GlobalRNG(), plaintext, len, ciphertext);
58  ++i; timeTaken = timer.ElapsedTimeAsDouble();
59  }
60  while (timeTaken < timeTotal);
61 
62  OutputResultOperations(name, "Encryption", pc, i, timeTaken);
63 
64  if (!pc && key.GetMaterial().SupportsPrecomputation())
65  {
66  key.AccessMaterial().Precompute(16);
67  BenchMarkEncryption(name, key, timeTotal, true);
68  }
69 }
70 
71 void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub, double timeTotal)
72 {
73  unsigned int len = 16;
74  SecByteBlock ciphertext(pub.CiphertextLength(len));
75  SecByteBlock plaintext(pub.MaxPlaintextLength(ciphertext.size()));
76  Test::GlobalRNG().GenerateBlock(plaintext, len);
77  pub.Encrypt(Test::GlobalRNG(), plaintext, len, ciphertext);
78 
79  unsigned int i = 0;
80  double timeTaken;
81 
82  ThreadUserTimer timer;
83  timer.StartTimer();
84 
85  do
86  {
87  priv.Decrypt(Test::GlobalRNG(), ciphertext, ciphertext.size(), plaintext);
88  ++i; timeTaken = timer.ElapsedTimeAsDouble();
89  }
90  while (timeTaken < timeTotal);
91 
92  OutputResultOperations(name, "Decryption", false, i, timeTaken);
93 }
94 
95 void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false)
96 {
97  unsigned int len = 16;
98  AlignedSecByteBlock message(len), signature(key.SignatureLength());
99  Test::GlobalRNG().GenerateBlock(message, len);
100 
101  unsigned int i = 0;
102  double timeTaken;
103 
104  ThreadUserTimer timer;
105  timer.StartTimer();
106 
107  do
108  {
109  (void)key.SignMessage(Test::GlobalRNG(), message, len, signature);
110  ++i; timeTaken = timer.ElapsedTimeAsDouble();
111  }
112  while (timeTaken < timeTotal);
113 
114  OutputResultOperations(name, "Signature", pc, i, timeTaken);
115 
116  if (!pc && key.GetMaterial().SupportsPrecomputation())
117  {
118  key.AccessMaterial().Precompute(16);
119  BenchMarkSigning(name, key, timeTotal, true);
120  }
121 }
122 
123 void BenchMarkVerification(const char *name, const PK_Signer &priv, PK_Verifier &pub, double timeTotal, bool pc=false)
124 {
125  unsigned int len = 16;
126  AlignedSecByteBlock message(len), signature(pub.SignatureLength());
127  Test::GlobalRNG().GenerateBlock(message, len);
128  priv.SignMessage(Test::GlobalRNG(), message, len, signature);
129 
130  unsigned int i = 0;
131  double timeTaken;
132 
133  ThreadUserTimer timer;
134  timer.StartTimer();
135 
136  do
137  {
138  (void)pub.VerifyMessage(message, len, signature, signature.size());
139  ++i; timeTaken = timer.ElapsedTimeAsDouble();
140  }
141  while (timeTaken < timeTotal);
142 
143  OutputResultOperations(name, "Verification", pc, i, timeTaken);
144 
145  if (!pc && pub.GetMaterial().SupportsPrecomputation())
146  {
147  pub.AccessMaterial().Precompute(16);
148  BenchMarkVerification(name, priv, pub, timeTotal, true);
149  }
150 }
151 
152 void BenchMarkKeyGen(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false)
153 {
154  SecByteBlock priv(d.PrivateKeyLength()), pub(d.PublicKeyLength());
155 
156  unsigned int i = 0;
157  double timeTaken;
158 
159  ThreadUserTimer timer;
160  timer.StartTimer();
161 
162  do
163  {
164  d.GenerateKeyPair(Test::GlobalRNG(), priv, pub);
165  ++i; timeTaken = timer.ElapsedTimeAsDouble();
166  }
167  while (timeTaken < timeTotal);
168 
169  OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
170 
171  if (!pc && d.GetMaterial().SupportsPrecomputation())
172  {
173  d.AccessMaterial().Precompute(16);
174  BenchMarkKeyGen(name, d, timeTotal, true);
175  }
176 }
177 
178 void BenchMarkKeyGen(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false)
179 {
180  SecByteBlock priv(d.EphemeralPrivateKeyLength()), pub(d.EphemeralPublicKeyLength());
181 
182  unsigned int i = 0;
183  double timeTaken;
184 
185  ThreadUserTimer timer;
186  timer.StartTimer();
187 
188  do
189  {
190  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), priv, pub);
191  ++i; timeTaken = timer.ElapsedTimeAsDouble();
192  }
193  while (timeTaken < timeTotal);
194 
195  OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
196 
197  if (!pc && d.GetMaterial().SupportsPrecomputation())
198  {
199  d.AccessMaterial().Precompute(16);
200  BenchMarkKeyGen(name, d, timeTotal, true);
201  }
202 }
203 
204 void BenchMarkAgreement(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false)
205 {
206  SecByteBlock priv1(d.PrivateKeyLength()), priv2(d.PrivateKeyLength());
207  SecByteBlock pub1(d.PublicKeyLength()), pub2(d.PublicKeyLength());
208  d.GenerateKeyPair(Test::GlobalRNG(), priv1, pub1);
209  d.GenerateKeyPair(Test::GlobalRNG(), priv2, pub2);
210  SecByteBlock val(d.AgreedValueLength());
211 
212  unsigned int i = 0;
213  double timeTaken;
214 
215  ThreadUserTimer timer;
216  timer.StartTimer();
217 
218  do
219  {
220  d.Agree(val, priv1, pub2);
221  d.Agree(val, priv2, pub1);
222  i+=2; timeTaken = timer.ElapsedTimeAsDouble();
223  }
224  while (timeTaken < timeTotal);
225 
226  OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
227 }
228 
229 void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false)
230 {
231  SecByteBlock spriv1(d.StaticPrivateKeyLength()), spriv2(d.StaticPrivateKeyLength());
232  SecByteBlock epriv1(d.EphemeralPrivateKeyLength()), epriv2(d.EphemeralPrivateKeyLength());
233  SecByteBlock spub1(d.StaticPublicKeyLength()), spub2(d.StaticPublicKeyLength());
234  SecByteBlock epub1(d.EphemeralPublicKeyLength()), epub2(d.EphemeralPublicKeyLength());
235  d.GenerateStaticKeyPair(Test::GlobalRNG(), spriv1, spub1);
236  d.GenerateStaticKeyPair(Test::GlobalRNG(), spriv2, spub2);
237  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), epriv1, epub1);
238  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), epriv2, epub2);
239  SecByteBlock val(d.AgreedValueLength());
240 
241  unsigned int i = 0;
242  double timeTaken;
243 
244  ThreadUserTimer timer;
245  timer.StartTimer();
246 
247  do
248  {
249  d.Agree(val, spriv1, epriv1, spub2, epub2);
250  d.Agree(val, spriv2, epriv2, spub1, epub1);
251  i+=2; timeTaken = timer.ElapsedTimeAsDouble();
252  }
253  while (timeTaken < timeTotal);
254 
255  OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
256 }
257 
258 template <class SCHEME>
259 void BenchMarkCrypto(const char *filename, const char *name, double timeTotal)
260 {
261  FileSource f(filename, true, new HexDecoder);
262  typename SCHEME::Decryptor priv(f);
263  typename SCHEME::Encryptor pub(priv);
264  BenchMarkEncryption(name, pub, timeTotal);
265  BenchMarkDecryption(name, priv, pub, timeTotal);
266 }
267 
268 template <class SCHEME>
269 void BenchMarkSignature(const char *filename, const char *name, double timeTotal)
270 {
271  FileSource f(filename, true, new HexDecoder);
272  typename SCHEME::Signer priv(f);
273  typename SCHEME::Verifier pub(priv);
274  BenchMarkSigning(name, priv, timeTotal);
275  BenchMarkVerification(name, priv, pub, timeTotal);
276 }
277 
278 template <class D>
279 void BenchMarkKeyAgreement(const char *filename, const char *name, double timeTotal)
280 {
281  FileSource f(filename, true, new HexDecoder);
282  D d(f);
283  BenchMarkKeyGen(name, d, timeTotal);
284  BenchMarkAgreement(name, d, timeTotal);
285 }
286 
287 void Benchmark3(double t, double hertz)
288 {
289  g_allocatedTime = t;
290  g_hertz = hertz;
291 
292  const char *mco;
293  if (g_hertz > 1.0f)
294  mco = "<TH>Megacycles/Operation";
295  else
296  mco = "";
297 
298  std::cout << "\n<TABLE>";
299  std::cout << "\n<COLGROUP><COL style=\"text-align: left;\"><COL style=";
300  std::cout << "\"text-align: right;\"><COL style=\"text-align: right;\">";
301  std::cout << "\n<THEAD style=\"background: #F0F0F0\">";
302  std::cout << "\n<TR><TH>Operation<TH>Milliseconds/Operation" << mco;
303 
304  std::cout << "\n<TBODY style=\"background: white;\">";
305  {
306  BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
307  BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
308  BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie1024.dat", "DLIES 1024", t);
309  BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc512.dat", "LUCELG 512", t);
310  }
311 
312  std::cout << "\n<TBODY style=\"background: yellow;\">";
313  {
314  BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
315  BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
316  BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie2048.dat", "DLIES 2048", t);
317  BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc1024.dat", "LUCELG 1024", t);
318  }
319 
320  std::cout << "\n<TBODY style=\"background: white;\">";
321  {
322  BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
323  BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw1024.dat", "RW 1024", t);
324  BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
325  BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr1024.dat", "NR 1024", t);
326  BenchMarkSignature<DSA>(CRYPTOPP_DATA_DIR "TestData/dsa1024.dat", "DSA 1024", t);
327  BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t);
328  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t);
329  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t);
330  }
331 
332  std::cout << "\n<TBODY style=\"background: yellow;\">";
333  {
334  BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
335  BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw2048.dat", "RW 2048", t);
336  BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
337  BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr2048.dat", "NR 2048", t);
338  BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t);
339  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t);
340  }
341 
342  std::cout << "\n<TBODY style=\"background: white;\">";
343  {
344  BenchMarkKeyAgreement<XTR_DH>(CRYPTOPP_DATA_DIR "TestData/xtrdh171.dat", "XTR-DH 171", t);
345  BenchMarkKeyAgreement<XTR_DH>(CRYPTOPP_DATA_DIR "TestData/xtrdh342.dat", "XTR-DH 342", t);
346  BenchMarkKeyAgreement<DH>(CRYPTOPP_DATA_DIR "TestData/dh1024.dat", "DH 1024", t);
347  BenchMarkKeyAgreement<DH>(CRYPTOPP_DATA_DIR "TestData/dh2048.dat", "DH 2048", t);
348  BenchMarkKeyAgreement<LUC_DH>(CRYPTOPP_DATA_DIR "TestData/lucd512.dat", "LUCDIF 512", t);
349  BenchMarkKeyAgreement<LUC_DH>(CRYPTOPP_DATA_DIR "TestData/lucd1024.dat", "LUCDIF 1024", t);
350  BenchMarkKeyAgreement<MQV>(CRYPTOPP_DATA_DIR "TestData/mqv1024.dat", "MQV 1024", t);
351  BenchMarkKeyAgreement<MQV>(CRYPTOPP_DATA_DIR "TestData/mqv2048.dat", "MQV 2048", t);
352 
353 #if 0
354  BenchMarkKeyAgreement<ECHMQV160>(CRYPTOPP_DATA_DIR "TestData/hmqv160.dat", "HMQV P-160", t);
355  BenchMarkKeyAgreement<ECHMQV256>(CRYPTOPP_DATA_DIR "TestData/hmqv256.dat", "HMQV P-256", t);
356  BenchMarkKeyAgreement<ECHMQV384>(CRYPTOPP_DATA_DIR "TestData/hmqv384.dat", "HMQV P-384", t);
357  BenchMarkKeyAgreement<ECHMQV512>(CRYPTOPP_DATA_DIR "TestData/hmqv512.dat", "HMQV P-512", t);
358 
359  BenchMarkKeyAgreement<ECFHMQV160>(CRYPTOPP_DATA_DIR "TestData/fhmqv160.dat", "FHMQV P-160", t);
360  BenchMarkKeyAgreement<ECFHMQV256>(CRYPTOPP_DATA_DIR "TestData/fhmqv256.dat", "FHMQV P-256", t);
361  BenchMarkKeyAgreement<ECFHMQV384>(CRYPTOPP_DATA_DIR "TestData/fhmqv384.dat", "FHMQV P-384", t);
362  BenchMarkKeyAgreement<ECFHMQV512>(CRYPTOPP_DATA_DIR "TestData/fhmqv512.dat", "FHMQV P-512", t);
363 #endif
364  }
365 
366  std::cout << "\n<TBODY style=\"background: yellow;\">";
367  {
368  ECIES<ECP>::Decryptor cpriv(Test::GlobalRNG(), ASN1::secp256k1());
369  ECIES<ECP>::Encryptor cpub(cpriv);
370  ECDSA<ECP, SHA1>::Signer spriv(cpriv);
371  ECDSA<ECP, SHA1>::Verifier spub(spriv);
372  ECDSA_RFC6979<ECP, SHA1>::Signer spriv2(cpriv);
374  ECGDSA<ECP, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::secp256k1());
375  ECGDSA<ECP, SHA1>::Verifier spub3(spriv3);
376  ECDH<ECP>::Domain ecdhc(ASN1::secp256k1());
377  ECMQV<ECP>::Domain ecmqvc(ASN1::secp256k1());
378 
379  BenchMarkEncryption("ECIES over GF(p) 256", cpub, t);
380  BenchMarkDecryption("ECIES over GF(p) 256", cpriv, cpub, t);
381  BenchMarkSigning("ECDSA over GF(p) 256", spriv, t);
382  BenchMarkVerification("ECDSA over GF(p) 256", spriv, spub, t);
383  BenchMarkSigning("ECDSA-RFC6979 over GF(p) 256", spriv2, t);
384  BenchMarkVerification("ECDSA-RFC6979 over GF(p) 256", spriv2, spub2, t);
385  BenchMarkSigning("ECGDSA over GF(p) 256", spriv3, t);
386  BenchMarkVerification("ECGDSA over GF(p) 256", spriv3, spub3, t);
387  BenchMarkKeyGen("ECDHC over GF(p) 256", ecdhc, t);
388  BenchMarkAgreement("ECDHC over GF(p) 256", ecdhc, t);
389  BenchMarkKeyGen("ECMQVC over GF(p) 256", ecmqvc, t);
390  BenchMarkAgreement("ECMQVC over GF(p) 256", ecmqvc, t);
391  }
392 
393  std::cout << "\n<TBODY style=\"background: white;\">";
394  {
395  ECIES<EC2N>::Decryptor cpriv(Test::GlobalRNG(), ASN1::sect233r1());
396  ECIES<EC2N>::Encryptor cpub(cpriv);
397  ECDSA<EC2N, SHA1>::Signer spriv(cpriv);
398  ECDSA<EC2N, SHA1>::Verifier spub(spriv);
399  ECDSA_RFC6979<EC2N, SHA1>::Signer spriv2(cpriv);
401  ECGDSA<EC2N, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::sect233r1());
402  ECGDSA<EC2N, SHA1>::Verifier spub3(spriv3);
403  ECDH<EC2N>::Domain ecdhc(ASN1::sect233r1());
404  ECMQV<EC2N>::Domain ecmqvc(ASN1::sect233r1());
405 
406  BenchMarkEncryption("ECIES over GF(2^n) 233", cpub, t);
407  BenchMarkDecryption("ECIES over GF(2^n) 233", cpriv, cpub, t);
408  BenchMarkSigning("ECDSA over GF(2^n) 233", spriv, t);
409  BenchMarkVerification("ECDSA over GF(2^n) 233", spriv, spub, t);
410  BenchMarkSigning("ECDSA-RFC6979 over GF(2^n) 233", spriv2, t);
411  BenchMarkVerification("ECDSA-RFC6979 over GF(2^n) 233", spriv2, spub2, t);
412  BenchMarkSigning("ECGDSA over GF(2^n) 233", spriv3, t);
413  BenchMarkVerification("ECGDSA over GF(2^n) 233", spriv3, spub3, t);
414  BenchMarkKeyGen("ECDHC over GF(2^n) 233", ecdhc, t);
415  BenchMarkAgreement("ECDHC over GF(2^n) 233", ecdhc, t);
416  BenchMarkKeyGen("ECMQVC over GF(2^n) 233", ecmqvc, t);
417  BenchMarkAgreement("ECMQVC over GF(2^n) 233", ecmqvc, t);
418  }
419 
420  std::cout << "\n</TABLE>" << std::endl;
421 }
422 
423 NAMESPACE_END // Test
424 NAMESPACE_END // CryptoPP
virtual void Precompute(unsigned int precomputationStorage)
Perform precomputation.
Definition: cryptlib.h:2313
Classes for Fully Hashed Menezes-Qu-Vanstone key agreement in GF(p)
Class file for Randomness Pool.
This file contains helper classes/functions for implementing public key algorithms.
virtual size_t SignMessage(RandomNumberGenerator &rng, const byte *message, size_t messageLen, byte *signature) const
Sign a message.
Definition: cryptlib.cpp:921
Implementation of Store interface.
Definition: files.h:82
Classes for Elliptic Curves over prime fields.
Interface for public-key signers.
Definition: cryptlib.h:2705
Interface for public-key encryptors.
Definition: cryptlib.h:2526
Decode base 16 data back to bytes.
Definition: hex.h:34
Abstract base classes that provide a uniform interface to this library.
virtual void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters=g_nullNameValuePairs) const =0
Encrypt a byte string.
virtual size_t MaxPlaintextLength(size_t ciphertextLength) const =0
Provides the maximum length of plaintext for a given ciphertext length.
CryptoMaterial & AccessMaterial()
Retrieves a reference to a Private Key.
Definition: cryptlib.h:2452
ASN.1 object identifiers for algorthms and schemes.
Common C++ header files.
virtual size_t SignatureLength() const =0
Provides the signature length if it only depends on the key.
SecBlock<byte> typedef.
Definition: secblock.h:822
Classes providing ESIGN signature schemes as defined in IEEE P1363a.
Classes for Hashed Menezes-Qu-Vanstone key agreement in GF(p)
Classes for the LUC cryptosystem.
Classes for Elliptic Curves over binary fields.
Interface for domains of simple key agreement protocols.
Definition: cryptlib.h:2841
const CryptoMaterial & GetMaterial() const
Retrieves a reference to a Private Key.
Definition: cryptlib.h:2455
Classes for PKCS padding schemes.
Classes for Rabin-Williams signature scheme.
Interface for public-key decryptors.
Definition: cryptlib.h:2561
MQV domain for performing authenticated key agreement.
Definition: mqv.h:28
Classes for Diffie-Hellman key exchange.
Classes for HexEncoder and HexDecoder.
virtual bool VerifyMessage(const byte *message, size_t messageLen, const byte *signature, size_t signatureLen) const
Check whether input signature is a valid signature for input message.
Definition: cryptlib.cpp:943
Namespace containing testing and benchmark classes.
Definition: cryptlib.h:550
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
SecBlock using AllocatorWithCleanup<byte, true> typedef.
Definition: secblock.h:826
Classes for the DSA signature algorithm.
Diffie-Hellman domain.
Definition: dh.h:25
Classes and functions for working with ANS.1 objects.
Implementation of BufferedTransformation's attachment interface.
XTR public key system.
Classes for the RSA cryptosystem.
CryptoMaterial & AccessMaterial()
Retrieves a reference to a Public Key.
Definition: cryptlib.h:2428
Interface for public-key signature verifiers.
Definition: cryptlib.h:2769
virtual size_t CiphertextLength(size_t plaintextLength) const =0
Calculate the length of ciphertext given length of plaintext.
Classes providing file-based library services.
Classes and functions for Elliptic Curves over prime and binary fields.
Crypto++ library namespace.
Interface for domains of authenticated key agreement protocols.
Definition: cryptlib.h:2900
Measure CPU time spent executing instructions of this thread (if supported by OS)
Definition: hrtimer.h:46
virtual bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
Definition: cryptlib.h:2303
Classes for Menezes–Qu–Vanstone (MQV) key agreement.
Classes for probablistic signature schemes.
const CryptoMaterial & GetMaterial() const
Retrieves a reference to a Public Key.
Definition: cryptlib.h:2432
virtual DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters=g_nullNameValuePairs) const =0
Decrypt a byte string.
Template implementing constructors for public key algorithm classes.
Definition: pubkey.h:2141