diff --git a/CredWrite/CredWrite.vcxproj b/CredWrite/CredWrite.vcxproj
index a95ec39..2771dc2 100644
--- a/CredWrite/CredWrite.vcxproj
+++ b/CredWrite/CredWrite.vcxproj
@@ -107,6 +107,9 @@
{36b0cf8a-7794-46c3-8099-825ba962b4c7}
+
+ {4d40cb8a-812e-4f12-b23a-31af743878e8}
+
{47399d91-7eb9-41de-b521-514ba5db0c43}
diff --git a/CredWrite/Main.cpp b/CredWrite/Main.cpp
index b764e1f..5a59a11 100644
--- a/CredWrite/Main.cpp
+++ b/CredWrite/Main.cpp
@@ -40,7 +40,7 @@ static int CredWrite()
return -1;
}
- eap::credentials_pap cred(g_module);
+ eap::credentials_pap cred_pap(g_module);
// Prepare identity (user name).
{
@@ -50,7 +50,7 @@ static int CredWrite()
bool is_last;
dec.decode(identity_utf8, is_last, pwcArglist[1], (size_t)-1);
- MultiByteToWideChar(CP_UTF8, 0, identity_utf8.data(), (int)identity_utf8.size(), cred.m_identity);
+ MultiByteToWideChar(CP_UTF8, 0, identity_utf8.data(), (int)identity_utf8.size(), cred_pap.m_identity);
}
// Prepare password.
@@ -61,7 +61,7 @@ static int CredWrite()
bool is_last;
dec.decode(password_utf8, is_last, pwcArglist[2], (size_t)-1);
- MultiByteToWideChar(CP_UTF8, 0, password_utf8.data(), (int)password_utf8.size(), cred.m_password);
+ MultiByteToWideChar(CP_UTF8, 0, password_utf8.data(), (int)password_utf8.size(), cred_pap.m_password);
}
// Generate target name (aka realm).
@@ -71,7 +71,7 @@ static int CredWrite()
target_name = pwcArglist[3];
} else {
// Get the realm from user name.
- LPCWSTR _identity = cred.m_identity.c_str(), domain;
+ LPCWSTR _identity = cred_pap.m_identity.c_str(), domain;
if ((domain = wcschr(_identity, L'@')) != NULL)
target_name = domain + 1;
else if ((domain = wcschr(_identity, L'\\')) != NULL)
@@ -94,7 +94,7 @@ static int CredWrite()
}
#endif
try {
- cred.store(target_name.c_str());
+ cred_pap.store(target_name.c_str());
} catch(win_runtime_error &err) {
OutputDebugStr(_T("%hs (error %u)\n"), err.what(), err.number());
return 2;
@@ -103,6 +103,18 @@ static int CredWrite()
return 2;
}
+ // Store empty TLS credentials.
+ eap::credentials_tls cred_tls(g_module);
+ try {
+ cred_tls.store(target_name.c_str());
+ } catch(win_runtime_error &err) {
+ OutputDebugStr(_T("%hs (error %u)\n"), err.what(), err.number());
+ return 3;
+ } catch(...) {
+ OutputDebugStr(_T("Writing credentials failed.\n"));
+ return 3;
+ }
+
return 0;
}
diff --git a/CredWrite/StdAfx.h b/CredWrite/StdAfx.h
index 6dbc3a3..6bfe629 100644
--- a/CredWrite/StdAfx.h
+++ b/CredWrite/StdAfx.h
@@ -20,8 +20,8 @@
#pragma once
-#include "../lib/PAP/include/Config.h"
#include "../lib/PAP/include/Credentials.h"
+#include "../lib/TLS/include/Credentials.h"
#include "../lib/EAPBase/include/Module.h"
#include