diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-07 12:31:41 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-07 14:18:04 (GMT) |
commit | 70d19e3b5d3757310caf32e1732cac2cd4ae0a63 (patch) | |
tree | db1e206fd1164d85c5e00b408e9dd5ed728a7ed6 /Swiften/StreamStack | |
parent | 647e2cc6fc6bc1764c1bf449b4110917f6c723df (diff) | |
download | swift-contrib-70d19e3b5d3757310caf32e1732cac2cd4ae0a63.zip swift-contrib-70d19e3b5d3757310caf32e1732cac2cd4ae0a63.tar.bz2 |
Added certificate verification API to TLS context.
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r-- | Swiften/StreamStack/TLSLayer.cpp | 8 | ||||
-rw-r--r-- | Swiften/StreamStack/TLSLayer.h | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/Swiften/StreamStack/TLSLayer.cpp b/Swiften/StreamStack/TLSLayer.cpp index 99154f6..dd6660f 100644 --- a/Swiften/StreamStack/TLSLayer.cpp +++ b/Swiften/StreamStack/TLSLayer.cpp @@ -38,4 +38,12 @@ bool TLSLayer::setClientCertificate(const PKCS12Certificate& certificate) { return context->setClientCertificate(certificate); } +Certificate::ref TLSLayer::getPeerCertificate() const { + return context->getPeerCertificate(); +} + +boost::optional<CertificateVerificationError> TLSLayer::getPeerCertificateVerificationError() const { + return context->getPeerCertificateVerificationError(); +} + } diff --git a/Swiften/StreamStack/TLSLayer.h b/Swiften/StreamStack/TLSLayer.h index f8cda41..6fb825f 100644 --- a/Swiften/StreamStack/TLSLayer.h +++ b/Swiften/StreamStack/TLSLayer.h @@ -8,6 +8,8 @@ #include "Swiften/Base/ByteArray.h" #include "Swiften/StreamStack/StreamLayer.h" +#include "Swiften/TLS/Certificate.h" +#include "Swiften/TLS/CertificateVerificationError.h" namespace Swift { class TLSContext; @@ -19,11 +21,14 @@ namespace Swift { TLSLayer(TLSContextFactory*); ~TLSLayer(); - virtual void connect(); - virtual bool setClientCertificate(const PKCS12Certificate&); + void connect(); + bool setClientCertificate(const PKCS12Certificate&); - virtual void writeData(const ByteArray& data); - virtual void handleDataRead(const ByteArray& data); + Certificate::ref getPeerCertificate() const; + boost::optional<CertificateVerificationError> getPeerCertificateVerificationError() const; + + void writeData(const ByteArray& data); + void handleDataRead(const ByteArray& data); public: boost::signal<void ()> onError; |