Falkon Develop
Cross-platform Qt-based web browser
aesinterface.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
4* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
5*
6* This is based on a work by Saju Pillai <saju.pillai@gmail.com>
7*
8* This program is free software: you can redistribute it and/or modify
9* it under the terms of the GNU General Public License as published by
10* the Free Software Foundation, either version 3 of the License, or
11* (at your option) any later version.
12*
13* This program is distributed in the hope that it will be useful,
14* but WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16* GNU General Public License for more details.
17*
18* You should have received a copy of the GNU General Public License
19* along with this program. If not, see <http://www.gnu.org/licenses/>.
20* ============================================================ */
21#ifndef AESINTERFACE_H
22#define AESINTERFACE_H
23
24#include "qzcommon.h"
25
26#include <openssl/evp.h>
27
28#include <QObject>
29#include <QHash>
30#include <QList>
31
32class FALKON_EXPORT AesInterface : public QObject
33{
34 Q_OBJECT
35
36public:
37 static const int VERSION;
38
39 explicit AesInterface(QObject* parent = nullptr);
41
42 bool isOk() const;
43
44 QByteArray encrypt(const QByteArray &plainData, const QByteArray &password);
45 QByteArray decrypt(const QByteArray &cipherData, const QByteArray &password);
46
47 static QByteArray passwordToHash(const QString &masterPassword);
48 static QByteArray createRandomData(int length);
49
50private:
51 bool init(int evpMode, const QByteArray &password, const QByteArray &iVector = QByteArray());
52
53 EVP_CIPHER_CTX* m_encodeCTX;
54 EVP_CIPHER_CTX* m_decodeCTX;
55
56 bool m_ok = false;
57 QByteArray m_iVector;
58};
59#endif //AESINTERFACE_H
static const int VERSION
Definition: aesinterface.h:37
#define FALKON_EXPORT
Definition: qzcommon.h:28