#include <QtCrypto>
#include <QCoreApplication>
#include <QFile>
#include <iostream>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"
#endif
{
std::cout << " Organization: " << std::endl;
QString organization;
foreach (organization, orgInfoList) {
std::cout << " " << qPrintable(organization) << std::endl;
}
std::cout << " Country: " << std::endl;
std::cout << " " << qPrintable(country) << std::endl;
}
}
{
std::cout << "Subject: " << std::endl;
dumpCertificateInfo(subject);
}
{
std::cout << "Issuer: " << std::endl;
dumpCertificateInfo(issuer);
}
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
std::cout << "Sorry, no PKI certificate support" << std::endl;
return 1;
}
if (argc >= 2) {
std::cout << "Import succeeded" << std::endl;
}
} else {
std::cout << "System certificates not available" << std::endl;
return 2;
}
}
std::cout << "Number of certificates: " << certlist.count() << std::endl;
foreach (cert, certlist) {
std::cout << "Serial Number:";
std::cout << "Is certificate authority" << std::endl;
} else {
std::cout << "Is not a certificate authority" << std::endl;
}
std::cout << "Self signed" << std::endl;
} else {
std::cout << "Is not self-signed!!!" << std::endl;
}
std::cout <<
"Valid from " << qPrintable(cert.
notValidBefore().toString());
std::cout <<
", until " << qPrintable(cert.
notValidAfter().toString());
std::cout << std::endl;
std::cout << "PEM:" << std::endl;
std::cout << qPrintable(cert.
toPEM());
std::cout << std::endl << std::endl;
}
return 0;
}
Bundle of Certificates and CRLs.
Definition: qca_cert.h:1929
static CertificateCollection fromFlatTextFile(const QString &fileName, ConvertResult *result=nullptr, const QString &provider=QString())
import a CertificateCollection from a text file
QList< Certificate > certificates() const
The Certificates in this collection.
Public Key (X.509) certificate.
Definition: qca_cert.h:857
bool isSelfSigned() const
Test if the Certificate is self-signed.
bool isCA() const
Test if the Certificate is valid as a Certificate Authority.
QDateTime notValidBefore() const
The earliest date that the certificate is valid.
QString toPEM() const
Export the Certificate into a PEM format.
BigInteger serialNumber() const
The serial number of the certificate.
QDateTime notValidAfter() const
The latest date that the certificate is valid.
CertificateInfo subjectInfo() const
CertificateInfo issuerInfo() const
Properties of the issuer of the certificate.
Convenience method for initialising and cleaning up QCA.
Definition: qca_core.h:660
QCA_EXPORT void init()
Initialise QCA.
QCA_EXPORT bool haveSystemStore()
Test if QCA can access the root CA certificates.
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
@ Country
The country, id = "2.5.4.6".
Definition: qca_cert.h:75
@ Organization
An organisation (eg company), id = "2.5.4.10".
Definition: qca_cert.h:69
ConvertResult
Return value from a format conversion.
Definition: qca_publickey.h:119
@ ConvertGood
Conversion succeeded, results should be valid.
Definition: qca_publickey.h:120
QMultiMap< CertificateInfoType, QString > CertificateInfo
Certificate properties type.
Definition: qca_cert.h:535
QCA_EXPORT CertificateCollection systemStore()
Get system-wide root Certificate Authority (CA) certificates.