From eb63b18dcbb2ccdf811461a42f120e5d0ab82e88 Mon Sep 17 00:00:00 2001 From: Jonah BrĂ¼chert Date: Sat, 24 Sep 2022 17:58:44 +0200 Subject: EncryptedFileSource: Make public (#469) The sources possibly need to be saved by clients. --- src/base/QXmppEncryptedFileSource.h | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/base/QXmppEncryptedFileSource.h (limited to 'src/base/QXmppEncryptedFileSource.h') diff --git a/src/base/QXmppEncryptedFileSource.h b/src/base/QXmppEncryptedFileSource.h new file mode 100644 index 00000000..3d7a7c90 --- /dev/null +++ b/src/base/QXmppEncryptedFileSource.h @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: 2022 Linus Jahn +// SPDX-FileCopyrightText: 2022 Jonah BrĂ¼chert +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef QXMPPENCRYPTEDFILESOURCE_H +#define QXMPPENCRYPTEDFILESOURCE_H + +#include "QXmppGlobal.h" +#include "QXmppHash.h" +#include "QXmppHttpFileSource.h" + +#include +#include +#include + +class QXmppEncryptedFileSourcePrivate; + +// exported for tests +class QXMPP_EXPORT QXmppEncryptedFileSource +{ +public: + enum Cipher { + Aes128GcmNopadding, + Aes256GcmNopadding, + Aes256CbcPkcs7, + }; + + QXmppEncryptedFileSource(); + QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppEncryptedFileSource) + + Cipher cipher() const; + void setCipher(Cipher newCipher); + + const QByteArray &key() const; + void setKey(const QByteArray &newKey); + + const QByteArray &iv() const; + void setIv(const QByteArray &newIv); + + const QVector &hashes() const; + void setHashes(const QVector &newHashes); + + const QVector &httpSources() const; + void setHttpSources(const QVector &newHttpSources); + + /// \cond + bool parse(const QDomElement &el); + void toXml(QXmlStreamWriter *writer) const; + /// \endcond + +private: + QSharedDataPointer d; +}; + +#endif // QXMPPENCRYPTEDFILESOURCE_H -- cgit v1.2.3