Crypto++  5.6.5
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 
12 #include "files.h"
13 #include "filters.h"
14 #include "hex.h"
15 #include "rsa.h"
16 #include "nr.h"
17 #include "dsa.h"
18 #include "luc.h"
19 #include "rw.h"
20 #include "ecp.h"
21 #include "ec2n.h"
22 #include "asn.h"
23 #include "dh.h"
24 #include "mqv.h"
25 #include "hmqv.h"
26 #include "fhmqv.h"
27 #include "xtrcrypt.h"
28 #include "esign.h"
29 #include "pssr.h"
30 #include "oids.h"
31 #include "randpool.h"
32 
33 NAMESPACE_BEGIN(CryptoPP)
34 NAMESPACE_BEGIN(Test)
35 
36 void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
37 {
38  unsigned int len = 16;
39  SecByteBlock plaintext(len), ciphertext(key.CiphertextLength(len));
40  Test::GlobalRNG().GenerateBlock(plaintext, len);
41 
42  unsigned int i;
43  double timeTaken;
44 
45  const clock_t start = ::clock();
46  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
47  key.Encrypt(Test::GlobalRNG(), plaintext, len, ciphertext);
48 
49  OutputResultOperations(name, "Encryption", pc, i, timeTaken);
50 
51  if (!pc && key.GetMaterial().SupportsPrecomputation())
52  {
53  key.AccessMaterial().Precompute(16);
54  BenchMarkEncryption(name, key, timeTotal, true);
55  }
56 }
57 
58 void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub, double timeTotal)
59 {
60  unsigned int len = 16;
61  SecByteBlock ciphertext(pub.CiphertextLength(len));
62  SecByteBlock plaintext(pub.MaxPlaintextLength(ciphertext.size()));
63  Test::GlobalRNG().GenerateBlock(plaintext, len);
64  pub.Encrypt(Test::GlobalRNG(), plaintext, len, ciphertext);
65 
66  unsigned int i;
67  double timeTaken;
68 
69  const clock_t start = ::clock();
70  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
71  priv.Decrypt(Test::GlobalRNG(), ciphertext, ciphertext.size(), plaintext);
72 
73  OutputResultOperations(name, "Decryption", false, i, timeTaken);
74 }
75 
76 void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false)
77 {
78  unsigned int len = 16;
79  AlignedSecByteBlock message(len), signature(key.SignatureLength());
80  Test::GlobalRNG().GenerateBlock(message, len);
81 
82  unsigned int i;
83  double timeTaken;
84 
85  const clock_t start = ::clock();
86  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
87  (void)key.SignMessage(Test::GlobalRNG(), message, len, signature);
88 
89  OutputResultOperations(name, "Signature", pc, i, timeTaken);
90 
91  if (!pc && key.GetMaterial().SupportsPrecomputation())
92  {
93  key.AccessMaterial().Precompute(16);
94  BenchMarkSigning(name, key, timeTotal, true);
95  }
96 }
97 
98 void BenchMarkVerification(const char *name, const PK_Signer &priv, PK_Verifier &pub, double timeTotal, bool pc=false)
99 {
100  unsigned int len = 16;
101  AlignedSecByteBlock message(len), signature(pub.SignatureLength());
102  Test::GlobalRNG().GenerateBlock(message, len);
103  priv.SignMessage(Test::GlobalRNG(), message, len, signature);
104 
105  unsigned int i;
106  double timeTaken;
107 
108  const clock_t start = ::clock();
109  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
110  (void)pub.VerifyMessage(message, len, signature, signature.size());
111 
112  OutputResultOperations(name, "Verification", pc, i, timeTaken);
113 
114  if (!pc && pub.GetMaterial().SupportsPrecomputation())
115  {
116  pub.AccessMaterial().Precompute(16);
117  BenchMarkVerification(name, priv, pub, timeTotal, true);
118  }
119 }
120 
121 void BenchMarkKeyGen(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false)
122 {
123  SecByteBlock priv(d.PrivateKeyLength()), pub(d.PublicKeyLength());
124 
125  unsigned int i;
126  double timeTaken;
127 
128  const clock_t start = ::clock();
129  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
130  d.GenerateKeyPair(Test::GlobalRNG(), priv, pub);
131 
132  OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
133 
134  if (!pc && d.GetMaterial().SupportsPrecomputation())
135  {
136  d.AccessMaterial().Precompute(16);
137  BenchMarkKeyGen(name, d, timeTotal, true);
138  }
139 }
140 
141 void BenchMarkKeyGen(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false)
142 {
144 
145  unsigned int i;
146  double timeTaken;
147 
148  const clock_t start = ::clock();
149  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
150  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), priv, pub);
151 
152  OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken);
153 
154  if (!pc && d.GetMaterial().SupportsPrecomputation())
155  {
156  d.AccessMaterial().Precompute(16);
157  BenchMarkKeyGen(name, d, timeTotal, true);
158  }
159 }
160 
161 void BenchMarkAgreement(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false)
162 {
163  SecByteBlock priv1(d.PrivateKeyLength()), priv2(d.PrivateKeyLength());
164  SecByteBlock pub1(d.PublicKeyLength()), pub2(d.PublicKeyLength());
165  d.GenerateKeyPair(Test::GlobalRNG(), priv1, pub1);
166  d.GenerateKeyPair(Test::GlobalRNG(), priv2, pub2);
168 
169  unsigned int i;
170  double timeTaken;
171 
172  const clock_t start = ::clock();
173  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2)
174  {
175  d.Agree(val, priv1, pub2);
176  d.Agree(val, priv2, pub1);
177  }
178 
179  OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
180 }
181 
182 void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false)
183 {
188  d.GenerateStaticKeyPair(Test::GlobalRNG(), spriv1, spub1);
189  d.GenerateStaticKeyPair(Test::GlobalRNG(), spriv2, spub2);
190  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), epriv1, epub1);
191  d.GenerateEphemeralKeyPair(Test::GlobalRNG(), epriv2, epub2);
193 
194  unsigned int i;
195  double timeTaken;
196 
197  const clock_t start = ::clock();
198  for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(::clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2)
199  {
200  d.Agree(val, spriv1, epriv1, spub2, epub2);
201  d.Agree(val, spriv2, epriv2, spub1, epub1);
202  }
203 
204  OutputResultOperations(name, "Key Agreement", pc, i, timeTaken);
205 }
206 
207 template <class SCHEME>
208 void BenchMarkCrypto(const char *filename, const char *name, double timeTotal)
209 {
210  FileSource f(filename, true, new HexDecoder);
211  typename SCHEME::Decryptor priv(f);
212  typename SCHEME::Encryptor pub(priv);
213  BenchMarkEncryption(name, pub, timeTotal);
214  BenchMarkDecryption(name, priv, pub, timeTotal);
215 }
216 
217 template <class SCHEME>
218 void BenchMarkSignature(const char *filename, const char *name, double timeTotal)
219 {
220  FileSource f(filename, true, new HexDecoder);
221  typename SCHEME::Signer priv(f);
222  typename SCHEME::Verifier pub(priv);
223  BenchMarkSigning(name, priv, timeTotal);
224  BenchMarkVerification(name, priv, pub, timeTotal);
225 }
226 
227 template <class D>
228 void BenchMarkKeyAgreement(const char *filename, const char *name, double timeTotal)
229 {
230  FileSource f(filename, true, new HexDecoder);
231  D d(f);
232  BenchMarkKeyGen(name, d, timeTotal);
233  BenchMarkAgreement(name, d, timeTotal);
234 }
235 
236 void Benchmark3(double t, double hertz)
237 {
238  g_allocatedTime = t;
239  g_hertz = hertz;
240 
241  std::cout << "\n<TABLE>";
242  std::cout << "\n<COLGROUP><COL style=\"text-align: left;\"><COL style=";
243  std::cout << "\"text-align: right;\"><COL style=\"text-align: right;\">";
244  std::cout << "\n<THEAD style=\"background: #F0F0F0\"><TR><TH>Operation<TH>Milliseconds/Operation";
245  std::cout << (g_hertz > 1.0f ? "<TH>Megacycles/Operation" : "") << std::endl;
246 
247  std::cout << "\n<TBODY style=\"background: white;\">";
248  {
249  BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
250  BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
251  BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie1024.dat", "DLIES 1024", t);
252  BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc512.dat", "LUCELG 512", t);
253  }
254 
255  std::cout << "\n<TBODY style=\"background: yellow;\">";
256  {
257  BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
258  BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
259  BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie2048.dat", "DLIES 2048", t);
260  BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc1024.dat", "LUCELG 1024", t);
261  }
262 
263  std::cout << "\n<TBODY style=\"background: white;\">";
264  {
265  BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
266  BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw1024.dat", "RW 1024", t);
267  BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
268  BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr1024.dat", "NR 1024", t);
269  BenchMarkSignature<DSA>(CRYPTOPP_DATA_DIR "TestData/dsa1024.dat", "DSA 1024", t);
270  BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t);
271  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t);
272  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t);
273  }
274 
275  std::cout << "\n<TBODY style=\"background: yellow;\">";
276  {
277  BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
278  BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw2048.dat", "RW 2048", t);
279  BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
280  BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr2048.dat", "NR 2048", t);
281  BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t);
282  BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t);
283  }
284 
285  std::cout << "\n<TBODY style=\"background: white;\">";
286  {
287  BenchMarkKeyAgreement<XTR_DH>(CRYPTOPP_DATA_DIR "TestData/xtrdh171.dat", "XTR-DH 171", t);
288  BenchMarkKeyAgreement<XTR_DH>(CRYPTOPP_DATA_DIR "TestData/xtrdh342.dat", "XTR-DH 342", t);
289  BenchMarkKeyAgreement<DH>(CRYPTOPP_DATA_DIR "TestData/dh1024.dat", "DH 1024", t);
290  BenchMarkKeyAgreement<DH>(CRYPTOPP_DATA_DIR "TestData/dh2048.dat", "DH 2048", t);
291  BenchMarkKeyAgreement<LUC_DH>(CRYPTOPP_DATA_DIR "TestData/lucd512.dat", "LUCDIF 512", t);
292  BenchMarkKeyAgreement<LUC_DH>(CRYPTOPP_DATA_DIR "TestData/lucd1024.dat", "LUCDIF 1024", t);
293  BenchMarkKeyAgreement<MQV>(CRYPTOPP_DATA_DIR "TestData/mqv1024.dat", "MQV 1024", t);
294  BenchMarkKeyAgreement<MQV>(CRYPTOPP_DATA_DIR "TestData/mqv2048.dat", "MQV 2048", t);
295 
296 #if 0
297  BenchMarkKeyAgreement<ECHMQV160>(CRYPTOPP_DATA_DIR "TestData/hmqv160.dat", "HMQV P-160", t);
298  BenchMarkKeyAgreement<ECHMQV256>(CRYPTOPP_DATA_DIR "TestData/hmqv256.dat", "HMQV P-256", t);
299  BenchMarkKeyAgreement<ECHMQV384>(CRYPTOPP_DATA_DIR "TestData/hmqv384.dat", "HMQV P-384", t);
300  BenchMarkKeyAgreement<ECHMQV512>(CRYPTOPP_DATA_DIR "TestData/hmqv512.dat", "HMQV P-512", t);
301 
302  BenchMarkKeyAgreement<ECFHMQV160>(CRYPTOPP_DATA_DIR "TestData/fhmqv160.dat", "FHMQV P-160", t);
303  BenchMarkKeyAgreement<ECFHMQV256>(CRYPTOPP_DATA_DIR "TestData/fhmqv256.dat", "FHMQV P-256", t);
304  BenchMarkKeyAgreement<ECFHMQV384>(CRYPTOPP_DATA_DIR "TestData/fhmqv384.dat", "FHMQV P-384", t);
305  BenchMarkKeyAgreement<ECFHMQV512>(CRYPTOPP_DATA_DIR "TestData/fhmqv512.dat", "FHMQV P-512", t);
306 #endif
307  }
308 
309  std::cout << "\n<TBODY style=\"background: yellow;\">";
310  {
311  ECIES<ECP>::Decryptor cpriv(Test::GlobalRNG(), ASN1::secp256k1());
312  ECIES<ECP>::Encryptor cpub(cpriv);
313  ECDSA<ECP, SHA1>::Signer spriv(cpriv);
314  ECDSA<ECP, SHA1>::Verifier spub(spriv);
315  ECDSA_RFC6979<ECP, SHA1>::Signer spriv2(cpriv);
317  ECGDSA<ECP, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::secp256k1());
318  ECGDSA<ECP, SHA1>::Verifier spub3(spriv3);
319  ECDH<ECP>::Domain ecdhc(ASN1::secp256k1());
320  ECMQV<ECP>::Domain ecmqvc(ASN1::secp256k1());
321 
322  BenchMarkEncryption("ECIES over GF(p) 256", cpub, t);
323  BenchMarkDecryption("ECIES over GF(p) 256", cpriv, cpub, t);
324  BenchMarkSigning("ECDSA over GF(p) 256", spriv, t);
325  BenchMarkVerification("ECDSA over GF(p) 256", spriv, spub, t);
326  BenchMarkSigning("ECDSA-RFC6979 over GF(p) 256", spriv2, t);
327  BenchMarkVerification("ECDSA-RFC6979 over GF(p) 256", spriv2, spub2, t);
328  BenchMarkSigning("ECGDSA over GF(p) 256", spriv3, t);
329  BenchMarkVerification("ECGDSA over GF(p) 256", spriv3, spub3, t);
330  BenchMarkKeyGen("ECDHC over GF(p) 256", ecdhc, t);
331  BenchMarkAgreement("ECDHC over GF(p) 256", ecdhc, t);
332  BenchMarkKeyGen("ECMQVC over GF(p) 256", ecmqvc, t);
333  BenchMarkAgreement("ECMQVC over GF(p) 256", ecmqvc, t);
334  }
335 
336  std::cout << "\n<TBODY style=\"background: white;\">";
337  {
338  ECIES<EC2N>::Decryptor cpriv(Test::GlobalRNG(), ASN1::sect233r1());
339  ECIES<EC2N>::Encryptor cpub(cpriv);
340  ECDSA<EC2N, SHA1>::Signer spriv(cpriv);
341  ECDSA<EC2N, SHA1>::Verifier spub(spriv);
342  ECDSA_RFC6979<EC2N, SHA1>::Signer spriv2(cpriv);
344  ECGDSA<EC2N, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::sect233r1());
345  ECGDSA<EC2N, SHA1>::Verifier spub3(spriv3);
346  ECDH<EC2N>::Domain ecdhc(ASN1::sect233r1());
347  ECMQV<EC2N>::Domain ecmqvc(ASN1::sect233r1());
348 
349  BenchMarkEncryption("ECIES over GF(2^n) 233", cpub, t);
350  BenchMarkDecryption("ECIES over GF(2^n) 233", cpriv, cpub, t);
351  BenchMarkSigning("ECDSA over GF(2^n) 233", spriv, t);
352  BenchMarkVerification("ECDSA over GF(2^n) 233", spriv, spub, t);
353  BenchMarkSigning("ECDSA-RFC6979 over GF(2^n) 233", spriv2, t);
354  BenchMarkVerification("ECDSA-RFC6979 over GF(2^n) 233", spriv2, spub2, t);
355  BenchMarkSigning("ECGDSA over GF(2^n) 233", spriv3, t);
356  BenchMarkVerification("ECGDSA over GF(2^n) 233", spriv3, spub3, t);
357  BenchMarkKeyGen("ECDHC over GF(2^n) 233", ecdhc, t);
358  BenchMarkAgreement("ECDHC over GF(2^n) 233", ecdhc, t);
359  BenchMarkKeyGen("ECMQVC over GF(2^n) 233", ecmqvc, t);
360  BenchMarkAgreement("ECMQVC over GF(2^n) 233", ecmqvc, t);
361  }
362 
363  std::cout << "\n</TABLE>" << std::endl;
364 }
365 
366 NAMESPACE_END // Test
367 NAMESPACE_END // CryptoPP
virtual void Precompute(unsigned int precomputationStorage)
Perform precomputation.
Definition: cryptlib.h:2104
virtual bool Agree(byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const =0
Derive agreed value.
virtual void GenerateKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
Generate a private/public key pair.
Definition: cryptlib.cpp:902
Classes for Fully Hashed Menezes-Qu-Vanstone key agreement in GF(p)
virtual unsigned int StaticPublicKeyLength() const =0
Provides the size of the static public key.
Class file for Randomness Pool.
virtual unsigned int AgreedValueLength() const =0
Provides the size of the agreed value.
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:856
Implementation of Store interface.
Definition: files.h:84
Classes for Elliptic Curves over prime fields.
const CryptoMaterial & GetMaterial() const
Retrieves a reference to Crypto Parameters.
Definition: cryptlib.h:2259
Interface for public-key signers.
Definition: cryptlib.h:2495
virtual void GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
Generate a static private/public key pair.
Definition: cryptlib.cpp:908
Interface for public-key encryptors.
Definition: cryptlib.h:2310
Decode base 16 data back to bytes.
Definition: hex.h:36
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:2235
ASN.1 object identifiers for algorthms and schemes.
virtual unsigned int PrivateKeyLength() const =0
Provides the size of the private key.
virtual void GenerateEphemeralKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
Generate private/public key pair.
Definition: cryptlib.cpp:914
virtual size_t SignatureLength() const =0
Provides the signature length if it only depends on the key.
SecBlock<byte> typedef.
Definition: secblock.h:810
virtual unsigned int StaticPrivateKeyLength() const =0
Provides the size of the static private key.
virtual unsigned int PublicKeyLength() const =0
Provides the size of the public key.
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.
virtual unsigned int EphemeralPrivateKeyLength() const =0
Provides the size of ephemeral private key.
Interface for domains of simple key agreement protocols.
Definition: cryptlib.h:2632
const CryptoMaterial & GetMaterial() const
Retrieves a reference to a Private Key.
Definition: cryptlib.h:2238
Classes for Rabin-Williams signature scheme.
Interface for public-key decryptors.
Definition: cryptlib.h:2346
MQV domain for performing authenticated key agreement.
Definition: mqv.h:27
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:878
virtual unsigned int EphemeralPublicKeyLength() const =0
Provides the size of ephemeral public key.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
SecBlock using AllocatorWithCleanup<byte, true> typedef.
Definition: secblock.h:816
Classes for the DSA signature algorithm.
virtual bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const =0
Derive agreed value.
Diffie-Hellman domain.
Definition: dh.h:25
Classes and functions for working with ANS.1 objects.
Implementation of BufferedTransformation&#39;s attachment interface.
"The XTR public key system" by Arjen K.
Classes for the RSA cryptosystem.
CryptoMaterial & AccessMaterial()
Retrieves a reference to a Public Key.
Definition: cryptlib.h:2211
Interface for public-key signature verifiers.
Definition: cryptlib.h:2560
virtual size_t CiphertextLength(size_t plaintextLength) const =0
Calculate the length of ciphertext given length of plaintext.
virtual unsigned int AgreedValueLength() const =0
Provides the size of the agreed value.
CryptoMaterial & AccessMaterial()
Retrieves a reference to Crypto Parameters.
Definition: cryptlib.h:2256
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:2690
virtual bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
Definition: cryptlib.h:2094
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:2215
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:1989