3 #define CRYPTOPP_DEFAULT_NO_DLL 4 #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 35 #ifdef CRYPTOPP_WIN32_AVAILABLE 36 #define WIN32_LEAN_AND_MEAN 40 #if defined(USE_BERKELEY_STYLE_SOCKETS) && !defined(macintosh) 41 #include <netinet/in.h> 42 #include <netinet/tcp.h> 45 #if (_MSC_VER >= 1000) 49 #if defined(__MWERKS__) && defined(macintosh) 58 #pragma comment(lib, "cryptlib_bds.lib") 59 #pragma comment(lib, "ws2_32.lib") 63 #if (CRYPTOPP_MSC_VERSION >= 1410) 64 # pragma strict_gs_check (on) 68 #if CRYPTOPP_MSC_VERSION 69 # pragma warning(disable: 4996) 72 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 73 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 79 const
int MAX_PHRASE_LENGTH=250;
81 void RegisterFactories();
82 void PrintSeedAndThreads(const
std::
string& seed);
84 void GenerateRSAKey(
unsigned int keyLength, const
char *privFilename, const
char *pubFilename, const
char *seed);
85 string RSAEncryptString(const
char *pubFilename, const
char *seed, const
char *message);
86 string RSADecryptString(const
char *privFilename, const
char *ciphertext);
87 void RSASignFile(const
char *privFilename, const
char *messageFilename, const
char *signatureFilename);
88 bool RSAVerifyFile(const
char *pubFilename, const
char *messageFilename, const
char *signatureFilename);
90 void DigestFile(const
char *file);
91 void HmacFile(const
char *hexKey, const
char *file);
93 void AES_CTR_Encrypt(const
char *hexKey, const
char *hexIV, const
char *infile, const
char *outfile);
95 string EncryptString(const
char *plaintext, const
char *passPhrase);
96 string DecryptString(const
char *ciphertext, const
char *passPhrase);
98 void EncryptFile(const
char *in, const
char *out, const
char *passPhrase);
99 void DecryptFile(const
char *in, const
char *out, const
char *passPhrase);
101 void SecretShareFile(
int threshold,
int nShares, const
char *filename, const
char *seed);
102 void SecretRecoverFile(
int threshold, const
char *outFilename,
char *const *inFilenames);
104 void InformationDisperseFile(
int threshold,
int nShares, const
char *filename);
105 void InformationRecoverFile(
int threshold, const
char *outFilename,
char *const *inFilenames);
107 void GzipFile(const
char *in, const
char *out,
int deflate_level);
108 void GunzipFile(const
char *in, const
char *out);
110 void Base64Encode(const
char *infile, const
char *outfile);
111 void Base64Decode(const
char *infile, const
char *outfile);
112 void HexEncode(const
char *infile, const
char *outfile);
113 void HexDecode(const
char *infile, const
char *outfile);
115 void ForwardTcpPort(const
char *sourcePort, const
char *destinationHost, const
char *destinationPort);
117 void FIPS140_SampleApplication();
118 void FIPS140_GenerateRandomFiles();
120 bool Validate(
int,
bool, const
char *);
121 void PrintSeedAndThreads(const
std::
string& seed);
123 int (*AdhocTest)(
int argc,
char *argv[]) = NULL;
131 int CRYPTOPP_API main(
int argc,
char *argv[])
133 #ifdef _CRTDBG_LEAK_CHECK_DF 135 int tempflag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
136 tempflag |= _CRTDBG_LEAK_CHECK_DF;
137 _CrtSetDbgFlag( tempflag );
140 #if defined(__MWERKS__) && defined(macintosh) 141 argc = ccommand(&argv);
150 seed.resize(16,
' ');
153 prng.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
155 std::string command, executableName, macFilename;
164 char thisSeed[1024], privFilename[128], pubFilename[128];
165 unsigned int keyLength;
167 cout <<
"Key length in bits: ";
170 cout <<
"\nSave private key to file: ";
173 cout <<
"\nSave public key to file: ";
176 cout <<
"\nRandom Seed: ";
178 cin.getline(thisSeed, 1024);
180 GenerateRSAKey(keyLength, privFilename, pubFilename, thisSeed);
182 else if (command ==
"rs")
183 RSASignFile(argv[2], argv[3], argv[4]);
184 else if (command ==
"rv")
186 bool verified = RSAVerifyFile(argv[2], argv[3], argv[4]);
187 cout << (verified ?
"valid signature" :
"invalid signature") << endl;
189 else if (command ==
"r")
191 char privFilename[128], pubFilename[128];
192 char thisSeed[1024], message[1024];
194 cout <<
"Private key file: ";
197 cout <<
"\nPublic key file: ";
200 cout <<
"\nRandom Seed: ";
202 cin.getline(thisSeed, 1024);
204 cout <<
"\nMessage: ";
205 cin.getline(message, 1024);
207 string ciphertext = RSAEncryptString(pubFilename, thisSeed, message);
208 cout <<
"\nCiphertext: " << ciphertext << endl;
210 string decrypted = RSADecryptString(privFilename, ciphertext.c_str());
211 cout <<
"\nDecrypted: " << decrypted << endl;
213 else if (command ==
"mt")
217 fs.TransferAllTo(mt);
218 cout <<
"Maurer Test Value: " << mt.GetTestValue() << endl;
220 else if (command ==
"mac_dll")
222 std::string fname(argv[2] ? argv[2] :
"");
225 std::fstream dllFile(fname.c_str(), ios::in | ios::out | ios::binary);
228 cerr <<
"Failed to open file \"" << fname <<
"\"\n";
232 std::ifstream::pos_type fileEnd = dllFile.seekg(0, std::ios_base::end).tellg();
233 if (fileEnd > 20*1000*1000)
235 cerr <<
"Input file " << fname <<
" is too large";
236 cerr <<
"(size is " << fileEnd <<
").\n";
241 unsigned int fileSize = (
unsigned int)fileEnd;
243 dllFile.seekg(0, std::ios_base::beg);
244 dllFile.read((
char *)buf.begin(), fileSize);
247 word32 coffPos = *(word16 *)(
void *)(buf+0x3c);
248 word32 optionalHeaderPos = coffPos + 24;
249 word16 optionalHeaderMagic = *(word16 *)(
void *)(buf+optionalHeaderPos);
250 if (optionalHeaderMagic != 0x10b && optionalHeaderMagic != 0x20b)
252 cerr <<
"Target file is not a PE32 or PE32+ image.\n";
255 word32 checksumPos = optionalHeaderPos + 64;
256 word32 certificateTableDirectoryPos = optionalHeaderPos + (optionalHeaderMagic == 0x10b ? 128 : 144);
257 word32 certificateTablePos = *(word32 *)(
void *)(buf+certificateTableDirectoryPos);
258 word32 certificateTableSize = *(word32 *)(
void *)(buf+certificateTableDirectoryPos+4);
259 if (certificateTableSize != 0)
260 cerr <<
"Warning: certificate table (IMAGE_DIRECTORY_ENTRY_SECURITY) of target image is not empty.\n";
264 byte *found = std::search(buf.begin(), buf.end(), mac+0, mac+
sizeof(mac));
265 if (found == buf.end())
267 cerr <<
"MAC placeholder not found. The MAC may already be placed.\n";
270 word32 macPos = (
unsigned int)(found-buf.begin());
274 assert(pMac->DigestSize() ==
sizeof(mac));
276 f.AddRangeToSkip(0, checksumPos, 4);
277 f.AddRangeToSkip(0, certificateTableDirectoryPos, 8);
278 f.AddRangeToSkip(0, macPos,
sizeof(mac));
279 f.AddRangeToSkip(0, certificateTablePos, certificateTableSize);
280 f.PutMessageEnd(buf.begin(), buf.size());
283 cout <<
"Placing MAC in file " << fname <<
", location " << macPos;
284 cout <<
" (0x" << std::hex << macPos << std::dec <<
").\n";
285 dllFile.seekg(macPos, std::ios_base::beg);
286 dllFile.write((
char *)mac,
sizeof(mac));
288 else if (command ==
"m")
290 else if (command ==
"tv")
293 std::string fname = (argv[2] ? argv[2] :
"all");
294 if (fname.find(
".txt") == std::string::npos)
295 fname =
"TestVectors/" + fname +
".txt";
297 PrintSeedAndThreads(seed);
298 return !RunTestDataFile(fname.c_str());
300 else if (command ==
"t")
303 char passPhrase[MAX_PHRASE_LENGTH], plaintext[1024];
305 cout <<
"Passphrase: ";
306 cin.getline(passPhrase, MAX_PHRASE_LENGTH);
308 cout <<
"\nPlaintext: ";
309 cin.getline(plaintext, 1024);
311 string ciphertext = EncryptString(plaintext, passPhrase);
312 cout <<
"\nCiphertext: " << ciphertext << endl;
314 string decrypted = DecryptString(ciphertext.c_str(), passPhrase);
315 cout <<
"\nDecrypted: " << decrypted << endl;
319 else if (command ==
"e64")
320 Base64Encode(argv[2], argv[3]);
321 else if (command ==
"d64")
322 Base64Decode(argv[2], argv[3]);
323 else if (command ==
"e16")
324 HexEncode(argv[2], argv[3]);
325 else if (command ==
"d16")
326 HexDecode(argv[2], argv[3]);
327 else if (command ==
"e" || command ==
"d")
329 char passPhrase[MAX_PHRASE_LENGTH];
330 cout <<
"Passphrase: ";
331 cin.getline(passPhrase, MAX_PHRASE_LENGTH);
333 EncryptFile(argv[2], argv[3], passPhrase);
335 DecryptFile(argv[2], argv[3], passPhrase);
337 else if (command ==
"ss")
340 cout <<
"\nRandom Seed: ";
342 cin.getline(thisSeed, 1024);
343 SecretShareFile(StringToValue<int, true>(argv[2]), StringToValue<int, true>(argv[3]), argv[4], thisSeed);
345 else if (command ==
"sr")
346 SecretRecoverFile(argc-3, argv[2], argv+3);
347 else if (command ==
"id")
348 InformationDisperseFile(StringToValue<int, true>(argv[2]), StringToValue<int, true>(argv[3]), argv[4]);
349 else if (command ==
"ir")
350 InformationRecoverFile(argc-3, argv[2], argv+3);
351 else if (command ==
"v" || command ==
"vv")
352 return !Validate(argc>2 ? StringToValue<int, true>(argv[2]) : 0, argv[1][1] ==
'v', argc>3 ? argv[3] : NULL);
353 else if (command ==
"b")
354 BenchmarkAll(argc<3 ? 1 : StringToValue<float, true>(argv[2]), argc<4 ? 0 : StringToValue<float, true>(argv[3])*1e9);
355 else if (command ==
"b2")
356 BenchmarkAll2(argc<3 ? 1 : StringToValue<float, true>(argv[2]), argc<4 ? 0 : StringToValue<float, true>(argv[3])*1e9);
357 else if (command ==
"z")
358 GzipFile(argv[3], argv[4], argv[2][0]-
'0');
359 else if (command ==
"u")
360 GunzipFile(argv[2], argv[3]);
361 else if (command ==
"fips")
362 FIPS140_SampleApplication();
363 else if (command ==
"fips-rand")
364 FIPS140_GenerateRandomFiles();
365 else if (command ==
"ft")
366 ForwardTcpPort(argv[2], argv[3], argv[4]);
367 else if (command ==
"a")
370 return (*AdhocTest)(argc, argv);
373 cerr <<
"AdhocTest not defined.\n";
377 else if (command ==
"hmac")
378 HmacFile(argv[2], argv[3]);
379 else if (command ==
"ae")
380 AES_CTR_Encrypt(argv[2], argv[3], argv[4], argv[5]);
381 else if (command ==
"h")
386 else if (command ==
"V")
388 cout << CRYPTOPP_VERSION / 100 <<
'.' << (CRYPTOPP_VERSION % 100) / 10 <<
'.' << CRYPTOPP_VERSION % 10 << endl;
392 cerr <<
"Unrecognized command. Run \"cryptest h\" to obtain usage information.\n";
397 catch(
const CryptoPP::Exception &e)
399 cout <<
"\nCryptoPP::Exception caught: " << e.what() << endl;
402 catch(
const std::exception &e)
404 cout <<
"\nstd::exception caught: " << e.what() << endl;
409 void FIPS140_GenerateRandomFiles()
411 #ifdef OS_RNG_AVAILABLE 415 for (
unsigned int i=0; i<100000; i++)
418 cout <<
"OS provided RNG not available.\n";
423 template <
class T,
bool NON_NEGATIVE>
424 T StringToValue(
const std::string& str) {
425 std::istringstream iss(str);
442 int StringToValue<int, true>(
const std::string& str)
449 throw InvalidArgument(
"cryptest.exe: '" + str +
"' is not an integer value");
454 void PrintSeedAndThreads(
const std::string& seed)
456 cout <<
"Using seed: " << seed << endl;
462 tc = omp_get_num_threads();
465 std::cout <<
"Using " << tc <<
" OMP " << (tc == 1 ?
"thread" :
"threads") << std::endl;
473 ss.Get(result, result.size());
477 void GenerateRSAKey(
unsigned int keyLength,
const char *privFilename,
const char *pubFilename,
const char *seed)
484 priv.DEREncode(privFile);
485 privFile.MessageEnd();
489 pub.DEREncode(pubFile);
490 pubFile.MessageEnd();
493 string RSAEncryptString(
const char *pubFilename,
const char *seed,
const char *message)
506 string RSADecryptString(
const char *privFilename,
const char *ciphertext)
516 void RSASignFile(
const char *privFilename,
const char *messageFilename,
const char *signatureFilename)
523 bool RSAVerifyFile(
const char *pubFilename,
const char *messageFilename,
const char *signatureFilename)
529 if (signatureFile.MaxRetrievable() != pub.SignatureLength())
532 signatureFile.Get(signature, signature.size());
535 verifierFilter->
Put(signature, pub.SignatureLength());
536 FileSource f(messageFilename,
true, verifierFilter);
541 void DigestFile(
const char *filename)
559 for (i=0; i<filters.size(); i++)
560 channelSwitch->AddDefaultRoute(*filters[i]);
561 FileSource(filename,
true, channelSwitch.release());
564 for (i=0; i<filters.size(); i++)
566 cout << filters[i]->AlgorithmName() <<
": ";
567 filters[i]->TransferTo(encoder);
572 void HmacFile(
const char *hexKey,
const char *file)
575 if (strcmp(hexKey,
"selftest") == 0)
577 cerr <<
"Computing HMAC/SHA1 value for self test.\n";
582 std::string decodedKey;
584 mac.reset(
new HMAC<SHA1>((
const byte *)decodedKey.data(), decodedKey.size()));
589 void AES_CTR_Encrypt(
const char *hexKey,
const char *hexIV,
const char *infile,
const char *outfile)
597 string EncryptString(
const char *instr,
const char *passPhrase)
602 encryptor.Put((byte *)instr, strlen(instr));
603 encryptor.MessageEnd();
608 string DecryptString(
const char *instr,
const char *passPhrase)
613 decryptor.Put((byte *)instr, strlen(instr));
614 decryptor.MessageEnd();
619 void EncryptFile(
const char *in,
const char *out,
const char *passPhrase)
624 void DecryptFile(
const char *in,
const char *out,
const char *passPhrase)
629 void SecretShareFile(
int threshold,
int nShares,
const char *filename,
const char *seed)
631 assert(nShares >= 1 && nShares<=1000);
632 if (nShares < 1 || nShares > 1000)
643 for (
int i=0; i<nShares; i++)
645 char extension[5] =
".000";
646 extension[1]=
'0'+byte(i/100);
647 extension[2]=
'0'+byte((i/10)%10);
648 extension[3]=
'0'+byte(i%10);
649 fileSinks[i].reset(
new FileSink((
string(filename)+extension).c_str()));
651 channel = WordToString<word32>(i);
652 fileSinks[i]->Put((
const byte *)channel.data(), 4);
659 void SecretRecoverFile(
int threshold,
const char *outFilename,
char *
const *inFilenames)
661 assert(threshold >= 1 && threshold <=1000);
662 if (threshold < 1 || threshold > 1000)
670 for (i=0; i<threshold; i++)
672 fileSources[i].reset(
new FileSource(inFilenames[i],
false));
673 fileSources[i]->Pump(4);
674 fileSources[i]->Get(channel, 4);
675 fileSources[i]->Attach(
new ChannelSwitch(recovery,
string((
char *)channel.begin(), 4)));
678 while (fileSources[0]->Pump(256))
679 for (i=1; i<threshold; i++)
680 fileSources[i]->Pump(256);
682 for (i=0; i<threshold; i++)
683 fileSources[i]->PumpAll();
686 void InformationDisperseFile(
int threshold,
int nShares,
const char *filename)
688 assert(threshold >= 1 && threshold <=1000);
689 if (threshold < 1 || threshold > 1000)
697 for (
int i=0; i<nShares; i++)
699 char extension[5] =
".000";
700 extension[1]=
'0'+byte(i/100);
701 extension[2]=
'0'+byte((i/10)%10);
702 extension[3]=
'0'+byte(i%10);
703 fileSinks[i].reset(
new FileSink((
string(filename)+extension).c_str()));
705 channel = WordToString<word32>(i);
706 fileSinks[i]->Put((
const byte *)channel.data(), 4);
713 void InformationRecoverFile(
int threshold,
const char *outFilename,
char *
const *inFilenames)
715 assert(threshold<=1000);
716 if (threshold < 1 || threshold > 1000)
724 for (i=0; i<threshold; i++)
726 fileSources[i].reset(
new FileSource(inFilenames[i],
false));
727 fileSources[i]->Pump(4);
728 fileSources[i]->Get(channel, 4);
729 fileSources[i]->Attach(
new ChannelSwitch(recovery,
string((
char *)channel.begin(), 4)));
732 while (fileSources[0]->Pump(256))
733 for (i=1; i<threshold; i++)
734 fileSources[i]->Pump(256);
736 for (i=0; i<threshold; i++)
737 fileSources[i]->PumpAll();
740 void GzipFile(
const char *in,
const char *out,
int deflate_level)
756 gunzip.SetAutoSignalPropagation(0);
762 cs->AddDefaultRoute(gunzip);
765 cs->AddDefaultRoute(comparison,
"1");
772 void GunzipFile(
const char *in,
const char *out)
777 void Base64Encode(
const char *in,
const char *out)
782 void Base64Decode(
const char *in,
const char *out)
787 void HexEncode(
const char *in,
const char *out)
792 void HexDecode(
const char *in,
const char *out)
797 void ForwardTcpPort(
const char *sourcePortName,
const char *destinationHost,
const char *destinationPortName)
800 CRYPTOPP_UNUSED(sourcePortName), CRYPTOPP_UNUSED(destinationHost), CRYPTOPP_UNUSED(destinationPortName);
802 #ifdef SOCKETS_AVAILABLE 805 Socket sockListen, sockSource, sockDestination;
811 sockListen.Bind(sourcePort);
813 int err = setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY,
"\x01", 1);
818 cout <<
"Listing on port " << sourcePort <<
".\n";
821 sockListen.Accept(sockSource);
822 cout <<
"Connection accepted on port " << sourcePort <<
".\n";
823 sockListen.CloseSocket();
825 cout <<
"Making connection to " << destinationHost <<
", port " << destinationPort <<
".\n";
826 sockDestination.Create();
827 sockDestination.Connect(destinationHost, destinationPort);
829 cout <<
"Connection made to " << destinationHost <<
", starting to forward.\n";
836 while (!(in.SourceExhausted() && out.SourceExhausted()))
840 out.GetWaitObjects(waitObjects,
CallStack(
"ForwardTcpPort - out", NULL));
841 in.GetWaitObjects(waitObjects,
CallStack(
"ForwardTcpPort - in", NULL));
845 if (!out.SourceExhausted())
847 cout <<
"o" << flush;
849 if (out.SourceExhausted())
850 cout <<
"EOF received on source socket.\n";
853 if (!in.SourceExhausted())
855 cout <<
"i" << flush;
857 if (in.SourceExhausted())
858 cout <<
"EOF received on destination socket.\n";
862 cout <<
"Socket support was not enabled at compile time.\n";
867 bool Validate(
int alg,
bool thorough,
const char *seedInput)
873 std::string seed = (seedInput ? seedInput :
IntToString(time(NULL)));
874 seed.resize(16,
' ');
877 prng.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data());
879 PrintSeedAndThreads(seed);
883 case 0: result = ValidateAll(thorough);
break;
884 case 1: result = TestSettings();
break;
885 case 2: result = TestOS_RNG();
break;
886 case 3: result = ValidateMD5();
break;
887 case 4: result = ValidateSHA();
break;
888 case 5: result = ValidateDES();
break;
889 case 6: result = ValidateIDEA();
break;
890 case 7: result = ValidateARC4();
break;
891 case 8: result = ValidateRC5();
break;
892 case 9: result = ValidateBlowfish();
break;
894 case 11: result = ValidateThreeWay();
break;
895 case 12: result = ValidateBBS();
break;
896 case 13: result = ValidateDH();
break;
897 case 14: result = ValidateRSA();
break;
898 case 15: result = ValidateElGamal();
break;
899 case 16: result = ValidateDSA(thorough);
break;
901 case 18: result = ValidateSAFER();
break;
902 case 19: result = ValidateLUC();
break;
903 case 20: result = ValidateRabin();
break;
905 case 22: result = ValidateECP();
break;
906 case 23: result = ValidateEC2N();
break;
908 case 25: result = ValidateGOST();
break;
909 case 26: result = ValidateTiger();
break;
910 case 27: result = ValidateRIPEMD();
break;
911 case 28: result = ValidateHMAC();
break;
913 case 30: result = ValidateSHARK();
break;
914 case 32: result = ValidateLUC_DH();
break;
915 case 33: result = ValidateLUC_DL();
break;
916 case 34: result = ValidateSEAL();
break;
917 case 35: result = ValidateCAST();
break;
918 case 36: result = ValidateSquare();
break;
919 case 37: result = ValidateRC2();
break;
920 case 38: result = ValidateRC6();
break;
921 case 39: result = ValidateMARS();
break;
922 case 40: result = ValidateRW();
break;
923 case 41: result = ValidateMD2();
break;
924 case 42: result = ValidateNR();
break;
925 case 43: result = ValidateMQV();
break;
926 case 44: result = ValidateRijndael();
break;
927 case 45: result = ValidateTwofish();
break;
928 case 46: result = ValidateSerpent();
break;
929 case 47: result = ValidateCipherModes();
break;
930 case 48: result = ValidateCRC32();
break;
931 case 49: result = ValidateECDSA();
break;
932 case 50: result = ValidateXTR_DH();
break;
933 case 51: result = ValidateSKIPJACK();
break;
934 case 52: result = ValidateSHA2();
break;
935 case 53: result = ValidatePanama();
break;
936 case 54: result = ValidateAdler32();
break;
937 case 55: result = ValidateMD4();
break;
938 case 56: result = ValidatePBKDF();
break;
939 case 57: result = ValidateESIGN();
break;
940 case 58: result = ValidateDLIES();
break;
941 case 59: result = ValidateBaseCode();
break;
942 case 60: result = ValidateSHACAL2();
break;
943 case 61: result = ValidateCamellia();
break;
944 case 62: result = ValidateWhirlpool();
break;
945 case 63: result = ValidateTTMAC();
break;
946 case 64: result = ValidateSalsa();
break;
947 case 65: result = ValidateSosemanuk();
break;
948 case 66: result = ValidateVMAC();
break;
949 case 67: result = ValidateCCM();
break;
950 case 68: result = ValidateGCM();
break;
951 case 69: result = ValidateCMAC();
break;
952 case 70: result = ValidateHKDF();
break;
953 case 71: result = ValidateBLAKE2s();
break;
954 case 72: result = ValidateBLAKE2b();
break;
955 default:
return false;
959 #if (CRYPTOPP_MSC_VERSION >= 1400) 964 const time_t endTime = time(NULL);
965 err = localtime_s(&localTime, &endTime);
967 err = asctime_s(timeBuf,
sizeof(timeBuf), &localTime);
970 cout <<
"\nTest ended at " << timeBuf;
972 const time_t endTime = time(NULL);
973 cout <<
"\nTest ended at " << asctime(localtime(&endTime));
976 cout <<
"Seed used was: " << seed << endl;
void IncorporateEntropy(const byte *input, size_t length)
Update RNG state with additional unpredictable values.
static unsigned int PortNameToNumber(const char *name, const char *protocol="tcp")
look up the port number given its name, returns 0 if not found
bool GetLastResult() const
Retrieves the result of the last verification.
An invalid argument was detected.
container of wait objects
Filter wrapper for PK_Verifier.
bool SafeConvert(T1 from, T2 &to)
Tests whether a conversion from -> to is safe to perform.
socket-based implementation of NetworkSource
implements the SHA-256 standard
Classes for RIPEMD message digest.
Class file for Randomness Pool.
file-based implementation of Source interface
Converts given data to base 16.
GZIP Decompression (RFC 1952)
Decode base 16 data back to bytes.
Abstract base classes that provide a uniform interface to this library.
signed long ConvertToLong() const
Convert the Integer to Long.
Classes for automatic resource management.
Filter wrapper for PK_Signer.
Classes for DefaultEncryptor, DefaultDecryptor, DefaultEncryptorWithMAC and DefaultDecryptorWithMAC.
Interface for random number generators.
Route input to different and/or multiple channels based on channel ID.
Pointer that overloads operator ->
exception thrown by Socket class
Copy input to a memory buffer.
GZIP compression and decompression (RFC 1952)
socket-based implementation of NetworkSink
Filter wrapper for HashTransformation.
RNG-based implementation of Source interface.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
RSAES<OAEP<SHA>>::Decryptor typedef
Block cipher mode of operation aggregate.
bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true)
Marks the end of a series of messages on a channel.
Maurer's Universal Statistical Test for Random Bit Generators.
implements the SHA-512 standard
Class file for the AES cipher (Rijndael)
Manages resources for an array of objects.
RSAES<OAEP<SHA>>::Encryptor typedef
Multiple precision integer with arithmetic operations.
Filter wrapper for PK_Decryptor.
MessageAuthenticationCode * NewIntegrityCheckingMAC()
Class object that calculates the MAC on the module.
Password-Based encryptor using TripleDES and HMAC/SHA-1.
Miscellaneous classes for RNGs.
wrapper for Windows or Berkeley Sockets
const unsigned long INFINITE_TIME
Represents infinite time.
Implementation of BufferedTransformation's attachment interface.
file-based implementation of Store interface
Filter wrapper for PK_Encryptor.
Classes for the Base64Encoder, Base64Decoder, Base64URLEncoder and Base64URLDecoder.
#define CRYPTOPP_DUMMY_DLL_MAC
The placeholder used prior to embedding the actual MAC in the module.
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
Measure how many bytes and messages pass through the filter.
Password-Based decryptor using TripleDES and HMAC/SHA-1.
A filter that checks messages on two channels for equality.
Crypto++ library namespace.
GZIP Compression (RFC 1952)
a variant of Shamir's Secret Sharing Algorithm
file-based implementation of Sink interface
Functions and definitions required for building the FIPS-140 DLL on Windows.
static int GetLastError()
returns errno or WSAGetLastError
a variant of Shamir's Secret Sharing Algorithm
size_type size() const
Provides the count of elements in the SecBlock.
Classes for Information Dispersal Algorithm (IDA)
Template implementing constructors for public key algorithm classes.
A typedef providing a default generator.