#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const std::string base32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; class TOTPGenGUI : public wxApp { public: virtual bool OnInit(); }; class TOTPGen : public wxFrame { public: TOTPGen(); private: wxPanel *MainWindow; wxBoxSizer *MainSizer; wxBoxSizer *ButtonSizer_Upper; wxBoxSizer *ButtonSizer_Lower; wxButton *UpdateSecretButton; void UpdateSecret(wxCommandEvent& event); bool Locked; wxButton *UnlockButton; void Unlock(wxCommandEvent& event); wxButton *CopyButton; void CopyText(wxCommandEvent& event); wxButton *QuitButton; void OnExit(wxCommandEvent& event); wxBoxSizer *TextSizer; wxStaticText *TOTPField; void ResizeTextToFit(wxStaticText *text_field); wxString SecretFile; void InitAES(const char *passphrase, unsigned char *salt, unsigned char *key, unsigned char *iv); wxTimer *CountdownTimer; wxGauge *CountdownGauge; void UpdateStatus(wxTimerEvent& event); std::string Secret; std::string Passphrase; bool IsBase32(std::string& str); bool DecryptSecret(void); bool EncryptSecret(std::string& secret_str); std::string TOTP; bool GenTOTP(std::string& secret_str); };