From 2be51c692307f067bb5bdc011e5f3dca1dbe3ff8 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Wed, 30 Apr 2025 17:30:42 +0300 Subject: QSslCertificate: add fromFile() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QSslCertificate::fromPath() does some extra work: - matching wildcard glob or regular expression patterns - checks if the string it's called on is a file or a dir That extra work isn't needed when you already have the path to a specific certificate file. E.g. qtlsbackend_openssl.cpp:systemCaCertificates() used to call fromPath() on *.pem/*.crt files that it got from iterating over system certifcates dirs. This also de-duplicates the code in fromPath(). [ChangeLog][QtNetwork][QSslCertificate] Added fromFile() method. Change-Id: I92ab358e4711866dd4510da42c47905c7dae58b1 Reviewed-by: Ivan Solovev Reviewed-by: MÃ¥rten Nordheim --- src/plugins/tls/openssl/qtlsbackend_openssl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/tls/openssl/qtlsbackend_openssl.cpp') diff --git a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp index 6a55f275943..bce31734f94 100644 --- a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp +++ b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp @@ -410,7 +410,7 @@ QList systemCaCertificates() } } for (const QString& file : std::as_const(certFiles)) - systemCerts.append(QSslCertificate::fromPath(file, QSsl::Pem)); + systemCerts.append(QSslCertificate::fromFile(file, QSsl::Pem)); } #endif // platform #ifdef QSSLSOCKET_DEBUG -- cgit v1.2.3