diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-07 14:58:23 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-07 18:04:57 (GMT) |
commit | e2f2e48f6e01739ccaa763ff7f037306131d4e61 (patch) | |
tree | 92fefe8ff9255356d849d1eadcad45666bde52e5 /Swiften/Session | |
parent | 832d109bfabc16ef2834790743c1d235b254d781 (diff) | |
download | swift-contrib-e2f2e48f6e01739ccaa763ff7f037306131d4e61.zip swift-contrib-e2f2e48f6e01739ccaa763ff7f037306131d4e61.tar.bz2 |
Added security error handling to Swiften.
Diffstat (limited to 'Swiften/Session')
-rw-r--r-- | Swiften/Session/BasicSessionStream.cpp | 9 | ||||
-rw-r--r-- | Swiften/Session/BasicSessionStream.h | 2 | ||||
-rw-r--r-- | Swiften/Session/SessionStream.h | 5 |
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; |