5#ifndef QXMPPFILEENCRYPTION_H
6#define QXMPPFILEENCRYPTION_H
8#include "QXmppGlobal.h"
19namespace QXmpp::Private::Encryption {
26QXMPP_EXPORT QByteArray process(
const QByteArray &data,
Cipher cipherConfig, Direction direction,
const QByteArray &key,
const QByteArray &iv);
27QXMPP_EXPORT QByteArray generateKey(
Cipher cipher);
28QXMPP_EXPORT QByteArray generateInitializationVector(
Cipher);
31class QXMPP_EXPORT EncryptionDevice :
public QIODevice
34 EncryptionDevice(std::unique_ptr<QIODevice> input, Cipher config,
const QByteArray &key,
const QByteArray &iv);
35 ~EncryptionDevice()
override;
37 bool open(QIODevice::OpenMode mode)
override;
38 void close()
override;
39 bool isSequential()
const override;
40 qint64 size()
const override;
41 qint64 readData(
char *data, qint64 maxlen)
override;
42 qint64 writeData(
const char *data, qint64 len)
override;
43 bool atEnd()
const override;
47 bool m_finalized =
false;
48 std::vector<char> m_outputBuffer;
49 std::unique_ptr<QIODevice> m_input;
50 std::unique_ptr<QCA::Cipher> m_cipher;
53class QXMPP_EXPORT DecryptionDevice :
public QIODevice
56 DecryptionDevice(std::unique_ptr<QIODevice> output, Cipher config,
const QByteArray &key,
const QByteArray &iv);
57 ~DecryptionDevice()
override;
59 bool open(QIODevice::OpenMode mode)
override;
60 void close()
override;
61 bool isSequential()
const override;
62 qint64 size()
const override;
63 qint64 readData(
char *data, qint64 maxlen)
override;
64 qint64 writeData(
const char *data, qint64 len)
override;
68 std::vector<char> m_outputBuffer;
69 std::unique_ptr<QIODevice> m_output;
70 std::unique_ptr<QCA::Cipher> m_cipher;
Cipher
Definition QXmppGlobal.h:160