libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
EncryptionManager.h
1/*
2 * Copyright 2016-2024 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <quentier/types/ErrorString.h>
22#include <quentier/utility/Linkage.h>
23
24#include <QObject>
25#include <QString>
26#include <QUuid>
27
28namespace quentier {
29
30class EncryptionManagerPrivate;
31
37class QUENTIER_EXPORT EncryptionManager : public QObject
38{
40public:
41 explicit EncryptionManager(QObject * parent = nullptr);
42 ~EncryptionManager() noexcept override;
43
44 [[nodiscard]] bool decrypt(
45 const QString & encryptedText, const QString & passphrase,
46 const QString & cipher, size_t keyLength, QString & decryptedText,
47 ErrorString & errorDescription);
48
49 [[nodiscard]] bool encrypt(
50 const QString & textToEncrypt, const QString & passphrase,
51 QString & cipher, size_t & keyLength, QString & encryptedText,
52 ErrorString & errorDescription);
53
55 void decryptedText(
56 QString text, bool success, ErrorString errorDescription,
58
59 void encryptedText(
60 QString encryptedText, bool success, ErrorString errorDescription,
62
63public Q_SLOTS:
64 void onDecryptTextRequest(
65 QString encryptedText, QString passphrase, QString cipher,
66 size_t keyLength, QUuid requestId);
67
68 void onEncryptTextRequest(
70 size_t keyLength, QUuid requestId);
71
72private:
73 EncryptionManagerPrivate * const d_ptr;
74 Q_DECLARE_PRIVATE(EncryptionManager)
75};
76
77} // namespace quentier
The EncryptionManager class provides both synchronous methods to encrypt or decrypt given text with p...
Definition EncryptionManager.h:38
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:43
The Result template class represents the bare bones result monad implementation which either contains...
Definition Result.h:38