libquentier  0.8.0
The library for rich desktop clients of Evernote service
IEncryptor.h
1 /*
2  * Copyright 2024-2025 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/types/Result.h>
23 #include <quentier/utility/Linkage.h>
24 
25 #include <QString>
26 
27 class QDebug;
28 class QTextStream;
29 
30 namespace quentier::utility {
31 
36 struct QUENTIER_EXPORT IEncryptor
37 {
38  virtual ~IEncryptor() noexcept;
39 
43  enum class Cipher
44  {
48  RC2,
52  AES
53  };
54 
55  friend QUENTIER_EXPORT QDebug & operator<<(QDebug & dbg, Cipher cipher);
56 
57  friend QUENTIER_EXPORT QTextStream & operator<<(
58  QTextStream & strm, Cipher cipher);
59 
67  [[nodiscard]] virtual Result<QString, ErrorString> encrypt(
68  const QString & text, const QString & passphrase) = 0;
69 
77  [[nodiscard]] virtual Result<QString, ErrorString> decrypt(
78  const QString & encryptedText, const QString & passphrase,
79  Cipher cipher) = 0;
80 };
81 
82 } // namespace quentier::utility
Cipher
Definition: IEncryptor.h:43
Definition: Result.h:33
Definition: ApplicationSettings.h:27
The IEncryptor interface provides encryption and decryption functionality which is compatible with th...
Definition: IEncryptor.h:36