summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-03 12:25:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-03 12:46:12 (GMT)
commit21fda3308975201eeebeacd98e2b587ef4448862 (patch)
treee8aebe473a636cf5a312814d4054d8af0d9ad6a6 /Swiften/TLS
parent10334c139670861d4860da59ad837fc3fe6fd41e (diff)
downloadswift-contrib-21fda3308975201eeebeacd98e2b587ef4448862.zip
swift-contrib-21fda3308975201eeebeacd98e2b587ef4448862.tar.bz2
Limit the use of the SafeString type.
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp2
-rw-r--r--Swiften/TLS/PKCS12Certificate.h8
2 files changed, 5 insertions, 5 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
index 8d3970e..220e7f9 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
@@ -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;
}
diff --git a/Swiften/TLS/PKCS12Certificate.h b/Swiften/TLS/PKCS12Certificate.h
index d4cb367..c0e01d0 100644
--- a/Swiften/TLS/PKCS12Certificate.h
+++ b/Swiften/TLS/PKCS12Certificate.h
@@ -6,14 +6,14 @@
#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) {
+ PKCS12Certificate(const std::string& filename, const SafeByteArray& password) : password_(password) {
readByteArrayFromFile(data_, filename);
}
@@ -29,12 +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_;
};
}