Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to verify a Digital Certificate using QSSLCertificate?
Forum Update on Monday, May 27th 2025

How to verify a Digital Certificate using QSSLCertificate?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsslqsslcertificateopensslhelpcryptography
1 Posts 1 Posters 489 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    candidaj
    wrote on 15 Aug 2022, 03:55 last edited by candidaj
    #1

    Below is the code I am using to verify a dummy certificate

        QString certFileName = "cert.pem";
        QFile certFile(certFileName);
        QSslCertificate sslClientCert;
      
        if (certFile.exists())
        {
            certFile.open(QIODevice::ReadOnly);
            QSslCertificate cert(&certFile, QSsl::Pem);
            sslClientCert = cert;
        }
    
        sslConfig = QSslConfiguration::defaultConfiguration();
        QList<QSslCertificate>certificates =  sslConfig.caCertificates();
        certificates.push_front(sslClientCert);
        sslConfig.setCaCertificates(certificates);
        QSslConfiguration::setDefaultConfiguration(sslConfig);
    
      
        QList<QSslError>error =  sslClientCert.verify(certificates,QString("TestCert"));
        qDebug()<<error;
    

    I am adding same certificate to the certificate chain.
    The SSL error list returned by the function verify is empty. Does that mean that my certificate is successfully verified?

    1 Reply Last reply
    0

    1/1

    15 Aug 2022, 03:55

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved