Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsslkey_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQMLSSLKEY_P_H
6#define QQMLSSLKEY_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <qtqmlnetworkexports.h>
20
21#include <QtCore/QByteArray>
22#include <QtCore/QMetaType>
23#include <QtNetwork/qsslkey.h>
24#include <QtNetwork/qssl.h>
25#include <QtQml/qqml.h>
26
28
30{
31 Q_GADGET
32 QML_NAMED_ELEMENT(sslKey)
33 QML_ADDED_IN_VERSION(6, 7)
34
35 Q_PROPERTY(QString keyFile READ keyFile
36 WRITE setKeyFile)
37 Q_PROPERTY(QSsl::KeyAlgorithm keyAlgorithm READ keyAlgorithm
38 WRITE setKeyAlgorithm)
39 Q_PROPERTY(QSsl::EncodingFormat keyFormat READ keyFormat
40 WRITE setKeyFormat)
41 Q_PROPERTY(QByteArray keyPassPhrase READ keyPassPhrase
42 WRITE setKeyPassPhrase)
43 Q_PROPERTY(QSsl::KeyType keyType READ keyType WRITE setKeyType)
44
45public:
46 QSslKey getSslKey() const;
47 QString keyFile() const { return m_keyFile; }
48 QSsl::KeyAlgorithm keyAlgorithm() const { return m_keyAlgorithm; }
49 QSsl::EncodingFormat keyFormat() const { return m_keyFormat; }
50 QByteArray keyPassPhrase() const { return m_keyPassPhrase; }
51 QSsl::KeyType keyType() const { return m_keyType; }
52
53 void setKeyFile(const QString &key);
54 void setKeyAlgorithm(QSsl::KeyAlgorithm value);
55 void setKeyFormat(QSsl::EncodingFormat value);
56 void setKeyPassPhrase(const QByteArray &value);
57 void setKeyType(QSsl::KeyType type);
58
59private:
60 inline friend bool operator==(const QQmlSslKey &lvalue, const QQmlSslKey &rvalue)
61 {
62 return (lvalue.m_keyFile == rvalue.m_keyFile
63 && lvalue.m_keyAlgorithm == rvalue.m_keyAlgorithm
64 && lvalue.m_keyFormat == rvalue.m_keyFormat
65 && lvalue.m_keyType == rvalue.m_keyType
66 && lvalue.m_keyPassPhrase == rvalue.m_keyPassPhrase);
67 }
68
69 QString m_keyFile;
70 QByteArray m_keyPassPhrase;
71 QSsl::KeyAlgorithm m_keyAlgorithm = QSsl::Rsa;
72 QSsl::EncodingFormat m_keyFormat = QSsl::Pem;
73 QSsl::KeyType m_keyType = QSsl::PrivateKey;
74};
75
76QT_END_NAMESPACE
77
78#endif // QQMLSSLKEY_P_H