| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 | #ifndef EPIMAFIA_H
#define EPIMAFIA_H
#include "epimafia_global.h"
#include <QString>
#include <QList>
#include <QSettings>
#include <QStringList>
#include <openssl/aes.h>
#include <cstdio>
#include <QDebug>
class Epimafia;
class EPIMAFIASHARED_EXPORT EpiUser
{
public:
    void setLoginAes(QByteArray login);
    void setLogin(QString login);
    QString getLogin() const;
    QByteArray getLoginAes() const;
    bool hasLogin() const;
    bool isUnknown() const;
    void setPasswordAes(QByteArray password);
    void setPassword(QString password);
    QString getPassword() const;
    QByteArray getPasswordAes() const;
    bool hasPassword() const;
    void setPwd_numAes(QByteArray pwd_num);
    void setPwd_num(QString pwd_num);
    QString getPwd_num() const;
    QByteArray getPwd_numAes() const;
    bool hasPwd_num() const;
    void setPwd_pppAes(QByteArray pwd_ppp);
    void setPwd_ppp(QString pwd_ppp);
    QString getPwd_ppp() const;
    QByteArray getPwd_pppAes() const;
    bool hasPwd_ppp() const;
    void setPwd_socksAes(QByteArray pwd_socks);
    void setPwd_socks(QString pwd_socks);
    QString getPwd_socks() const;
    QByteArray getPwd_socksAes() const;
    bool hasPwd_socks() const;
    QVariant toVariant() const;
private:
    QByteArray m_login;
    QByteArray m_password;
    QByteArray m_pwd_num;
    QByteArray m_pwd_ppp;
    QByteArray m_pwd_socks;
};
typedef QList<EpiUser> EpiUsers;
Q_DECLARE_METATYPE(EpiUser)
class EPIMAFIASHARED_EXPORT Epimafia
{
public:
    static EpiUsers loadUsers();
    static void saveUser(EpiUser user);
    static void saveUsers(EpiUsers users);
    static void removeUser(EpiUser user);
    static QByteArray aesEncrypt(QString str);
    static QString aesDecrypt(QByteArray aes);
    static QString getUnknownUser();
private:
    static QSettings m_settings;
    static unsigned char m_aesKey[];
    static QByteArray aesEncrypt_16(QByteArray data);
    static QByteArray aesDecrypt_16(QByteArray aes);
};
QDebug EPIMAFIASHARED_EXPORT operator <<(QDebug dbg, const EpiUser&);
#endif // EPIMAFIA_H
 |