void KSSLD::cacheSaveToDisk() { KSSLCNode *node; for (node = certList.first(); node; node = certList.next()) { if (node->permanent || node->expires > QDateTime::currentDateTime()) { // First convert to a binary format and then write the kconfig entry // write the (CN, policy, cert) to KSimpleConfig cfg->setGroup(node->cert->getSubject()); cfg->writeEntry("Certificate", node->cert->toString()); cfg->writeEntry("Policy", node->policy); cfg->writeEntry("Expires", node->expires); cfg->writeEntry("Permanent", node->permanent); cfg->writeEntry("Hosts", node->hosts); // Also write the chain QStringList qsl; QPtrList<KSSLCertificate> cl = node->cert->chain().getChain(); for (KSSLCertificate *c = cl.first(); c != 0; c = cl.next()) { //kdDebug() << "Certificate in chain: " << c->toString() << endl; qsl << c->toString(); } cl.setAutoDelete(true); cfg->writeEntry("Chain", qsl); } } cfg->sync(); // insure proper permissions -- contains sensitive data QString cfgName(KGlobal::dirs()->findResource("config", "ksslpolicies")); if (!cfgName.isEmpty()) ::chmod(QFile::encodeName(cfgName), 0600); }
KSSLCertificate KSSLD::getCertByMD5Digest(const TQString &key) { TQMap<TQString, KSSLCertificate *>::iterator iter = skMD5Digest.find(key); kdDebug() << "Searching cert for " << key.latin1() << endl; if (iter != skMD5Digest.end()) return **iter; KSSLCertificate rc; // FIXME: Better way to return a not found condition? kdDebug() << "Not found: " << rc.toString().latin1() << endl; return rc; }
bool KSSLSigners::addCA(KSSLCertificate& cert, bool ssl, bool email, bool code) const { return addCA(cert.toString(), ssl, email, code); }