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
qx509_openssl_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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#ifndef QX509_OPENSSL_P_H
5#define QX509_OPENSSL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtNetwork/private/qtnetworkglobal_p.h>
19
21
22#include <QtNetwork/private/qtlsbackend_p.h>
23
24#include <QtCore/qvariant.h>
25#include <QtCore/qglobal.h>
26#include <QtCore/qstring.h>
27
28#include "qopenssl_p.h"
29
30#include <algorithm>
31
33
34namespace QTlsPrivate {
35
37{
38public:
41
42 // TLSTODO: in future may become movable/copyable (ref-counted based
43 // OpenSSL's X509 implementation).
44
45 bool isEqual(const X509Certificate &rhs) const override;
46 bool isSelfSigned() const override;
47 QMultiMap<QSsl::AlternativeNameEntryType, QString> subjectAlternativeNames() const override;
48 TlsKey *publicKey() const override;
49
50 QByteArray toPem() const override;
51 QByteArray toDer() const override;
52 QString toText() const override;
53 Qt::HANDLE handle() const override;
54
55 size_t hash(size_t seed) const noexcept override;
56
58 static QList<QSslCertificate> stackOfX509ToQSslCertificates(STACK_OF(X509) *x509);
59 static QSslErrorEntry errorEntryFromStoreContext(X509_STORE_CTX *ctx);
60
61 static QList<QSslError> verify(const QList<QSslCertificate> &chain, const QString &hostName);
62 static QList<QSslError> verify(const QList<QSslCertificate> &caCertificates,
63 const QList<QSslCertificate> &certificateChain,
64 const QString &hostName);
65
66 static QList<QSslCertificate> certificatesFromPem(const QByteArray &pem, int count);
67 static QList<QSslCertificate> certificatesFromDer(const QByteArray &der, int count);
69 QList<QSslCertificate> *caCertificates,
70 const QByteArray &passPhrase);
71
72 static QSslError openSSLErrorToQSslError(int errorCode, const QSslCertificate &cert);
73private:
74 void parseExtensions();
75 static X509CertificateExtension convertExtension(X509_EXTENSION *ext);
76
77 X509 *x509 = nullptr;
78
79 Q_DISABLE_COPY_MOVE(X509CertificateOpenSSL)
80};
81
82extern "C" int qt_X509Callback(int ok, X509_STORE_CTX *ctx);
83
84} // namespace QTlsPrivate
85
87
88#endif // QX509_OPENSSL_P_H
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QSslCertificate class provides a convenient API for an X509 certificate.
The QSslError class provides an SSL error.
Definition qsslerror.h:21
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
TlsKey is an abstract class, that allows a TLS plugin to provide an underlying implementation for the...
static QSslErrorEntry errorEntryFromStoreContext(X509_STORE_CTX *ctx)
static QSslCertificate certificateFromX509(X509 *x)
QByteArray toPem() const override
static bool importPkcs12(QIODevice *device, QSslKey *key, QSslCertificate *cert, QList< QSslCertificate > *caCertificates, const QByteArray &passPhrase)
static QList< QSslCertificate > certificatesFromDer(const QByteArray &der, int count)
QByteArray toDer() const override
static QSslError openSSLErrorToQSslError(int errorCode, const QSslCertificate &cert)
static QList< QSslCertificate > certificatesFromPem(const QByteArray &pem, int count)
TlsKey * publicKey() const override
bool isEqual(const X509Certificate &rhs) const override
Qt::HANDLE handle() const override
static QList< QSslError > verify(const QList< QSslCertificate > &chain, const QString &hostName)
static QList< QSslCertificate > stackOfX509ToQSslCertificates(STACK_OF(X509) *x509)
QMultiMap< QSsl::AlternativeNameEntryType, QString > subjectAlternativeNames() const override
X509Certificate is an abstract class that allows a TLS backend to provide an implementation of the QS...
EGLContext ctx
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
Namespace containing onternal types that TLS backends implement.
int qt_X509Callback(int ok, X509_STORE_CTX *ctx)
void * HANDLE
GLint GLint GLint GLint GLint x
[0]
GLuint64 key
GLenum GLenum GLsizei count
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx)
QList< QSslCertificate > cert
[0]