diff options
Diffstat (limited to 'Swiften/TLS')
25 files changed, 83 insertions, 86 deletions
| diff --git a/Swiften/TLS/BlindCertificateTrustChecker.h b/Swiften/TLS/BlindCertificateTrustChecker.h index d9db14c..3177322 100644 --- a/Swiften/TLS/BlindCertificateTrustChecker.h +++ b/Swiften/TLS/BlindCertificateTrustChecker.h @@ -6,7 +6,7 @@  #pragma once -#include "Swiften/TLS/CertificateTrustChecker.h" +#include <Swiften/TLS/CertificateTrustChecker.h>  namespace Swift {  	/** diff --git a/Swiften/TLS/Certificate.cpp b/Swiften/TLS/Certificate.cpp index ecd7d5e..a796463 100644 --- a/Swiften/TLS/Certificate.cpp +++ b/Swiften/TLS/Certificate.cpp @@ -22,7 +22,7 @@ Certificate::~Certificate() {  std::string Certificate::getSHA1Fingerprint() const {  	ByteArray hash = SHA1::getHash(toDER());  	std::ostringstream s; -	for (size_t i = 0; i < hash.getSize(); ++i) { +	for (size_t i = 0; i < hash.size(); ++i) {  		if (i > 0) {  			s << ":";  		} diff --git a/Swiften/TLS/Certificate.h b/Swiften/TLS/Certificate.h index dc93a2d..ec59a39 100644 --- a/Swiften/TLS/Certificate.h +++ b/Swiften/TLS/Certificate.h @@ -9,7 +9,7 @@  #include <boost/shared_ptr.hpp>  #include <string> -#include "Swiften/Base/ByteArray.h" +#include <Swiften/Base/ByteArray.h>  namespace Swift {  	class Certificate { diff --git a/Swiften/TLS/CertificateFactory.cpp b/Swiften/TLS/CertificateFactory.cpp index b2edaf4..df01090 100644 --- a/Swiften/TLS/CertificateFactory.cpp +++ b/Swiften/TLS/CertificateFactory.cpp @@ -4,7 +4,7 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/CertificateFactory.h" +#include <Swiften/TLS/CertificateFactory.h>  namespace Swift { diff --git a/Swiften/TLS/CertificateFactory.h b/Swiften/TLS/CertificateFactory.h index 90eca58..3e94082 100644 --- a/Swiften/TLS/CertificateFactory.h +++ b/Swiften/TLS/CertificateFactory.h @@ -6,7 +6,7 @@  #pragma once -#include "Swiften/TLS/Certificate.h" +#include <Swiften/TLS/Certificate.h>  namespace Swift {  	class CertificateFactory { diff --git a/Swiften/TLS/CertificateTrustChecker.cpp b/Swiften/TLS/CertificateTrustChecker.cpp index f4f921d..42e24a1 100644 --- a/Swiften/TLS/CertificateTrustChecker.cpp +++ b/Swiften/TLS/CertificateTrustChecker.cpp @@ -4,7 +4,7 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/CertificateTrustChecker.h" +#include <Swiften/TLS/CertificateTrustChecker.h>  namespace Swift { diff --git a/Swiften/TLS/CertificateTrustChecker.h b/Swiften/TLS/CertificateTrustChecker.h index aec03e3..06c0c32 100644 --- a/Swiften/TLS/CertificateTrustChecker.h +++ b/Swiften/TLS/CertificateTrustChecker.h @@ -9,7 +9,7 @@  #include <boost/shared_ptr.hpp>  #include <string> -#include "Swiften/TLS/Certificate.h" +#include <Swiften/TLS/Certificate.h>  namespace Swift {  	/** diff --git a/Swiften/TLS/CertificateVerificationError.h b/Swiften/TLS/CertificateVerificationError.h index 554fd3b..2815fdb 100644 --- a/Swiften/TLS/CertificateVerificationError.h +++ b/Swiften/TLS/CertificateVerificationError.h @@ -6,7 +6,7 @@  #pragma once -#include "Swiften/Base/Error.h" +#include <Swiften/Base/Error.h>  namespace Swift {  	class CertificateVerificationError : public Error { diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp index 0b2df5b..06ce360 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp @@ -23,11 +23,11 @@ OpenSSLCertificate::OpenSSLCertificate(boost::shared_ptr<X509> cert) : cert(cert  OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) {  #if OPENSSL_VERSION_NUMBER <= 0x009070cfL -	unsigned char* p = const_cast<unsigned char*>(der.getData()); +	unsigned char* p = const_cast<unsigned char*>(vecptr(der));  #else -	const unsigned char* p = der.getData(); +	const unsigned char* p = vecptr(der);  #endif -	cert = boost::shared_ptr<X509>(d2i_X509(NULL, &p, der.getSize()), X509_free); +	cert = boost::shared_ptr<X509>(d2i_X509(NULL, &p, der.size()), X509_free);  	if (!cert) {  		SWIFT_LOG(warning) << "Error creating certificate from DER data" << std::endl;  	} @@ -41,7 +41,7 @@ ByteArray OpenSSLCertificate::toDER() const {  	ByteArray result;  	result.resize(i2d_X509(cert.get(), NULL)); -	unsigned char* p = reinterpret_cast<unsigned char*>(result.getData()); +	unsigned char* p = vecptr(result);  	i2d_X509(cert.get(), &p);  	return result;  } @@ -57,15 +57,15 @@ void OpenSSLCertificate::parse() {  		// Subject name  		ByteArray subjectNameData;  		subjectNameData.resize(256); -		X509_NAME_oneline(X509_get_subject_name(cert.get()), reinterpret_cast<char*>(subjectNameData.getData()), subjectNameData.getSize()); -		this->subjectName = std::string(reinterpret_cast<const char*>(subjectNameData.getData())); +		X509_NAME_oneline(X509_get_subject_name(cert.get()), reinterpret_cast<char*>(vecptr(subjectNameData)), subjectNameData.size()); +		this->subjectName = byteArrayToString(subjectNameData);  		// Common name  		int cnLoc = X509_NAME_get_index_by_NID(subjectName, NID_commonName, -1);  		while (cnLoc != -1) {  			X509_NAME_ENTRY* cnEntry = X509_NAME_get_entry(subjectName, cnLoc);  			ASN1_STRING* cnData = X509_NAME_ENTRY_get_data(cnEntry); -			commonNames.push_back(ByteArray(cnData->data, cnData->length).toString()); +			commonNames.push_back(byteArrayToString(createByteArray(reinterpret_cast<const char*>(cnData->data), cnData->length)));  			cnLoc = X509_NAME_get_index_by_NID(subjectName, NID_commonName, cnLoc);  		}  	} @@ -87,7 +87,7 @@ void OpenSSLCertificate::parse() {  						continue;  					}  					ASN1_UTF8STRING* xmppAddrValue = otherName->value->value.utf8string; -					addXMPPAddress(ByteArray(ASN1_STRING_data(xmppAddrValue), ASN1_STRING_length(xmppAddrValue)).toString()); +					addXMPPAddress(byteArrayToString(createByteArray(reinterpret_cast<const char*>(ASN1_STRING_data(xmppAddrValue)), ASN1_STRING_length(xmppAddrValue))));  				}  				else if (OBJ_cmp(otherName->type_id, dnsSRVObject.get()) == 0) {  					// SRVName @@ -95,12 +95,12 @@ void OpenSSLCertificate::parse() {  						continue;  					}  					ASN1_IA5STRING* srvNameValue = otherName->value->value.ia5string; -					addSRVName(ByteArray(ASN1_STRING_data(srvNameValue), ASN1_STRING_length(srvNameValue)).toString()); +					addSRVName(byteArrayToString(createByteArray(reinterpret_cast<const char*>(ASN1_STRING_data(srvNameValue)), ASN1_STRING_length(srvNameValue))));  				}  			}  			else if (generalName->type == GEN_DNS) {  				// DNSName -				addDNSName(ByteArray(ASN1_STRING_data(generalName->d.dNSName), ASN1_STRING_length(generalName->d.dNSName)).toString()); +				addDNSName(byteArrayToString(createByteArray(ASN1_STRING_data(generalName->d.dNSName), ASN1_STRING_length(generalName->d.dNSName))));  			}  		}  	} diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.h b/Swiften/TLS/OpenSSL/OpenSSLCertificate.h index b900170..897b432 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.h +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.h @@ -10,7 +10,7 @@  #include <openssl/ssl.h>  #include <string> -#include "Swiften/TLS/Certificate.h" +#include <Swiften/TLS/Certificate.h>  namespace Swift {  	class OpenSSLCertificate : public Certificate { diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h b/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h index cd4982e..52f134c 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h @@ -6,8 +6,8 @@  #pragma once -#include "Swiften/TLS/CertificateFactory.h" -#include "Swiften/TLS/OpenSSL/OpenSSLCertificate.h" +#include <Swiften/TLS/CertificateFactory.h> +#include <Swiften/TLS/OpenSSL/OpenSSLCertificate.h>  namespace Swift {  	class OpenSSLCertificateFactory : public CertificateFactory { diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index 378b6aa..220e7f9 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp @@ -3,7 +3,7 @@   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/Base/Platform.h" +#include <Swiften/Base/Platform.h>  #ifdef SWIFTEN_PLATFORM_WINDOWS  #include <windows.h> @@ -13,14 +13,15 @@  #include <vector>  #include <openssl/err.h>  #include <openssl/pkcs12.h> +#include <boost/smart_ptr/make_shared.hpp>  #if defined(SWIFTEN_PLATFORM_MACOSX) && OPENSSL_VERSION_NUMBER < 0x00908000  #include <Security/Security.h>  #endif -#include "Swiften/TLS/OpenSSL/OpenSSLContext.h" -#include "Swiften/TLS/OpenSSL/OpenSSLCertificate.h" -#include "Swiften/TLS/PKCS12Certificate.h" +#include <Swiften/TLS/OpenSSL/OpenSSLContext.h> +#include <Swiften/TLS/OpenSSL/OpenSSLCertificate.h> +#include <Swiften/TLS/PKCS12Certificate.h>  #pragma GCC diagnostic ignored "-Wold-style-cast" @@ -48,8 +49,7 @@ OpenSSLContext::OpenSSLContext() : state_(Start), context_(0), handle_(0), readB  			if (!certContext) {  				break;  			} -			ByteArray certData(certContext->pbCertEncoded, certContext->cbCertEncoded); -			OpenSSLCertificate cert(certData); +			OpenSSLCertificate cert(createByteArray(certContext->pbCertEncoded, certContext->cbCertEncoded));  			if (store && cert.getInternalX509()) {  				X509_STORE_add_cert(store, cert.getInternalX509().get());  			} @@ -138,15 +138,15 @@ void OpenSSLContext::doConnect() {  void OpenSSLContext::sendPendingDataToNetwork() {  	int size = BIO_pending(writeBIO_);  	if (size > 0) { -		ByteArray data; +		SafeByteArray data;  		data.resize(size); -		BIO_read(writeBIO_, data.getData(), size); +		BIO_read(writeBIO_, vecptr(data), size);  		onDataForNetwork(data);  	}  } -void OpenSSLContext::handleDataFromNetwork(const ByteArray& data) { -	BIO_write(readBIO_, data.getData(), data.getSize()); +void OpenSSLContext::handleDataFromNetwork(const SafeByteArray& data) { +	BIO_write(readBIO_, vecptr(data), data.size());  	switch (state_) {  		case Connecting:  			doConnect(); @@ -159,8 +159,8 @@ void OpenSSLContext::handleDataFromNetwork(const ByteArray& data) {  	}  } -void OpenSSLContext::handleDataFromApplication(const ByteArray& data) { -	if (SSL_write(handle_, data.getData(), data.getSize()) >= 0) { +void OpenSSLContext::handleDataFromApplication(const SafeByteArray& data) { +	if (SSL_write(handle_, vecptr(data), data.size()) >= 0) {  		sendPendingDataToNetwork();  	}  	else { @@ -170,14 +170,14 @@ void OpenSSLContext::handleDataFromApplication(const ByteArray& data) {  }  void OpenSSLContext::sendPendingDataToApplication() { -	ByteArray data; +	SafeByteArray data;  	data.resize(SSL_READ_BUFFERSIZE); -	int ret = SSL_read(handle_, data.getData(), data.getSize()); +	int ret = SSL_read(handle_, vecptr(data), data.size());  	while (ret > 0) {  		data.resize(ret);  		onDataForApplication(data);  		data.resize(SSL_READ_BUFFERSIZE); -		ret = SSL_read(handle_, data.getData(), data.getSize()); +		ret = SSL_read(handle_, vecptr(data), data.size());  	}  	if (ret < 0 && SSL_get_error(handle_, ret) != SSL_ERROR_WANT_READ) {  		state_ = Error; @@ -192,7 +192,7 @@ bool OpenSSLContext::setClientCertificate(const PKCS12Certificate& certificate)  	// Create a PKCS12 structure  	BIO* bio = BIO_new(BIO_s_mem()); -	BIO_write(bio, certificate.getData().getData(), certificate.getData().getSize()); +	BIO_write(bio, vecptr(certificate.getData()), certificate.getData().size());  	boost::shared_ptr<PKCS12> pkcs12(d2i_PKCS12_bio(bio, NULL), PKCS12_free);  	BIO_free(bio);  	if (!pkcs12) { @@ -203,7 +203,7 @@ bool OpenSSLContext::setClientCertificate(const PKCS12Certificate& certificate)  	X509 *certPtr = 0;  	EVP_PKEY* privateKeyPtr = 0;  	STACK_OF(X509)* caCertsPtr = 0; -	int result = PKCS12_parse(pkcs12.get(), certificate.getPassword().c_str(), &privateKeyPtr, &certPtr, &caCertsPtr); +	int result = PKCS12_parse(pkcs12.get(), reinterpret_cast<const char*>(vecptr(certificate.getPassword())), &privateKeyPtr, &certPtr, &caCertsPtr);  	if (result != 1) {   		return false;  	} @@ -227,7 +227,7 @@ bool OpenSSLContext::setClientCertificate(const PKCS12Certificate& certificate)  Certificate::ref OpenSSLContext::getPeerCertificate() const {  	boost::shared_ptr<X509> x509Cert(SSL_get_peer_certificate(handle_), X509_free);  	if (x509Cert) { -		return Certificate::ref(new OpenSSLCertificate(x509Cert)); +		return boost::make_shared<OpenSSLCertificate>(x509Cert);  	}  	else {  		return Certificate::ref(); @@ -237,7 +237,7 @@ Certificate::ref OpenSSLContext::getPeerCertificate() const {  boost::shared_ptr<CertificateVerificationError> OpenSSLContext::getPeerCertificateVerificationError() const {  	int verifyResult = SSL_get_verify_result(handle_);  	if (verifyResult != X509_V_OK) { -		return boost::shared_ptr<CertificateVerificationError>(new CertificateVerificationError(getVerificationErrorTypeForResult(verifyResult))); +		return boost::make_shared<CertificateVerificationError>(getVerificationErrorTypeForResult(verifyResult));  	}  	else {  		return boost::shared_ptr<CertificateVerificationError>(); @@ -247,7 +247,7 @@ boost::shared_ptr<CertificateVerificationError> OpenSSLContext::getPeerCertifica  ByteArray OpenSSLContext::getFinishMessage() const {  	ByteArray data;  	data.resize(MAX_FINISHED_SIZE); -	size_t size = SSL_get_finished(handle_, data.getData(), data.getSize()); +	size_t size = SSL_get_finished(handle_, vecptr(data), data.size());  	data.resize(size);  	return data;  } diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.h b/Swiften/TLS/OpenSSL/OpenSSLContext.h index 40e5483..04693a3 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.h +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.h @@ -7,11 +7,11 @@  #pragma once  #include <openssl/ssl.h> -#include "Swiften/Base/boost_bsignals.h" +#include <Swiften/Base/boost_bsignals.h>  #include <boost/noncopyable.hpp> -#include "Swiften/TLS/TLSContext.h" -#include "Swiften/Base/ByteArray.h" +#include <Swiften/TLS/TLSContext.h> +#include <Swiften/Base/ByteArray.h>  namespace Swift {  	class PKCS12Certificate; @@ -24,8 +24,8 @@ namespace Swift {  			void connect();  			bool setClientCertificate(const PKCS12Certificate& cert); -			void handleDataFromNetwork(const ByteArray&); -			void handleDataFromApplication(const ByteArray&); +			void handleDataFromNetwork(const SafeByteArray&); +			void handleDataFromApplication(const SafeByteArray&);  			Certificate::ref getPeerCertificate() const;  			boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; diff --git a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp index f975df7..516482d 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp @@ -4,8 +4,8 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/OpenSSL/OpenSSLContextFactory.h" -#include "Swiften/TLS/OpenSSL/OpenSSLContext.h" +#include <Swiften/TLS/OpenSSL/OpenSSLContextFactory.h> +#include <Swiften/TLS/OpenSSL/OpenSSLContext.h>  namespace Swift { diff --git a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.h b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.h index cf982c0..4e39cd6 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.h +++ b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.h @@ -6,7 +6,7 @@  #pragma once -#include "Swiften/TLS/TLSContextFactory.h" +#include <Swiften/TLS/TLSContextFactory.h>  namespace Swift {  	class OpenSSLContextFactory : public TLSContextFactory { diff --git a/Swiften/TLS/PKCS12Certificate.h b/Swiften/TLS/PKCS12Certificate.h index 1c8c38f..c0e01d0 100644 --- a/Swiften/TLS/PKCS12Certificate.h +++ b/Swiften/TLS/PKCS12Certificate.h @@ -4,22 +4,21 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#ifndef SWIFTEN_PKCS12Certificate_H -#define SWIFTEN_PKCS12Certificate_H +#pragma once -#include "Swiften/Base/ByteArray.h" +#include <Swiften/Base/SafeByteArray.h>  namespace Swift {  	class PKCS12Certificate {  		public:  			PKCS12Certificate() {} -			PKCS12Certificate(const std::string& filename, const std::string& password) : password_(password) { -				data_.readFromFile(filename); +			PKCS12Certificate(const std::string& filename, const SafeByteArray& password) : password_(password) { +				readByteArrayFromFile(data_, filename);  			}  			bool isNull() const { -				return data_.isEmpty(); +				return data_.empty();  			}  			const ByteArray& getData() const { @@ -30,14 +29,12 @@ namespace Swift {  				data_ = data;  			} -			const std::string& getPassword() const { +			const SafeByteArray& getPassword() const {  				return password_;  			}  		private:  			ByteArray data_; -			std::string password_; +			SafeByteArray password_;  	};  } - -#endif diff --git a/Swiften/TLS/PlatformTLSFactories.cpp b/Swiften/TLS/PlatformTLSFactories.cpp index e642758..dec8788 100644 --- a/Swiften/TLS/PlatformTLSFactories.cpp +++ b/Swiften/TLS/PlatformTLSFactories.cpp @@ -4,14 +4,14 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/PlatformTLSFactories.h" +#include <Swiften/TLS/PlatformTLSFactories.h>  #include <cstring>  #include <cassert>  #ifdef HAVE_OPENSSL -#include "Swiften/TLS/OpenSSL/OpenSSLContextFactory.h" -#include "Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h" +#include <Swiften/TLS/OpenSSL/OpenSSLContextFactory.h> +#include <Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h>  #endif  namespace Swift { diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp index d7b0580..a908ad0 100644 --- a/Swiften/TLS/ServerIdentityVerifier.cpp +++ b/Swiften/TLS/ServerIdentityVerifier.cpp @@ -4,12 +4,12 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/ServerIdentityVerifier.h" +#include <Swiften/TLS/ServerIdentityVerifier.h>  #include <boost/algorithm/string.hpp> -#include "Swiften/Base/foreach.h" -#include "Swiften/IDN/IDNA.h" +#include <Swiften/Base/foreach.h> +#include <Swiften/IDN/IDNA.h>  namespace Swift { @@ -63,7 +63,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {  	return false;  } -bool ServerIdentityVerifier::matchesDomain(const std::string& s) { +bool ServerIdentityVerifier::matchesDomain(const std::string& s) const {  	if (boost::starts_with(s, "*.")) {  		std::string matchString(s.substr(2, s.npos));  		std::string matchDomain = encodedDomain; @@ -78,7 +78,7 @@ bool ServerIdentityVerifier::matchesDomain(const std::string& s) {  	}  } -bool ServerIdentityVerifier::matchesAddress(const std::string& s) { +bool ServerIdentityVerifier::matchesAddress(const std::string& s) const {  	return s == domain;  } diff --git a/Swiften/TLS/ServerIdentityVerifier.h b/Swiften/TLS/ServerIdentityVerifier.h index 05bb5f0..b09abd9 100644 --- a/Swiften/TLS/ServerIdentityVerifier.h +++ b/Swiften/TLS/ServerIdentityVerifier.h @@ -9,8 +9,8 @@  #include <boost/shared_ptr.hpp>  #include <string> -#include "Swiften/JID/JID.h" -#include "Swiften/TLS/Certificate.h" +#include <Swiften/JID/JID.h> +#include <Swiften/TLS/Certificate.h>  namespace Swift {  	class ServerIdentityVerifier { @@ -20,8 +20,8 @@ namespace Swift {  			bool certificateVerifies(Certificate::ref);  		private: -			bool matchesDomain(const std::string&); -			bool matchesAddress(const std::string&); +			bool matchesDomain(const std::string&) const ; +			bool matchesAddress(const std::string&) const;  		private:  			std::string domain; diff --git a/Swiften/TLS/SimpleCertificate.h b/Swiften/TLS/SimpleCertificate.h index a81a23e..4cf0cc2 100644 --- a/Swiften/TLS/SimpleCertificate.h +++ b/Swiften/TLS/SimpleCertificate.h @@ -7,7 +7,7 @@  #pragma once  #include <string> -#include "Swiften/TLS/Certificate.h" +#include <Swiften/TLS/Certificate.h>  namespace Swift {  	class SimpleCertificate : public Certificate { diff --git a/Swiften/TLS/TLSContext.cpp b/Swiften/TLS/TLSContext.cpp index 008bfc0..026ae70 100644 --- a/Swiften/TLS/TLSContext.cpp +++ b/Swiften/TLS/TLSContext.cpp @@ -4,7 +4,7 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/TLSContext.h" +#include <Swiften/TLS/TLSContext.h>  namespace Swift { diff --git a/Swiften/TLS/TLSContext.h b/Swiften/TLS/TLSContext.h index 1279eeb..1538863 100644 --- a/Swiften/TLS/TLSContext.h +++ b/Swiften/TLS/TLSContext.h @@ -6,12 +6,12 @@  #pragma once -#include "Swiften/Base/boost_bsignals.h" +#include <Swiften/Base/boost_bsignals.h>  #include <boost/shared_ptr.hpp> -#include "Swiften/Base/ByteArray.h" -#include "Swiften/TLS/Certificate.h" -#include "Swiften/TLS/CertificateVerificationError.h" +#include <Swiften/Base/SafeByteArray.h> +#include <Swiften/TLS/Certificate.h> +#include <Swiften/TLS/CertificateVerificationError.h>  namespace Swift {  	class PKCS12Certificate; @@ -24,8 +24,8 @@ namespace Swift {  			virtual bool setClientCertificate(const PKCS12Certificate& cert) = 0; -			virtual void handleDataFromNetwork(const ByteArray&) = 0; -			virtual void handleDataFromApplication(const ByteArray&) = 0; +			virtual void handleDataFromNetwork(const SafeByteArray&) = 0; +			virtual void handleDataFromApplication(const SafeByteArray&) = 0;  			virtual Certificate::ref getPeerCertificate() const = 0;  			virtual CertificateVerificationError::ref getPeerCertificateVerificationError() const = 0; @@ -33,8 +33,8 @@ namespace Swift {  			virtual ByteArray getFinishMessage() const = 0;  		public: -			boost::signal<void (const ByteArray&)> onDataForNetwork; -			boost::signal<void (const ByteArray&)> onDataForApplication; +			boost::signal<void (const SafeByteArray&)> onDataForNetwork; +			boost::signal<void (const SafeByteArray&)> onDataForApplication;  			boost::signal<void ()> onError;  			boost::signal<void ()> onConnected;  	}; diff --git a/Swiften/TLS/TLSContextFactory.cpp b/Swiften/TLS/TLSContextFactory.cpp index 47b529f..eb02f0c 100644 --- a/Swiften/TLS/TLSContextFactory.cpp +++ b/Swiften/TLS/TLSContextFactory.cpp @@ -4,7 +4,7 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/TLS/TLSContextFactory.h" +#include <Swiften/TLS/TLSContextFactory.h>  namespace Swift { diff --git a/Swiften/TLS/UnitTest/CertificateTest.cpp b/Swiften/TLS/UnitTest/CertificateTest.cpp index 216aaae..5df5639 100644 --- a/Swiften/TLS/UnitTest/CertificateTest.cpp +++ b/Swiften/TLS/UnitTest/CertificateTest.cpp @@ -23,7 +23,7 @@ class CertificateTest : public CppUnit::TestFixture {  	public:  		void testGetSHA1Fingerprint() {  			SimpleCertificate::ref testling = boost::make_shared<SimpleCertificate>(); -			testling->setDER(ByteArray("abcdefg")); +			testling->setDER(createByteArray("abcdefg"));  			CPPUNIT_ASSERT_EQUAL(std::string("2f:b5:e1:34:19:fc:89:24:68:65:e7:a3:24:f4:76:ec:62:4e:87:40"), testling->getSHA1Fingerprint());  		} diff --git a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp index 5234445..bd68c84 100644 --- a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp +++ b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp @@ -4,14 +4,14 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/Base/ByteArray.h" +#include <Swiften/Base/ByteArray.h>  #include <cppunit/extensions/HelperMacros.h>  #include <cppunit/extensions/TestFactoryRegistry.h>  #include <vector> -#include "Swiften/TLS/ServerIdentityVerifier.h" -#include "Swiften/TLS/SimpleCertificate.h" +#include <Swiften/TLS/ServerIdentityVerifier.h> +#include <Swiften/TLS/SimpleCertificate.h>  using namespace Swift; | 
 Swift
 Swift