Created
October 3, 2021 17:08
-
-
Save seyedmmousavi/d5faec3fb2efc3696eb30a119825096a to your computer and use it in GitHub Desktop.
Embedding Let's Encrypt CA root certificate into Qt application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtNetwork/QSslConfiguration> | |
#include <QtNetwork/QSslSocket> | |
#include <QtGlobal> | |
//more includes... | |
int main(int argc, char *argv[]) | |
{ | |
//Adding CA root certificate of the Let'sEncrypt into default CA DB | |
//for Qt 5.15+ | |
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) | |
qDebug() << "loading embedded \"ISRG Root X1\" CA cert:" | |
<< QSslConfiguration::defaultConfiguration().addCaCertificates(":/ca_certs/isrg_root_x1.pem"); | |
#else | |
qDebug() << "loading embedded \"ISRG Root X1\" CA cert:" | |
<< QSslSocket::addDefaultCaCertificates(":/ca_certs/isrg_root_x1.pem"); | |
#endif | |
//more codes... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment