summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL/WinRTEngine.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-11-07 12:01:27 +0100
committerJose <jose@zeroc.com>2016-11-07 12:01:27 +0100
commit2c9a7b1d54dc95c1b6307643e6fbfc89dc02607e (patch)
tree211cf29b239a4c874f838c9777b7d610c8306c67 /cpp/src/IceSSL/WinRTEngine.cpp
parentRevert "Replaced double and triple underscores in C++ by ice-prefixed names" (diff)
downloadice-2c9a7b1d54dc95c1b6307643e6fbfc89dc02607e.tar.bz2
ice-2c9a7b1d54dc95c1b6307643e6fbfc89dc02607e.tar.xz
ice-2c9a7b1d54dc95c1b6307643e6fbfc89dc02607e.zip
UWP ssl improvements
Diffstat (limited to 'cpp/src/IceSSL/WinRTEngine.cpp')
-rwxr-xr-xcpp/src/IceSSL/WinRTEngine.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/cpp/src/IceSSL/WinRTEngine.cpp b/cpp/src/IceSSL/WinRTEngine.cpp
index a6dc675c581..651fd2ace53 100755
--- a/cpp/src/IceSSL/WinRTEngine.cpp
+++ b/cpp/src/IceSSL/WinRTEngine.cpp
@@ -12,26 +12,59 @@
#ifdef ICE_OS_WINRT
#include <IceSSL/SSLEngine.h>
+#include <Ice/Communicator.h>
+#include <Ice/Properties.h>
#include <IceUtil/Shared.h>
+#include <string>
+
IceUtil::Shared* IceSSL::upCast(IceSSL::WinRTEngine* p) { return p; }
+using namespace std;
using namespace IceSSL;
WinRTEngine::WinRTEngine(const Ice::CommunicatorPtr& communicator) : SSLEngine(communicator)
{
-
}
void
WinRTEngine::initialize()
{
+ lock_guard<mutex> lock(_mutex);
+ if(_initialized)
+ {
+ return;
+ }
+
+ SSLEngine::initialize();
+
+ const auto properties = communicator()->getProperties();
+
+ //
+ // Load client certificate
+ //
+ string findCert = properties->getProperty("IceSSL.FindCert");
+ if(!findCert.empty())
+ {
+ auto certs = findCertificates(properties->getPropertyWithDefault("IceSSL.CertStore", "My"), findCert);
+ if(certs->Size > 0)
+ {
+ _certificate = make_shared<IceSSL::Certificate>(certs->GetAt(0));
+ }
+ }
+ _initialized = true;
}
bool
WinRTEngine::initialized() const
{
- return true;
+ return _initialized;
+}
+
+shared_ptr<Certificate>
+WinRTEngine::certificate()
+{
+ return _certificate;
}
void