-
Notifications
You must be signed in to change notification settings - Fork 9
/
fileencryption.h
50 lines (42 loc) · 1.42 KB
/
fileencryption.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef FILEENCRYPTION_H
#define FILEENCRYPTION_H
#include <QObject>
#include "qaesencryption.h"
class FileEncryption : public QObject
{
Q_OBJECT
public:
explicit FileEncryption(QObject *parent = nullptr);
void setFile(const QString& strIn, const QString& strOut);
void setKey(const QByteArray& key);
void setEncryption(bool flag);
void setAESParameter(QAESEncryption::Aes aes, QAESEncryption::Mode mode, QAESEncryption::Padding padding);
void stop(); // 停止
signals:
void start(); // 开始
void showLog(QString log); // 日志
private:
void startEncryption();
void encryption();
void decrypt();
bool readFile(const QString& fileName);
void dataOperation();
void check();
bool writeFile(const QString& fileName);
void clear();
private:
QString m_strIn; // 输入文件路径
QString m_strOut; // 输出文件路径
QString m_fileSuffix; // 文件后缀
QByteArray m_key; // 密钥
QByteArray m_iv; // 偏移
bool m_encryption = true;
QAESEncryption::Aes m_aes;
QAESEncryption::Mode m_mode;
QAESEncryption::Padding m_padding;
QByteArray m_dataIn; // 输入内容
QByteArray m_dataOut; // 输出内容
QByteArray m_md5; // MD5值
QByteArray m_head; // bmp图片的文件信息
};
#endif // FILEENCRYPTION_H