KDECore
Go to the documentation of this file.
30 #include <QtCore/QFile>
34 #include <QtCore/QDate>
57 const static strErr strError[] = {
72 for (
int i = 0; i < int(
sizeof(strError)/
sizeof(strErr)); i++) {
73 QString s = QString::fromLatin1(strError[i].str);
75 stringToSslError.insert(s, e);
76 sslErrorToString.insert(e, s);
111 QString dtString = QString::fromLatin1(
"ExpireUTC ");
116 sl.append(QString::fromLatin1(
"Reject"));
119 sl.append(d->sslErrorToString.value(e));
122 if (!
group.hasKey(
"CertificatePEM"))
143 group.deleteEntry(hostName);
144 if (
group.keyList().size() < 2) {
155 foreach (
const QString &groupName, d->config.groupList()) {
156 QByteArray certDigest = groupName.toLatin1();
157 foreach (
const QString &key, d->config.group(groupName).keyList()) {
158 if (key == QLatin1String(
"CertificatePEM")) {
172 bool wasPrevDot =
true;
173 const int length = hostName.length();
174 for (
int i = 0; i < length; i++) {
175 const QChar c = hostName.at(i);
176 if (c == QLatin1Char(
'.')) {
177 if (wasPrevDot || (i + 1 == hostName.length())) {
193 *namePartsCount = partsCount;
200 const QByteArray certDigest = cert.digest().toHex();
204 bool foundHostName =
false;
206 int needlePartsCount;
210 if (
group.hasKey(needle)) {
212 if (needlePartsCount >= 1) {
213 foundHostName =
true;
219 while (--needlePartsCount >= 2) {
220 const int dotIndex = needle.indexOf(QLatin1Char(
'.'));
221 Q_ASSERT(dotIndex > 0);
222 needle.remove(0, dotIndex - 1);
223 needle[0] = QChar::fromLatin1(
'*');
224 if (
group.hasKey(needle)) {
225 foundHostName =
true;
232 if (!foundHostName) {
243 if (sl.size() >= 2) {
244 QString dtString = sl.takeFirst();
245 if (dtString.startsWith(QLatin1String(
"ExpireUTC "))) {
246 dtString.remove(0, 10);
247 expiryDt = QDateTime::fromString(dtString, Qt::ISODate);
251 if (!expiryDt.isValid() || expiryDt < QDateTime::currentDateTime()) {
253 group.deleteEntry(needle);
255 if (
group.keyList().size() < 2) {
262 bool isRejected =
false;
263 foreach (
const QString &s, sl) {
264 if (s == QLatin1String(
"Reject")) {
266 ignoredErrors.clear();
269 if (!d->stringToSslError.contains(s)) {
272 ignoredErrors.append(d->stringToSslError.value(s));
284 #include "kssld_adaptor.moc"
QSslCertificate certificate() const
#define K_PLUGIN_FACTORY(name, pluginRegistrations)
Defines a KPluginFactory subclass with two constructors and a static componentData function.
void setExpiryDateTime(const QDateTime &dateTime)
The central class of the KDE configuration data system.
QList< KSslError::Error > ignoredErrors() const
@ InvalidCertificateAuthorityCertificate
The base class for KDED modules.
void setIgnoredErrors(const QList< KSslError::Error > &errors)
static QString normalizeSubdomains(const QString &hostName, int *namePartsCount)
QDateTime expiryDateTime() const
A class for one specific group in a KConfig object.
@ InvalidCertificatePurpose
KSharedConfigPtr config()
Returns the general config object.
void clearRule(const KSslCertificateRule &rule)
KSSLD(QObject *parent, const QVariantList &)
void setRule(const KSslCertificateRule &rule)
#define K_EXPORT_PLUGIN(factory)
This macro exports the main object of the plugin.
@ CertificateSignatureFailed
KSslCertificateRule rule(const QSslCertificate &cert, const QString &hostName) const
void setRejected(bool rejected)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by
doxygen 1.8.20 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.