Loading...
Searching...
No Matches
QXmppEncryptedFileSource.h
// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
// SPDX-FileCopyrightText: 2022 Jonah Brüchert <jbb@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPENCRYPTEDFILESOURCE_H
#define QXMPPENCRYPTEDFILESOURCE_H
#include "QXmppGlobal.h"
#include "QXmppHash.h"
#include "QXmppHttpFileSource.h"
#include <QSharedDataPointer>
#include <QUrl>
#include <QVector>
class QXmppEncryptedFileSourcePrivate;
// exported for tests
class QXMPP_EXPORT QXmppEncryptedFileSource
{
public:
QXmppEncryptedFileSource();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppEncryptedFileSource)
QXmpp::Cipher cipher() const;
void setCipher(QXmpp::Cipher newCipher);
const QByteArray &key() const;
void setKey(const QByteArray &newKey);
const QByteArray &iv() const;
void setIv(const QByteArray &newIv);
const QVector<QXmppHash> &hashes() const;
void setHashes(const QVector<QXmppHash> &newHashes);
const QVector<QXmppHttpFileSource> &httpSources() const;
void setHttpSources(const QVector<QXmppHttpFileSource> &newHttpSources);
static constexpr std::tuple XmlTag = { u"encrypted", QXmpp::Private::ns_esfs };
bool parse(const QDomElement &el);
void toXml(QXmlStreamWriter *writer) const;
private:
QSharedDataPointer<QXmppEncryptedFileSourcePrivate> d;
};
#endif // QXMPPENCRYPTEDFILESOURCE_H
QXmppEncryptedFileSource::cipher
QXmpp::Cipher cipher() const
Returns the cipher that was used to encrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:59
QXmppEncryptedFileSource::setKey
void setKey(const QByteArray &newKey)
Sets the key that was used to encrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:77
QXmppEncryptedFileSource::setCipher
void setCipher(QXmpp::Cipher newCipher)
Sets the cipher that was used to encrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:65
QXmppEncryptedFileSource::setIv
void setIv(const QByteArray &newIv)
Sets the initialization vector that was used to encrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:89
QXmppEncryptedFileSource::iv
const QByteArray & iv() const
Returns the Initialization vector that can be used to decrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:83
QXmppEncryptedFileSource::key
const QByteArray & key() const
Returns the key that can be used to decrypt the data in this file source.
Definition QXmppEncryptedFileSource.cpp:71
QXmppEncryptedFileSource::httpSources
const QVector< QXmppHttpFileSource > & httpSources() const
Returns the http sources that can be used to retrieve the encrypted data.
Definition QXmppEncryptedFileSource.cpp:107
QXmppEncryptedFileSource::setHashes
void setHashes(const QVector< QXmppHash > &newHashes)
Sets the hashes of the file contained in this file source.
Definition QXmppEncryptedFileSource.cpp:101
QXmppEncryptedFileSource::setHttpSources
void setHttpSources(const QVector< QXmppHttpFileSource > &newHttpSources)
Sets the http sources containing the encrypted data.
Definition QXmppEncryptedFileSource.cpp:113
QXmppEncryptedFileSource::hashes
const QVector< QXmppHash > & hashes() const
Returns the hashes of the file contained in this file source.
Definition QXmppEncryptedFileSource.cpp:95
QXmpp::Cipher
Cipher
Definition QXmppGlobal.h:172