credentials_manager.hpp 1.11 KB
Newer Older
1 2 3
#ifndef BIBOUMI_CREDENTIALS_MANAGER_HPP
#define BIBOUMI_CREDENTIALS_MANAGER_HPP

4 5 6 7
#include "louloulibs.h"

#ifdef BOTAN_FOUND

8 9 10
#include <botan/botan.h>
#include <botan/tls_client.h>

11 12
class TCPSocketHandler;

13 14 15
class Basic_Credentials_Manager: public Botan::Credentials_Manager
{
public:
16
  Basic_Credentials_Manager(const TCPSocketHandler* const socket_handler);
17 18 19 20 21
  void verify_certificate_chain(const std::string& type,
                                const std::string& purported_hostname,
                                const std::vector<Botan::X509_Certificate>&) override final;
  std::vector<Botan::Certificate_Store*> trusted_certificate_authorities(const std::string& type,
                                                                         const std::string& context) override final;
22
  void set_trusted_fingerprint(const std::string& fingerprint);
23 24

private:
25 26 27 28 29
  const TCPSocketHandler* const socket_handler;

  static void load_certs();
  static Botan::Certificate_Store_In_Memory certificate_store;
  static bool certs_loaded;
30
  std::string trusted_fingerprint;
31 32
};

33
#endif //BOTAN_FOUND
34
#endif //BIBOUMI_CREDENTIALS_MANAGER_HPP