Reseed.h 889 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef RESEED_H
  2. #define RESEED_H
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. #include <map>
  7. #include "Identity.h"
  8. #include "Crypto.h"
  9. namespace i2p
  10. {
  11. namespace data
  12. {
  13. class Reseeder
  14. {
  15. typedef Tag<512> PublicKey;
  16. public:
  17. Reseeder();
  18. ~Reseeder();
  19. void Bootstrap ();
  20. int ReseedFromServers ();
  21. int ReseedFromSU3Url (const std::string& url);
  22. int ProcessSU3File (const char * filename);
  23. int ProcessZIPFile (const char * filename);
  24. void LoadCertificates ();
  25. private:
  26. void LoadCertificate (const std::string& filename);
  27. int ProcessSU3Stream (std::istream& s);
  28. int ProcessZIPStream (std::istream& s, uint64_t contentLength);
  29. bool FindZipDataDescriptor (std::istream& s);
  30. std::string HttpsRequest (const std::string& address);
  31. private:
  32. std::map<std::string, PublicKey> m_SigningKeys;
  33. };
  34. }
  35. }
  36. #endif