diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2009-05-22 17:48:43 +0400 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2009-05-22 17:48:43 +0400 |
commit | fa93d325f44de4a71e623a71cc75b8ff592d547d (patch) | |
tree | 70237c57e53ae86ffaf3da9ba2fff0cf00b06721 /src/murmur/Cert.cpp | |
parent | 39e2f5a375cdb80cb53d2dbd660ac6fe4eb0699e (diff) |
Indent, changelog and submodule update
Diffstat (limited to 'src/murmur/Cert.cpp')
-rw-r--r-- | src/murmur/Cert.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/murmur/Cert.cpp b/src/murmur/Cert.cpp index 618298aec..e55776ee6 100644 --- a/src/murmur/Cert.cpp +++ b/src/murmur/Cert.cpp @@ -50,31 +50,31 @@ static int add_ext(X509 * crt, int nid, char *value) { bool Server::isKeyForCert(const QSslKey &key, const QSslCertificate &cert) { if (key.isNull() || cert.isNull() || (key.type() != QSsl::PrivateKey)) return false; - + QByteArray qbaKey = key.toDer(); QByteArray qbaCert = cert.toDer(); - + X509 *x509 = NULL; EVP_PKEY *pkey = NULL; BIO *mem = NULL; - + mem = BIO_new_mem_buf(qbaKey.data(), qbaKey.size()); BIO_set_close(mem, BIO_NOCLOSE); pkey = d2i_PrivateKey_bio(mem, NULL); BIO_free(mem); - + mem = BIO_new_mem_buf(qbaCert.data(), qbaCert.size()); BIO_set_close(mem, BIO_NOCLOSE); x509 = d2i_X509_bio(mem, NULL); BIO_free(mem); mem = NULL; - + if (x509 && pkey && X509_check_private_key(x509, pkey)) { EVP_PKEY_free(pkey); X509_free(x509); return true; } - + if (pkey) EVP_PKEY_free(pkey); if (x509) @@ -88,9 +88,9 @@ void Server::initializeCert() { crt = getConf("certificate", QString()).toByteArray(); key = getConf("key", QString()).toByteArray(); pass = getConf("passphrase", QByteArray()).toByteArray(); - + QList<QSslCertificate> ql; - + if (! key.isEmpty()) { qskKey = QSslKey(key, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, pass); if (qskKey.isNull()) @@ -104,7 +104,7 @@ void Server::initializeCert() { if (! qskKey.isNull()) { ql << QSslCertificate::fromData(crt); ql << QSslCertificate::fromData(key); - for(int i=0;i<ql.size();++i) { + for (int i=0;i<ql.size();++i) { const QSslCertificate &c = ql.at(i); if (isKeyForCert(qskKey, c)) { qscCert = c; @@ -115,8 +115,8 @@ void Server::initializeCert() { } if (qscCert.issuerInfo(QSslCertificate::CommonName) == QLatin1String("Murmur Autogenerated Certificate")) { - log("Old autogenerated certificate is unusable for registration, invalidating it"); - qscCert = QSslCertificate(); + log("Old autogenerated certificate is unusable for registration, invalidating it"); + qscCert = QSslCertificate(); } if (qscCert.isNull() || qskKey.isNull()) { @@ -167,7 +167,7 @@ void Server::initializeCert() { qskKey = QSslKey(key, QSsl::Rsa, QSsl::Der); if (qskKey.isNull()) log("Key generation failed"); - + setConf("certificate", qscCert.toPem()); setConf("key", qskKey.toPem()); } |