AuthorityCertificateManager.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2002-2009 Moxie Marlinspike
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 3 of the
  7. * License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. */
  19. #ifndef __AUTHORITY_CERTIFICATE_MANAGER_H__
  20. #define __AUTHORITY_CERTIFICATE_MANAGER_H__
  21. #include <string>
  22. #include <openssl/pem.h>
  23. #include <openssl/conf.h>
  24. #include <openssl/x509v3.h>
  25. #include <openssl/ssl.h>
  26. #include <openssl/err.h>
  27. #include <openssl/rand.h>
  28. #include <boost/asio.hpp>
  29. #include "Certificate.hpp"
  30. #include "CertificateManager.hpp"
  31. class AuthorityCertificateManager : public CertificateManager {
  32. private:
  33. Certificate *authority;
  34. std::list<Certificate*> chainList;
  35. EVP_PKEY *leafPair;
  36. EVP_PKEY* buildKeysForClient();
  37. unsigned int generateRandomSerial();
  38. public:
  39. AuthorityCertificateManager(std::string &file, std::string &chain);
  40. virtual bool isOCSPAddress(boost::asio::ip::tcp::endpoint &endpoint);
  41. virtual void getCertificateForTarget(boost::asio::ip::tcp::endpoint &endpoint,
  42. bool wildcardOK,
  43. X509 *serverCertificate,
  44. Certificate **cert, std::list<Certificate*> **chain);
  45. virtual bool isValidTarget(boost::asio::ip::tcp::endpoint &endpoint, bool wildcardOK);
  46. };
  47. #endif