You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef EPIMAFIA_H
  2. #define EPIMAFIA_H
  3. #include "epimafia_global.h"
  4. #include <QString>
  5. #include <QList>
  6. #include <QSettings>
  7. #include <QStringList>
  8. #include <openssl/aes.h>
  9. #include <cstdio>
  10. #include <QDebug>
  11. class Epimafia;
  12. class EPIMAFIASHARED_EXPORT EpiUser
  13. {
  14. public:
  15. void setLoginAes(QByteArray login);
  16. void setLogin(QString login);
  17. QString getLogin() const;
  18. QByteArray getLoginAes() const;
  19. bool hasLogin() const;
  20. bool isUnknown() const;
  21. void setPasswordAes(QByteArray password);
  22. void setPassword(QString password);
  23. QString getPassword() const;
  24. QByteArray getPasswordAes() const;
  25. bool hasPassword() const;
  26. void setPwd_numAes(QByteArray pwd_num);
  27. void setPwd_num(QString pwd_num);
  28. QString getPwd_num() const;
  29. QByteArray getPwd_numAes() const;
  30. bool hasPwd_num() const;
  31. void setPwd_pppAes(QByteArray pwd_ppp);
  32. void setPwd_ppp(QString pwd_ppp);
  33. QString getPwd_ppp() const;
  34. QByteArray getPwd_pppAes() const;
  35. bool hasPwd_ppp() const;
  36. void setPwd_socksAes(QByteArray pwd_socks);
  37. void setPwd_socks(QString pwd_socks);
  38. QString getPwd_socks() const;
  39. QByteArray getPwd_socksAes() const;
  40. bool hasPwd_socks() const;
  41. QVariant toVariant() const;
  42. private:
  43. QByteArray m_login;
  44. QByteArray m_password;
  45. QByteArray m_pwd_num;
  46. QByteArray m_pwd_ppp;
  47. QByteArray m_pwd_socks;
  48. };
  49. typedef QList<EpiUser> EpiUsers;
  50. Q_DECLARE_METATYPE(EpiUser)
  51. class EPIMAFIASHARED_EXPORT Epimafia
  52. {
  53. public:
  54. static EpiUsers loadUsers();
  55. static void saveUser(EpiUser user);
  56. static void saveUsers(EpiUsers users);
  57. static void removeUser(EpiUser user);
  58. static QByteArray aesEncrypt(QString str);
  59. static QString aesDecrypt(QByteArray aes);
  60. static QString getUnknownUser();
  61. private:
  62. static QSettings m_settings;
  63. static unsigned char m_aesKey[];
  64. static QByteArray aesEncrypt_16(QByteArray data);
  65. static QByteArray aesDecrypt_16(QByteArray aes);
  66. };
  67. QDebug EPIMAFIASHARED_EXPORT operator <<(QDebug dbg, const EpiUser&);
  68. #endif // EPIMAFIA_H