Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlsslkey.cpp
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
4#include <QtCore/qfile.h>
5#include "qqmlsslkey_p.h"
6
8
10{
11 if (m_keyFile.isEmpty()) {
12 qWarning() << "SslConfiguration::getSslKey: No key paths set";
13 return QSslKey();
14 }
15
16 QFile file(m_keyFile);
18 qWarning() << "SslConfiguration::getSslKey: Couldn't open file:" << m_keyFile;
19 return QSslKey();
20 }
21
22 return QSslKey(file.readAll(),
23 m_keyAlgorithm,
24 m_keyFormat,
25 m_keyType,
26 m_keyPassPhrase);
27}
28
30{
31 if (m_keyFile == key)
32 return;
33
34 m_keyFile = key;
35}
36
38{
39 if (m_keyAlgorithm == value)
40 return;
41
42 m_keyAlgorithm = value;
43}
44
46{
47 if (m_keyFormat == value)
48 return;
49
50 m_keyFormat = value;
51}
52
54{
55 if (m_keyPassPhrase == value)
56 return;
57
58 m_keyPassPhrase = value;
59}
60
62{
63 if (m_keyType == type)
64 return;
65 m_keyType = type;
66}
67
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qfile.h:93
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:904
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
void setKeyPassPhrase(const QByteArray &value)
QSslKey getSslKey() const
Definition qqmlsslkey.cpp:9
void setKeyType(QSsl::KeyType type)
void setKeyFormat(QSsl::EncodingFormat value)
void setKeyFile(const QString &key)
void setKeyAlgorithm(QSsl::KeyAlgorithm value)
The QSslKey class provides an interface for private and public keys.
Definition qsslkey.h:23
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
KeyType
Describes the two types of keys QSslKey supports.
Definition qssl.h:22
KeyAlgorithm
Describes the different key algorithms supported by QSslKey.
Definition qssl.h:34
EncodingFormat
Describes supported encoding formats for certificates and keys.
Definition qssl.h:28
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:166
GLuint64 key
GLenum type
QFile file
[0]