aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2015-05-22 18:05:29 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2015-05-22 18:05:29 +0200
commit9c1fc1c6039340ebedaa4b513bea7942577f7747 (patch)
tree598d2174f70d3a3eb5c2a8d125e7385a88a06bf9 /src/server
parente59defd97d3f35e772a3382649b057862035ca45 (diff)
parent7ffc638a468e958167cc929941f7963a8a4bd9a5 (diff)
downloadqxmpp-9c1fc1c6039340ebedaa4b513bea7942577f7747.tar.gz
Merge pull request #54 from servonic/set_cert_by_obj
Set local TLS certificate and private key as QSslCertificate and QSslKey
Diffstat (limited to 'src/server')
-rw-r--r--src/server/QXmppServer.cpp26
-rw-r--r--src/server/QXmppServer.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/src/server/QXmppServer.cpp b/src/server/QXmppServer.cpp
index 643892fd..192a0093 100644
--- a/src/server/QXmppServer.cpp
+++ b/src/server/QXmppServer.cpp
@@ -482,6 +482,19 @@ void QXmppServer::setLocalCertificate(const QString &path)
server->setLocalCertificate(d->localCertificate);
}
+/// Sets the local SSL certificate
+///
+/// \param certificate
+
+void QXmppServer::setLocalCertificate(const QSslCertificate &certificate)
+{
+ d->localCertificate = certificate;
+
+ // reconfigure servers
+ foreach (QXmppSslServer *server, d->serversForClients + d->serversForServers)
+ server->setLocalCertificate(d->localCertificate);
+}
+
/// Sets the path for the local SSL private key.
///
/// \param path
@@ -505,6 +518,19 @@ void QXmppServer::setPrivateKey(const QString &path)
server->setPrivateKey(d->privateKey);
}
+/// Sets the local SSL private key.
+///
+/// \param key
+
+void QXmppServer::setPrivateKey(const QSslKey &key)
+{
+ d->privateKey = key;
+
+ // reconfigure servers
+ foreach (QXmppSslServer *server, d->serversForClients + d->serversForServers)
+ server->setPrivateKey(d->privateKey);
+}
+
/// Listen for incoming XMPP client connections.
///
/// \param address
diff --git a/src/server/QXmppServer.h b/src/server/QXmppServer.h
index 37744756..f6866f92 100644
--- a/src/server/QXmppServer.h
+++ b/src/server/QXmppServer.h
@@ -81,7 +81,9 @@ public:
void addCaCertificates(const QString &caCertificates);
void setLocalCertificate(const QString &path);
+ void setLocalCertificate(const QSslCertificate &certificate);
void setPrivateKey(const QString &path);
+ void setPrivateKey(const QSslKey &key);
void close();
bool listenForClients(const QHostAddress &address = QHostAddress::Any, quint16 port = 5222);