#ifndef __VERIFYCERTDIALOG_H__ #define __VERIFYCERTDIALOG_H__ #include "xmlfunctions.h" class wxDialogEx; class CVerifyCertDialog final : protected wxEvtHandler { public: CVerifyCertDialog(); virtual ~CVerifyCertDialog(); bool IsTrusted(CCertificateNotification const& notification); void ShowVerificationDialog(CCertificateNotification& notification, bool displayOnly = false); private: struct t_certData { wxString host; int port{}; unsigned char* data{}; unsigned int len{}; }; bool IsTrusted(const wxString& host, int port, const unsigned char* data, unsigned int len, bool permanentOnly); bool DoIsTrusted(const wxString& host, int port, const unsigned char* data, unsigned int len, std::list const& trustedCerts); bool DisplayAlgorithm(int controlId, wxString name, bool insecure); bool DisplayCert(wxDialogEx* pDlg, const CCertificate& cert); void ParseDN(wxWindow* parent, const wxString& dn, wxSizer* pSizer); void ParseDN_by_prefix(wxWindow* parent, std::list& tokens, wxString prefix, const wxString& name, wxSizer* pSizer, bool decode = false); wxString DecodeValue(const wxString& value); wxString ConvertHexToString(const unsigned char* data, unsigned int len); unsigned char* ConvertStringToHex(const wxString& str, unsigned int &len); void SetPermanentlyTrusted(CCertificateNotification const& notification); void LoadTrustedCerts(); std::list m_trustedCerts; std::list m_sessionTrustedCerts; CXmlFile m_xmlFile; std::vector m_certificates; wxDialogEx* m_pDlg{}; wxSizer* m_pSubjectSizer{}; wxSizer* m_pIssuerSizer{}; int line_height_{}; void OnCertificateChoice(wxCommandEvent& event); }; #endif //__VERIFYCERTDIALOG_H__