"Fossies" - the Fresh Open Source Software Archive

Member "filezilla-3.48.1/src/interface/verifycertdialog.h" (6 May 2020, 2400 Bytes) of package /linux/misc/FileZilla_3.48.1_src.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "verifycertdialog.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.48.0_vs_3.48.1.

    1 #ifndef FILEZILLA_INTERFACE_VERIFYCERTDIALOG_HEADER
    2 #define FILEZILLA_INTERFACE_VERIFYCERTDIALOG_HEADER
    3 
    4 #include "dialogex.h"
    5 #include "xmlfunctions.h"
    6 
    7 #include <list>
    8 #include <set>
    9 
   10 class CertStore final
   11 {
   12 public:
   13     CertStore();
   14 
   15     bool IsTrusted(fz::tls_session_info const& info);
   16     void SetTrusted(fz::tls_session_info const& info, bool permanent, bool trustAllHostnames);
   17 
   18     void SetInsecure(std::string const& host, unsigned int port, bool permanent);
   19 
   20     bool IsInsecure(std::string const& host, unsigned int port, bool permanentOnly = false);
   21 
   22     bool HasCertificate(std::string const& host, unsigned int port);
   23 
   24 private:
   25     struct t_certData {
   26         std::string host;
   27         bool trustSans{};
   28         unsigned int port{};
   29         std::vector<uint8_t> data;
   30     };
   31 
   32     bool IsTrusted(std::string const& host, unsigned int port, std::vector<uint8_t> const& data, bool permanentOnly, bool allowSans);
   33     bool DoIsTrusted(std::string const& host, unsigned int port, std::vector<uint8_t> const& data, std::list<t_certData> const& trustedCerts, bool allowSans);
   34 
   35     void LoadTrustedCerts();
   36 
   37     std::list<t_certData> trustedCerts_;
   38     std::list<t_certData> sessionTrustedCerts_;
   39     std::set<std::tuple<std::string, unsigned int>> insecureHosts_;
   40     std::set<std::tuple<std::string, unsigned int>> sessionInsecureHosts_;
   41 
   42     CXmlFile m_xmlFile;
   43 };
   44 
   45 class CVerifyCertDialog final : protected wxDialogEx
   46 {
   47 public:
   48     static void ShowVerificationDialog(CertStore & certStore, CCertificateNotification& notification);
   49 
   50     static void DisplayCertificate(CCertificateNotification const& notification);
   51 
   52 private:
   53     bool CreateVerificationDialog(CCertificateNotification const& notification, bool displayOnly);
   54 
   55     CVerifyCertDialog();
   56     ~CVerifyCertDialog();
   57 
   58     void AddAlgorithm(wxWindow* parent, wxGridBagSizer* sizer, std::string const& name, bool insecure);
   59 
   60     bool DisplayCert(fz::x509_certificate const& cert);
   61 
   62     void ParseDN(wxWindow* parent, std::wstring const& dn, wxSizer* pSizer);
   63     void ParseDN_by_prefix(wxWindow* parent, std::vector<std::pair<std::wstring, std::wstring>>& tokens, std::wstring const& prefix, wxString const& name, wxSizer* pSizer);
   64 
   65     int line_height_{};
   66 
   67     void OnCertificateChoice(wxCommandEvent const& event);
   68 
   69     bool warning_{};
   70     bool sanTrustAllowed_{};
   71 
   72     struct impl;
   73     std::unique_ptr<impl> impl_;
   74 };
   75 
   76 void ConfirmInsecureConection(wxWindow* parent, CertStore & certStore, CInsecureConnectionNotification & notification);
   77 
   78 #endif