summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp9
-rw-r--r--Swiften/Session/BasicSessionStream.h2
-rw-r--r--Swiften/Session/SessionStream.h5
3 files changed, 16 insertions, 0 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index a4b1c84..65a241c 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -85,6 +85,15 @@ bool BasicSessionStream::isTLSEncrypted() {
return tlsLayer;
}
+Certificate::ref BasicSessionStream::getPeerCertificate() const {
+ return tlsLayer->getPeerCertificate();
+}
+
+boost::optional<CertificateVerificationError> BasicSessionStream::getPeerCertificateVerificationError() const {
+ return tlsLayer->getPeerCertificateVerificationError();
+}
+
+
void BasicSessionStream::addZLibCompression() {
boost::shared_ptr<CompressionLayer> compressionLayer(new CompressionLayer());
streamStack->addLayer(compressionLayer);
diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h
index 22620be..8addeb6 100644
--- a/Swiften/Session/BasicSessionStream.h
+++ b/Swiften/Session/BasicSessionStream.h
@@ -52,6 +52,8 @@ namespace Swift {
virtual bool supportsTLSEncryption();
virtual void addTLSEncryption();
virtual bool isTLSEncrypted();
+ virtual Certificate::ref getPeerCertificate() const;
+ virtual boost::optional<CertificateVerificationError> getPeerCertificateVerificationError() const;
virtual void setWhitespacePingEnabled(bool);
diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h
index b2bf9a6..1bf9090 100644
--- a/Swiften/Session/SessionStream.h
+++ b/Swiften/Session/SessionStream.h
@@ -8,11 +8,14 @@
#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/Elements/Element.h"
#include "Swiften/Base/Error.h"
#include "Swiften/TLS/PKCS12Certificate.h"
+#include "Swiften/TLS/Certificate.h"
+#include "Swiften/TLS/CertificateVerificationError.h"
namespace Swift {
class SessionStream {
@@ -57,6 +60,8 @@ namespace Swift {
return !certificate.isNull();
}
+ virtual Certificate::ref getPeerCertificate() const = 0;
+ virtual boost::optional<CertificateVerificationError> getPeerCertificateVerificationError() const = 0;
boost::signal<void (const ProtocolHeader&)> onStreamStartReceived;
boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;