EAP modules divided to libraries
This commit is contained in:
1
EAPMethods/.gitignore
vendored
1
EAPMethods/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/doc
|
2312
EAPMethods/Doxyfile
2312
EAPMethods/Doxyfile
File diff suppressed because it is too large
Load Diff
2
EAPMethods/EAPMethodEvents/.gitignore
vendored
2
EAPMethods/EAPMethodEvents/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/temp
|
||||
/*.user
|
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="..\..\include\ResourceDLL.props" />
|
||||
<Import Project="..\build\Common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
<ItemGroup />
|
||||
</Project>
|
Binary file not shown.
@@ -1,104 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EAPMethodEvents</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\include\Win32.props" />
|
||||
<Import Project="..\..\include\Debug.props" />
|
||||
<Import Project="EAPMethodEvents.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\include\x64.props" />
|
||||
<Import Project="..\..\include\Debug.props" />
|
||||
<Import Project="EAPMethodEvents.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\include\Win32.props" />
|
||||
<Import Project="..\..\include\Release.props" />
|
||||
<Import Project="EAPMethodEvents.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\include\x64.props" />
|
||||
<Import Project="..\..\include\Release.props" />
|
||||
<Import Project="EAPMethodEvents.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\res\EAPMethodETW.man">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc.exe "%(Identity)" -u -b -e "h" -h "$(IntDir)." -r "$(IntDir)."</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc.exe "%(Identity)" -u -b -e "h" -h "$(IntDir)." -r "$(IntDir)."</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc.exe "%(Identity)" -u -b -e "h" -h "$(IntDir)." -r "$(IntDir)."</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc.exe "%(Identity)" -u -b -e "h" -h "$(IntDir)." -r "$(IntDir)."</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling manifest...</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling manifest...</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling manifest...</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling manifest...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)EAPMethodETW.h;$(IntDir)EAPMethodETW.rc;$(IntDir)EAPMethodETW_MSG00001.bin;$(IntDir)EAPMethodETWTEMP.BIN;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)EAPMethodETW.h;$(IntDir)EAPMethodETW.rc;$(IntDir)EAPMethodETW_MSG00001.bin;$(IntDir)EAPMethodETWTEMP.BIN;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)EAPMethodETW.h;$(IntDir)EAPMethodETW.rc;$(IntDir)EAPMethodETW_MSG00001.bin;$(IntDir)EAPMethodETWTEMP.BIN;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)EAPMethodETW.h;$(IntDir)EAPMethodETW.rc;$(IntDir)EAPMethodETW_MSG00001.bin;$(IntDir)EAPMethodETWTEMP.BIN;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EAPMethodEvents.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\res\EAPMethodETW.man">
|
||||
<Filter>Resource Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EAPMethodEvents.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Binary file not shown.
@@ -79,20 +79,10 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\EAP.h" />
|
||||
<ClInclude Include="..\include\EAPSerial.h" />
|
||||
<ClInclude Include="..\include\TLS.h" />
|
||||
<ClInclude Include="..\include\TTLS.h" />
|
||||
<ClInclude Include="..\include\EAPXML.h" />
|
||||
<ClInclude Include="..\include\PAP.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\EAP.cpp" />
|
||||
<ClCompile Include="..\src\TLS.cpp" />
|
||||
<ClCompile Include="..\src\TTLS.cpp" />
|
||||
<ClCompile Include="..\src\Main.cpp" />
|
||||
<ClCompile Include="..\src\PAP.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
@@ -104,12 +94,24 @@
|
||||
<ResourceCompile Include="EAPTTLS.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\lib\EAPBase\build\EAPBase.vcxproj">
|
||||
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TLS\build\TLS.vcxproj">
|
||||
<Project>{4d40cb8a-812e-4f12-b23a-31af743878e8}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TTLS\build\TTLS.vcxproj">
|
||||
<Project>{ee0ef0d9-a475-4038-8637-5754724f65b0}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\EAPMethodEvents\EAPMethodEvents.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\build\EAPMethod.def" />
|
||||
|
@@ -18,24 +18,6 @@
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TTLS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\PAP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAPXML.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TLS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAPSerial.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
@@ -44,18 +26,6 @@
|
||||
<ClCompile Include="..\src\Main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\PAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\EAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TLS.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TTLS.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EAPTTLS.rc">
|
||||
|
@@ -20,31 +20,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../include/Version.h"
|
||||
|
||||
#include "../include/EAP.h"
|
||||
#include "../include/EAPSerial.h"
|
||||
#include "../include/TLS.h"
|
||||
#include "../include/TTLS.h"
|
||||
#include "../include/EAPXML.h"
|
||||
#include "../include/PAP.h"
|
||||
|
||||
#include <WinStd/Base64.h>
|
||||
#include <WinStd/Cred.h>
|
||||
#include <WinStd/Crypt.h>
|
||||
#include <WinStd/ETW.h>
|
||||
#include <WinStd/Hex.h>
|
||||
#include <WinStd/Win.h>
|
||||
|
||||
#include <eaptypes.h>
|
||||
#include <eapmethodpeerapis.h>
|
||||
|
||||
#include <Commctrl.h>
|
||||
#include <Msi.h>
|
||||
#include <tchar.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include <EAPMethodETW.h>
|
||||
|
||||
#pragma comment(lib, "Crypt32.lib")
|
||||
#include "../../lib/TTLS/include/Module.h"
|
||||
#include "../../lib/TTLS/include/Session.h"
|
||||
|
Binary file not shown.
@@ -79,33 +79,10 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\EAP.h" />
|
||||
<ClInclude Include="..\include\EAPXML.h" />
|
||||
<ClInclude Include="..\include\EAP_UI.h" />
|
||||
<ClInclude Include="..\include\PAP_UI.h" />
|
||||
<ClInclude Include="..\include\TLS.h" />
|
||||
<ClInclude Include="..\include\TTLS.h" />
|
||||
<ClInclude Include="..\include\TTLS_UI.h" />
|
||||
<ClInclude Include="..\include\PAP.h" />
|
||||
<ClInclude Include="..\include\TLS_UI.h" />
|
||||
<ClInclude Include="..\res\wxEAP_UI.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="..\res\wxTLS_UI.h" />
|
||||
<ClInclude Include="..\res\wxTTLS_UI.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\res\wxEAP_UI.cpp" />
|
||||
<ClCompile Include="..\res\wxTLS_UI.cpp" />
|
||||
<ClCompile Include="..\res\wxTTLS_UI.cpp" />
|
||||
<ClCompile Include="..\src\EAP.cpp" />
|
||||
<ClCompile Include="..\src\PAP_UI.cpp" />
|
||||
<ClCompile Include="..\src\TLS.cpp" />
|
||||
<ClCompile Include="..\src\TTLS.cpp" />
|
||||
<ClCompile Include="..\src\TTLS_UI.cpp" />
|
||||
<ClCompile Include="..\src\Main_UI.cpp" />
|
||||
<ClCompile Include="..\src\PAP.cpp" />
|
||||
<ClCompile Include="..\src\EAP_UI.cpp" />
|
||||
<ClCompile Include="..\src\TLS_UI.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
@@ -117,18 +94,39 @@
|
||||
<ResourceCompile Include="EAPTTLSUI.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\lib\EAPBase\build\EAPBase.vcxproj">
|
||||
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\EAPBase_UI\build\EAPBase_UI.vcxproj">
|
||||
<Project>{d4b54856-be1f-4937-a8f7-495125be76be}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\PAP_UI\build\PAP_UI.vcxproj">
|
||||
<Project>{3d309c2e-64ab-4bc4-a16d-468571a2bc1a}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TLS\build\TLS.vcxproj">
|
||||
<Project>{4d40cb8a-812e-4f12-b23a-31af743878e8}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TLS_UI\build\TLS_UI.vcxproj">
|
||||
<Project>{9a25c261-8ade-4938-8393-e857ef0e37e9}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TTLS\build\TTLS.vcxproj">
|
||||
<Project>{ee0ef0d9-a475-4038-8637-5754724f65b0}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\TTLS_UI\build\TTLS_UI.vcxproj">
|
||||
<Project>{42f0f0f4-c928-4860-a4e4-94991c2c3d90}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\EAPMethodEvents\EAPMethodEvents.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\build\EAPMethodUI.def" />
|
||||
<None Include="..\res\wxEAP_UI.fbp" />
|
||||
<None Include="..\res\wxTLS_UI.fbp" />
|
||||
<None Include="..\res\wxTTLS_UI.fbp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@@ -13,97 +13,19 @@
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\wx">
|
||||
<UniqueIdentifier>{51f0404d-9280-4fcc-8138-5d1f815ce568}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\wx">
|
||||
<UniqueIdentifier>{9befee7a-5dff-41dd-b080-4e26ccb19a7f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files\wx">
|
||||
<UniqueIdentifier>{0ec1840b-101c-415a-91c6-2c7eb4530c15}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TTLS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\PAP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TLS_UI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TLS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\res\wxEAP_UI.h">
|
||||
<Filter>Header Files\wx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\res\wxTLS_UI.h">
|
||||
<Filter>Header Files\wx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\res\wxTTLS_UI.h">
|
||||
<Filter>Header Files\wx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAP_UI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TTLS_UI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAPXML.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\PAP_UI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\PAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\res\wxEAP_UI.cpp">
|
||||
<Filter>Source Files\wx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\res\wxTLS_UI.cpp">
|
||||
<Filter>Source Files\wx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\res\wxTTLS_UI.cpp">
|
||||
<Filter>Source Files\wx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\EAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\EAP_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TLS.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TLS_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TTLS.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\TTLS_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Main_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\PAP_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EAPTTLSUI.rc">
|
||||
@@ -114,14 +36,5 @@
|
||||
<None Include="..\build\EAPMethodUI.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="..\res\wxEAP_UI.fbp">
|
||||
<Filter>Resource Files\wx</Filter>
|
||||
</None>
|
||||
<None Include="..\res\wxTTLS_UI.fbp">
|
||||
<Filter>Resource Files\wx</Filter>
|
||||
</None>
|
||||
<None Include="..\res\wxTLS_UI.fbp">
|
||||
<Filter>Resource Files\wx</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -18,48 +18,6 @@
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../include/Version.h"
|
||||
|
||||
#include "../include/EAP.h"
|
||||
#include "../include/EAP_UI.h"
|
||||
#include "../include/EAPSerial.h"
|
||||
#include "../include/EAPXML.h"
|
||||
#include "../include/TLS.h"
|
||||
#include "../include/TLS_UI.h"
|
||||
#include "../include/TTLS.h"
|
||||
#include "../include/TTLS_UI.h"
|
||||
#include "../include/PAP.h"
|
||||
#include "../include/PAP_UI.h"
|
||||
|
||||
#include "../res/wxTLS_UI.h"
|
||||
#include "../res/wxTTLS_UI.h"
|
||||
|
||||
#include <WinStd/Base64.h>
|
||||
#include <WinStd/Cred.h>
|
||||
#include <WinStd/Crypt.h>
|
||||
#include <WinStd/ETW.h>
|
||||
#include <WinStd/Hex.h>
|
||||
#include <WinStd/Win.h>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/init.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include <eaptypes.h>
|
||||
#include <eapmethodpeerapis.h>
|
||||
|
||||
#include <Commctrl.h>
|
||||
#include <cryptuiapi.h>
|
||||
#include <Msi.h>
|
||||
#include <tchar.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include <EAPMethodETW.h>
|
||||
|
||||
#pragma comment(lib, "Crypt32.lib")
|
||||
#include "../../lib/TTLS_UI/include/Module.h"
|
||||
|
Binary file not shown.
@@ -8,11 +8,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);..\EAPMethodEvents\temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);..\..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
@@ -1,370 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <WinStd/Crypt.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
template <class T> inline void pack(_Inout_ unsigned char *&cursor, _In_ const T &val);
|
||||
template <class T> inline size_t get_pk_size(_In_ const T &val);
|
||||
template <class T> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ T &val);
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax> inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||
template<class _Elem, class _Traits, class _Ax> inline size_t get_pk_size(const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||
template<class _Elem, class _Traits, class _Ax> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||
|
||||
template<class _Traits, class _Ax> inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||
template<class _Traits, class _Ax> inline size_t get_pk_size(const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||
template<class _Traits, class _Ax> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||
|
||||
template<class _Ty, class _Ax> inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::vector<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline size_t get_pk_size(const std::vector<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::vector<_Ty, _Ax> &val);
|
||||
|
||||
template<class _Ty, class _Ax> inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::list<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline size_t get_pk_size(const std::list<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::list<_Ty, _Ax> &val);
|
||||
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const winstd::cert_context &val);
|
||||
inline size_t get_pk_size(const winstd::cert_context &val);
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ winstd::cert_context &val);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a primitive data
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Variable with data to pack
|
||||
///
|
||||
template <class T>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const T &val)
|
||||
{
|
||||
memcpy(cursor, &val, sizeof(T));
|
||||
cursor += sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a primitive data
|
||||
///
|
||||
/// \param[in] val Data to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template <class T>
|
||||
inline size_t get_pk_size(_In_ const T &val)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(val);
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a primitive data
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Variable to receive unpacked value
|
||||
///
|
||||
template <class T>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ T &val)
|
||||
{
|
||||
memcpy(&val, cursor, sizeof(T));
|
||||
cursor += sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a string
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val String to pack
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length();
|
||||
*(std::basic_string<_Elem, _Traits, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type);
|
||||
|
||||
size_t nSize = sizeof(_Elem)*count;
|
||||
memcpy(cursor, (const _Elem*)val.c_str(), nSize);
|
||||
cursor += nSize;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a string
|
||||
///
|
||||
/// \param[in] val String to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline size_t get_pk_size(const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type) + sizeof(_Elem)*val.length();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a string
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val String to unpack to
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
std::basic_string<_Elem, _Traits, _Ax>::size_type count = *(const std::basic_string<_Elem, _Traits, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type);
|
||||
|
||||
val.assign((const _Elem*&)cursor, count);
|
||||
cursor += sizeof(_Elem)*count;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a wide string
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val String to pack
|
||||
///
|
||||
template<class _Traits, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
std::string val_utf8;
|
||||
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL);
|
||||
pack(cursor, val_utf8);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a wide string
|
||||
///
|
||||
/// \param[in] val String to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Traits, class _Ax>
|
||||
inline size_t get_pk_size(const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(std::string::size_type) + sizeof(char)*WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a wide string
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val String to unpack to
|
||||
///
|
||||
template<class _Traits, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
std::string val_utf8;
|
||||
unpack(cursor, val_utf8);
|
||||
MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a vector
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Vector to pack
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
std::vector<_Ty, _Ax>::size_type count = val.size();
|
||||
*(std::vector<_Ty, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
|
||||
// Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy.
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++)
|
||||
pack(cursor, val[i]);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a vector
|
||||
///
|
||||
/// \param[in] val Vector to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t get_pk_size(const std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
// Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
size_t size = sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
for (std::vector<_Ty, _Ax>::size_type i = 0, count = val.size(); i < count; i++)
|
||||
size += get_pk_size(val[i]);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a vector
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Vector to unpack to
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
std::vector<_Ty, _Ax>::size_type count = *(const std::vector<_Ty, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
|
||||
// Since we do not know wheter vector elements are primitives or objects, iterate instead of assign().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
val.clear();
|
||||
val.reserve(count);
|
||||
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) {
|
||||
_Ty el;
|
||||
unpack(cursor, el);
|
||||
val.push_back(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a list
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val List to pack
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
std::list<_Ty, _Ax>::size_type count = val.size();
|
||||
*(std::list<_Ty, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
|
||||
// Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy.
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
|
||||
pack(cursor, *i);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a list
|
||||
///
|
||||
/// \param[in] val List to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t get_pk_size(const std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
// Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
size_t size = sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
|
||||
size += get_pk_size(*i);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a list
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val List to unpack to
|
||||
///
|
||||
template<class _Ty, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
std::list<_Ty, _Ax>::size_type count = *(const std::list<_Ty, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
|
||||
// Since we do not know wheter list elements are primitives or objects, iterate instead of assign().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
val.clear();
|
||||
for (std::list<_Ty, _Ax>::size_type i = 0; i < count; i++) {
|
||||
_Ty el;
|
||||
unpack(cursor, el);
|
||||
val.push_back(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a certificate context
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Certificate context to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const winstd::cert_context &val)
|
||||
{
|
||||
*(DWORD*&)cursor = val->dwCertEncodingType;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
*(DWORD*&)cursor = val->cbCertEncoded;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
memcpy(cursor, val->pbCertEncoded, val->cbCertEncoded);
|
||||
cursor += val->cbCertEncoded;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a certificate context
|
||||
///
|
||||
/// \param[in] val Certificate context to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const winstd::cert_context &val)
|
||||
{
|
||||
return sizeof(DWORD) + sizeof(DWORD) + val->cbCertEncoded;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a certificate context
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Certificate context to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ winstd::cert_context &val)
|
||||
{
|
||||
DWORD dwCertEncodingType = *(DWORD*&)cursor;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
DWORD dwCertEncodedSize = *(DWORD*&)cursor;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
val.create(dwCertEncodingType, (BYTE*)cursor, dwCertEncodedSize);
|
||||
cursor += dwCertEncodedSize;
|
||||
}
|
||||
}
|
@@ -1,384 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <WinStd/Base64.h>
|
||||
#include <WinStd/COM.h>
|
||||
#include <WinStd/Hex.h>
|
||||
#include <assert.h>
|
||||
#include <MsXml.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace eapxml
|
||||
{
|
||||
inline DWORD get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc);
|
||||
inline DWORD select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode);
|
||||
inline DWORD select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes);
|
||||
inline DWORD select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode);
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue);
|
||||
template<class _Traits, class _Ax> inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue);
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue);
|
||||
template<class _Ty, class _Ax> inline DWORD get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
template<class _Ty, class _Ax> inline DWORD get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue);
|
||||
template<class _Traits, class _Ax> inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||
inline DWORD put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue);
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue);
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue);
|
||||
inline DWORD put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
inline DWORD put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eapxml
|
||||
{
|
||||
inline DWORD get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc)
|
||||
{
|
||||
assert(pXmlNode);
|
||||
assert(ppXmlDoc);
|
||||
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMDocument> doc;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlNode->get_ownerDocument(&doc)) &&
|
||||
SUCCEEDED(hr = doc.query_interface(ppXmlDoc)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode)
|
||||
{
|
||||
assert(pXmlParent);
|
||||
assert(ppXmlNode);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlParent->selectSingleNode(bstrNodeName, ppXmlNode)) ?
|
||||
*ppXmlNode ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes)
|
||||
{
|
||||
assert(pXmlParent);
|
||||
assert(ppXmlNodes);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlParent->selectNodes(bstrNodeName, ppXmlNodes)) ?
|
||||
*ppXmlNodes ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(ppXmlElement);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlNode;
|
||||
|
||||
return
|
||||
(dwResult = select_node(pXmlParent, bstrElementName, &pXmlNode)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||
*ppXmlElement ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(ppXmlElement);
|
||||
|
||||
static const winstd::variant varNodeTypeEl(NODE_ELEMENT);
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlNode;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlNode)) ?
|
||||
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||
*ppXmlElement ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(pXmlParent);
|
||||
assert(ppXmlElement);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
|
||||
return
|
||||
(dwResult = select_element(pXmlParent, bstrElementNameSelect, ppXmlElement)) == ERROR_SUCCESS ? ERROR_SUCCESS :
|
||||
(dwResult = create_element(pDoc, bstrElementNameCreate, bstrNamespace, ppXmlElement)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = pXmlParent->appendChild(*ppXmlElement, NULL)) ? ERROR_SUCCESS : HRESULT_CODE(hr) : dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode)
|
||||
{
|
||||
assert(pXmlNode);
|
||||
|
||||
winstd::com_obj<IXMLDOMNode> pXmlNodeParent;
|
||||
|
||||
return SUCCEEDED(pXmlNode->get_parentNode(&pXmlNodeParent)) && pXmlNodeParent;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue)
|
||||
{
|
||||
assert(pbstrValue);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMElement> pXmlElement;
|
||||
|
||||
return
|
||||
(dwResult = select_element(pXmlParent, bstrElementName, &pXmlElement)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ?
|
||||
*pbstrValue ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : dwResult;
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
sValue.assign(bstr, bstr.length());
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue)
|
||||
{
|
||||
assert(pdwValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
*pdwValue = wcstoul(bstr, NULL, 10);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue)
|
||||
{
|
||||
assert(pbValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"true" , -1, NULL, NULL, 0) == CSTR_EQUAL ||
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"1" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||
*pbValue = true;
|
||||
else if (
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"false", -1, NULL, NULL, 0) == CSTR_EQUAL ||
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"0" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||
*pbValue = false;
|
||||
else
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline DWORD get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
winstd::base64_dec dec;
|
||||
bool is_last;
|
||||
dec.decode(aValue, is_last, (BSTR)bstr, bstr.length());
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline DWORD get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
winstd::hex_dec dec;
|
||||
bool is_last;
|
||||
dec.decode(aValue, is_last, (BSTR)bstr, bstr.length());
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue)
|
||||
{
|
||||
assert(pbstrValue);
|
||||
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMElement> pXmlElement;
|
||||
|
||||
DWORD dwResult = select_element(pXmlParent, bstrElementName, &pXmlElement);
|
||||
if (dwResult != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
|
||||
winstd::com_obj<IXMLDOMNodeList> pXmlListLocalizedText;
|
||||
long lCount = 0;
|
||||
if (select_nodes(pXmlElement, winstd::bstr(L"eap-metadata:localized-text"), &pXmlListLocalizedText) != ERROR_SUCCESS ||
|
||||
FAILED(pXmlListLocalizedText->get_length(&lCount)) ||
|
||||
lCount <= 0)
|
||||
{
|
||||
return
|
||||
SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ?
|
||||
*pbstrValue ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
winstd::bstr bstrDefault, bstrEn;
|
||||
for (long i = 0; ; i++) {
|
||||
if (i >= lCount) {
|
||||
if (bstrDefault != NULL) {
|
||||
// Return "C" localization.
|
||||
*pbstrValue = bstrDefault.detach();
|
||||
return ERROR_SUCCESS;
|
||||
} else if (bstrEn != NULL) {
|
||||
// Return "en" localization.
|
||||
*pbstrValue = bstrEn.detach();
|
||||
return ERROR_SUCCESS;
|
||||
} else
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
winstd::com_obj<IXMLDOMNode> pXmlElLocalizedText;
|
||||
pXmlListLocalizedText->get_item(i, &pXmlElLocalizedText);
|
||||
|
||||
{
|
||||
// Read <lang>.
|
||||
winstd::bstr bstrLang;
|
||||
if (get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:lang"), &bstrLang) != ERROR_SUCCESS ||
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"C" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||
{
|
||||
// <lang> is missing or "C" language found.
|
||||
winstd::bstr bstr;
|
||||
if ((dwResult = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)) == ERROR_SUCCESS)
|
||||
bstrDefault.attach(bstr.detach());
|
||||
} else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), pszLang, -1, NULL, NULL, 0) == CSTR_EQUAL) {
|
||||
// Found an exact match.
|
||||
return get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), pbstrValue);
|
||||
} else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"en", -1, NULL, NULL, 0) == CSTR_EQUAL) {
|
||||
// "en" language found.
|
||||
winstd::bstr bstr;
|
||||
if ((dwResult = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)) == ERROR_SUCCESS)
|
||||
bstrEn.attach(bstr.detach());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_localized(pXmlParent, bstrElementName, pszLang, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
sValue.assign(bstr, bstr.length());
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(pCurrentDOMNode);
|
||||
assert(ppXmlElement);
|
||||
|
||||
static const VARIANT varNodeTypeEl = { VT_I4, 0, 0, 0, { NODE_ELEMENT } };
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlEl;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlEl)) &&
|
||||
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) &&
|
||||
SUCCEEDED(hr = pXmlEl.query_interface(ppXmlElement)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue)
|
||||
{
|
||||
assert(pDoc);
|
||||
|
||||
static const VARIANT varNodeTypeEl = { VT_I4, 0, 0, 0, { NODE_ELEMENT } };
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlEl;
|
||||
winstd::com_obj<IXMLDOMText> pXmlElText;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlEl)) &&
|
||||
SUCCEEDED(hr = pDoc->createTextNode(bstrValue, &pXmlElText)) &&
|
||||
SUCCEEDED(hr = pXmlEl->appendChild(pXmlElText, NULL)) &&
|
||||
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue)
|
||||
{
|
||||
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(winstd::wstring_printf(L"%d", dwValue)));
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue)
|
||||
{
|
||||
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(bValue ? L"true": L"false"));
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||
{
|
||||
std::wstring sBase64;
|
||||
winstd::base64_enc enc;
|
||||
enc.encode(sBase64, pValue, nValueLen);
|
||||
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(sBase64));
|
||||
}
|
||||
|
||||
|
||||
inline DWORD put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||
{
|
||||
std::wstring sHex;
|
||||
winstd::hex_enc enc;
|
||||
enc.encode(sHex, pValue, nValueLen);
|
||||
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(sHex));
|
||||
}
|
||||
}
|
@@ -1,444 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EAP.h"
|
||||
#include "../res/wxEAP_UI.h"
|
||||
|
||||
#include <WinStd/Cred.h>
|
||||
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/log.h>
|
||||
#include <CommCtrl.h>
|
||||
|
||||
namespace eap
|
||||
{
|
||||
template <class _Tmeth, class _Tid, class _Tint, class _Tintres> class peer_ui;
|
||||
}
|
||||
|
||||
template <class _Tcfg, class _wxT> class wxEAPConfigDialog;
|
||||
class wxEAPCredentialsDialog;
|
||||
class wxEAPBannerPanel;
|
||||
template <class _Tcfg, class _Tcred, class _Tpanel> class wxEAPCredentialsConfigPanel;
|
||||
template <class _Tbase, class _Tcred> class wxCredentialsPanel;
|
||||
class wxPasswordCredentialsPanel;
|
||||
|
||||
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName);
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// EAP UI peer base abstract class template
|
||||
///
|
||||
/// A group of methods all EAP UI peers must or should implement.
|
||||
///
|
||||
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
|
||||
class peer_ui : public peer_base<_Tcfg, _Tid, _Tint, _Tintres>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
peer_ui() : peer_base<_Tcfg, _Tid, _Tint, _Tintres>() {}
|
||||
|
||||
///
|
||||
/// Raises the EAP method's specific connection configuration user interface dialog on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeConfigUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363614.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[inout] cfg Configuration to edit
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_config_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_Inout_ config_type &cfg,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
///
|
||||
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeIdentityUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363615.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] dwFlags Flags passed to `EapPeerInvokeIdentityUI()` call
|
||||
/// \param[inout] cfg Configuration
|
||||
/// \param[inout] usr User data to edit
|
||||
/// \param[out] ppwszIdentity Pointer to user identity. Free using `module::free_memory()`.
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_identity_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ DWORD dwFlags,
|
||||
_Inout_ config_type &cfg,
|
||||
_Inout_ identity_type &usr,
|
||||
_Out_ LPWSTR *ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
///
|
||||
/// Raises a custom interactive user interface dialog for the EAP method on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeInteractiveUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363616.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] req Interactive request
|
||||
/// \param[out] res Interactive response
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_interactive_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ const interactive_request_type &req,
|
||||
_Out_ interactive_response_type &res,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// EAP configuration dialog
|
||||
///
|
||||
template <class _Tmeth, class _wxT>
|
||||
class wxEAPConfigDialog : public wxEAPConfigDialogBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Configuration provider data type
|
||||
///
|
||||
typedef eap::config_provider<_Tmeth> _Tprov;
|
||||
|
||||
///
|
||||
/// Configuration data type
|
||||
///
|
||||
typedef eap::config_providers<_Tprov> config_type;
|
||||
|
||||
///
|
||||
/// This data type
|
||||
///
|
||||
typedef wxEAPConfigDialog<_Tmeth, _wxT> _T;
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration dialog
|
||||
///
|
||||
wxEAPConfigDialog(config_type &cfg, wxWindow* parent) :
|
||||
m_cfg(cfg),
|
||||
wxEAPConfigDialogBase(parent)
|
||||
{
|
||||
// Set extra style here, as wxFormBuilder overrides all default flags.
|
||||
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
|
||||
|
||||
for (std::list<_Tprov>::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
|
||||
bool is_single = provider->m_methods.size() == 1;
|
||||
std::list<_Tmeth>::size_type count = 0;
|
||||
std::list<_Tmeth>::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end();
|
||||
for (; method != method_end; ++method, count++)
|
||||
m_providers->AddPage(
|
||||
new _wxT(
|
||||
provider->m_methods.front(),
|
||||
provider->m_id.c_str(),
|
||||
m_providers),
|
||||
is_single ? provider->m_id : winstd::tstring_printf(_T("%s (%u)"), provider->m_id.c_str(), count));
|
||||
}
|
||||
|
||||
this->Layout();
|
||||
this->GetSizer()->Fit(this);
|
||||
|
||||
m_buttonsOK->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
// Forward the event to child panels.
|
||||
for (wxWindowList::compatibility_iterator provider = m_providers->GetChildren().GetFirst(); provider; provider = provider->GetNext()) {
|
||||
_wxT *prov = wxDynamicCast(provider->GetData(), _wxT);
|
||||
if (prov)
|
||||
prov->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
|
||||
protected:
|
||||
config_type &m_cfg; ///< EAP providers configuration
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAP credentials dialog
|
||||
///
|
||||
class wxEAPCredentialsDialog : public wxEAPCredentialsDialogBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a credential dialog
|
||||
///
|
||||
wxEAPCredentialsDialog(wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Adds panels to the dialog
|
||||
///
|
||||
void AddContents(wxPanel **contents, size_t content_count);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAP dialog banner
|
||||
///
|
||||
class wxEAPBannerPanel : public wxEAPBannerPanelBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a banner pannel and set the title text to product name
|
||||
///
|
||||
wxEAPBannerPanel(wxWindow* parent);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool AcceptsFocusFromKeyboard() const { return false; }
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Base template for credentials configuration panel
|
||||
///
|
||||
template <class _Tcfg, class _Tcred, class _Tpanel>
|
||||
class wxEAPCredentialsConfigPanel : public wxEAPCredentialsConfigPanelBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a credential configuration panel
|
||||
///
|
||||
/// \param[inout] cfg Configuration data
|
||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||
/// \param[in] parent Parent window
|
||||
///
|
||||
wxEAPCredentialsConfigPanel(_Tcfg &cfg, LPCTSTR pszCredTarget, wxWindow *parent) :
|
||||
m_cfg(cfg),
|
||||
m_target(pszCredTarget),
|
||||
m_cred(m_cfg.m_module),
|
||||
wxEAPCredentialsConfigPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(48));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
DWORD dwResult;
|
||||
|
||||
std::unique_ptr<CREDENTIAL, winstd::CredFree_delete<CREDENTIAL> > cred;
|
||||
if (CredRead(m_cred.target_name(m_target.c_str()).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred)) {
|
||||
m_clear->Enable(true);
|
||||
m_identity->SetValue(cred->UserName && cred->UserName[0] != 0 ? cred->UserName : _("<blank>"));
|
||||
} else if ((dwResult = GetLastError()) == ERROR_NOT_FOUND) {
|
||||
m_clear->Enable(false);
|
||||
m_identity->Clear();
|
||||
} else {
|
||||
m_clear->Enable(true);
|
||||
m_identity->SetValue(wxString::Format(_("<error %u>"), dwResult));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnSet(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
wxEAPCredentialsDialog dlg(this);
|
||||
|
||||
_Tpanel *panel = new _Tpanel(m_cred, m_target.c_str(), &dlg, true);
|
||||
|
||||
dlg.AddContents((wxPanel**)&panel, 1);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
virtual void OnClear(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (!CredDelete(m_cred.target_name(m_target.c_str()).c_str(), CRED_TYPE_GENERIC, 0))
|
||||
wxLogError(_("Deleting credentials failed (error %u)."), GetLastError());
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
_Tcfg &m_cfg; ///< EAP configuration
|
||||
winstd::library m_shell32; ///< shell32.dll resource library reference
|
||||
wxIcon m_icon; ///< Panel icon
|
||||
winstd::tstring m_target; ///< Credential Manager target
|
||||
|
||||
private:
|
||||
_Tcred m_cred; ///< Temporary credential data
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Base template for all credential panels
|
||||
///
|
||||
template <class _Tbase, class _Tcred>
|
||||
class wxCredentialsPanel : public _Tbase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a credentials panel
|
||||
///
|
||||
/// \param[inout] cred Credentials data
|
||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||
/// \param[in] parent Parent window
|
||||
/// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled.
|
||||
///
|
||||
wxCredentialsPanel(_Tcred &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false) :
|
||||
m_cred(cred),
|
||||
m_target(pszCredTarget),
|
||||
_Tbase(parent)
|
||||
{
|
||||
if (is_config) {
|
||||
// User is setting credentials via configuration UI.
|
||||
// => Pointless if not stored to Credential Manager
|
||||
m_remember->SetValue(true);
|
||||
m_remember->Enable(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
|
||||
virtual bool TransferDataToWindow()
|
||||
{
|
||||
wxCHECK(_Tbase::TransferDataToWindow(), false);
|
||||
|
||||
// Read credentials from Credential Manager
|
||||
EAP_ERROR *pEapError;
|
||||
DWORD dwResult;
|
||||
if ((dwResult = m_cred.retrieve(m_target.c_str(), &pEapError)) == ERROR_SUCCESS) {
|
||||
m_remember->SetValue(true);
|
||||
} else if (dwResult != ERROR_NOT_FOUND) {
|
||||
if (pEapError) {
|
||||
wxLogError(winstd::tstring_printf(_("Error reading credentials from Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str());
|
||||
m_cred.m_module.free_error_memory(pEapError);
|
||||
} else
|
||||
wxLogError(_("Reading credentials failed (error %u)."), dwResult);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool TransferDataFromWindow()
|
||||
{
|
||||
// Write credentials to credential manager.
|
||||
if (m_remember->GetValue()) {
|
||||
EAP_ERROR *pEapError;
|
||||
DWORD dwResult;
|
||||
if ((dwResult = m_cred.store(m_target.c_str(), &pEapError)) != ERROR_SUCCESS) {
|
||||
if (pEapError) {
|
||||
wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str());
|
||||
m_cred.m_module.free_error_memory(pEapError);
|
||||
} else
|
||||
wxLogError(_("Writing credentials failed (error %u)."), dwResult);
|
||||
}
|
||||
}
|
||||
|
||||
return _Tbase::TransferDataFromWindow();
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
_Tcred &m_cred; ///< Password credentials
|
||||
winstd::tstring m_target; ///< Credential Manager target
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Password credentials panel
|
||||
///
|
||||
class wxPasswordCredentialsPanel : public wxCredentialsPanel<wxPasswordCredentialsPanelBase, eap::credentials_pass>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a password credentials panel
|
||||
///
|
||||
/// \param[inout] cred Credentials data
|
||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||
/// \param[in] parent Parent window
|
||||
/// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled.
|
||||
///
|
||||
wxPasswordCredentialsPanel(eap::credentials_pass &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
winstd::library m_shell32; ///< shell32.dll resource library reference
|
||||
wxIcon m_icon; ///< Panel icon
|
||||
|
||||
private:
|
||||
static const wxStringCharType *s_dummy_password;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Sets icon from resource
|
||||
///
|
||||
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName)
|
||||
{
|
||||
wxASSERT(bmp);
|
||||
|
||||
HICON hIcon;
|
||||
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), &hIcon))) {
|
||||
icon.CreateFromHICON(hIcon);
|
||||
bmp->SetIcon(icon);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EAP.h"
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class config_pap;
|
||||
class credentials_pap;
|
||||
}
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_pap &val);
|
||||
inline size_t get_pk_size(const eap::config_pap &val);
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_pap &val);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// PAP configuration
|
||||
///
|
||||
class config_pap : public config_pass
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs configuration
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
config_pap(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
config_pap(_In_ const config_pap &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
config_pap(_Inout_ config_pap &&other);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_pap& operator=(_In_ const config_pap &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_pap& operator=(_Inout_ config_pap &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const { return new config_pap(*this); }
|
||||
|
||||
///
|
||||
/// Returns EAP method type of this configuration
|
||||
///
|
||||
/// \returns `eap::type_pap`
|
||||
///
|
||||
virtual eap::type_t get_method_id() { return eap::type_pap; }
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// PAP credentials
|
||||
///
|
||||
class credentials_pap : public credentials_pass
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
credentials_pap(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
credentials_pap(_In_ const credentials_pap &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
credentials_pap(_Inout_ credentials_pap &&other);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_pap& operator=(_In_ const credentials_pap &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_pap& operator=(_Inout_ credentials_pap &&other);
|
||||
|
||||
///
|
||||
/// Clones credentials
|
||||
///
|
||||
/// \returns Pointer to cloned credentials
|
||||
///
|
||||
virtual config* clone() const { return new credentials_pap(*this); }
|
||||
|
||||
/// \name Storage
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Return target suffix for Windows Credential Manager credential name
|
||||
///
|
||||
virtual LPCTSTR target_suffix() const { return _T("PAP"); }
|
||||
|
||||
/// @}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a PAP based method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_pap &val)
|
||||
{
|
||||
pack(cursor, (const eap::config_pass&)val);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a PAP based method configuration
|
||||
///
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::config_pap &val)
|
||||
{
|
||||
return get_pk_size((const eap::config_pass&)val);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a PAP based method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Configuration to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_pap &val)
|
||||
{
|
||||
unpack(cursor, (eap::config_pass&)val);
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PAP.h"
|
||||
|
||||
typedef wxEAPCredentialsConfigPanel<eap::config_pap, eap::credentials_pap, wxPasswordCredentialsPanel> wxPAPCredentialsConfigPanel;
|
||||
class wxPAPConfigPanel;
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
///
|
||||
/// PAP configuration panel
|
||||
///
|
||||
class wxPAPConfigPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
wxPAPConfigPanel(eap::config_pap &cfg, LPCTSTR pszCredTarget, wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Destructs the configuration panel
|
||||
///
|
||||
virtual ~wxPAPConfigPanel();
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
wxPAPCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel
|
||||
wxStaticText *m_label; ///< No-configuration notice
|
||||
};
|
@@ -1,352 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EAP.h"
|
||||
#include "EAPSerial.h"
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class config_tls;
|
||||
class credentials_tls;
|
||||
}
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_tls &val);
|
||||
inline size_t get_pk_size(const eap::config_tls &val);
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_tls &val);
|
||||
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials_tls &val);
|
||||
inline size_t get_pk_size(const eap::credentials_tls &val);
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials_tls &val);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// TLS configuration
|
||||
///
|
||||
class config_tls : public config_method
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs configuration
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
config_tls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
config_tls(_In_ const config_tls &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
config_tls(_Inout_ config_tls &&other);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_tls& operator=(_In_ const config_tls &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_tls& operator=(_Inout_ config_tls &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const { return new config_tls(*this); }
|
||||
|
||||
/// \name XML configuration management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save configuration to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving configuration
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const;
|
||||
|
||||
///
|
||||
/// Load configuration from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading configuration
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Returns EAP method type of this configuration
|
||||
///
|
||||
/// \returns `eap::type_tls`
|
||||
///
|
||||
virtual eap::type_t get_method_id() { return eap::type_tls; }
|
||||
|
||||
///
|
||||
/// Adds CA to the list of trusted root CA's
|
||||
///
|
||||
/// \sa [CertCreateCertificateContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376033.aspx)
|
||||
///
|
||||
bool add_trusted_ca(_In_ DWORD dwCertEncodingType, _In_ const BYTE *pbCertEncoded, _In_ DWORD cbCertEncoded);
|
||||
|
||||
public:
|
||||
std::list<winstd::cert_context> m_trusted_root_ca; ///< Trusted root CAs
|
||||
std::list<std::string> m_server_names; ///< Acceptable authenticating server names
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// TLS credentials
|
||||
///
|
||||
class credentials_tls : public credentials
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
credentials_tls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
credentials_tls(_In_ const credentials_tls &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
credentials_tls(_Inout_ credentials_tls &&other);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_tls& operator=(_In_ const credentials_tls &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_tls& operator=(_Inout_ credentials_tls &&other);
|
||||
|
||||
///
|
||||
/// Clones credentials
|
||||
///
|
||||
/// \returns Pointer to cloned credentials
|
||||
///
|
||||
virtual config* clone() const { return new credentials_tls(*this); }
|
||||
|
||||
///
|
||||
/// Resets credentials
|
||||
///
|
||||
virtual void clear();
|
||||
|
||||
///
|
||||
/// Test credentials if blank
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML credentials management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Load credentials from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Storage
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save credentials to Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const;
|
||||
|
||||
///
|
||||
/// Retrieve credentials from Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Return target suffix for Windows Credential Manager credential name
|
||||
///
|
||||
virtual LPCTSTR target_suffix() const { return _T("TLS"); }
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
std::vector<unsigned char> m_cert_hash; ///< Client certificate hash (certificates are kept in Personal Certificate Storage)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a TLS method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_tls &val)
|
||||
{
|
||||
pack(cursor, (const eap::config_method&)val);
|
||||
pack(cursor, val.m_trusted_root_ca );
|
||||
pack(cursor, val.m_server_names );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a TLS method configuration
|
||||
///
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::config_tls &val)
|
||||
{
|
||||
return
|
||||
get_pk_size((const eap::config_method&)val) +
|
||||
get_pk_size(val.m_trusted_root_ca ) +
|
||||
get_pk_size(val.m_server_names );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a TLS method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Configuration to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_tls &val)
|
||||
{
|
||||
unpack(cursor, (eap::config_method&)val );
|
||||
unpack(cursor, val.m_trusted_root_ca);
|
||||
unpack(cursor, val.m_server_names );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Packs a TLS method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials_tls &val)
|
||||
{
|
||||
pack(cursor, (const eap::credentials&)val);
|
||||
pack(cursor, val.m_cert_hash );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a TLS method credentials
|
||||
///
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::credentials_tls &val)
|
||||
{
|
||||
return
|
||||
get_pk_size((const eap::credentials&)val) +
|
||||
get_pk_size(val.m_cert_hash );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a TLS method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Credentials to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials_tls &val)
|
||||
{
|
||||
unpack(cursor, (eap::credentials&)val);
|
||||
unpack(cursor, val.m_cert_hash );
|
||||
}
|
||||
}
|
@@ -1,346 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TLS.h"
|
||||
#include "../res/wxTLS_UI.h"
|
||||
|
||||
#include <wx/icon.h>
|
||||
#include <wx/validate.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class wxCertificateClientData;
|
||||
class wxCertificateSelectionClientData;
|
||||
class wxHostNameValidator;
|
||||
class wxFQDNValidator;
|
||||
class wxFQDNListValidator;
|
||||
|
||||
class wxEAPTLSCredentialsPanel;
|
||||
class wxEAPTLSServerTrustPanel;
|
||||
typedef wxEAPCredentialsConfigPanel<eap::config_tls, eap::credentials_tls, wxEAPTLSCredentialsPanel> wxEAPTLSCredentialsConfigPanel;
|
||||
class wxEAPTLSConfigPanel;
|
||||
|
||||
namespace eap
|
||||
{
|
||||
void get_cert_title(PCCERT_CONTEXT cert, winstd::tstring &title);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
///
|
||||
/// Helper class for auto-destroyable certificates used in wxWidget's item containers
|
||||
///
|
||||
class wxCertificateClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs client data object with existing handle
|
||||
///
|
||||
wxCertificateClientData(PCCERT_CONTEXT cert);
|
||||
|
||||
///
|
||||
/// Releases certificate handle and destructs the object
|
||||
///
|
||||
virtual ~wxCertificateClientData();
|
||||
|
||||
public:
|
||||
PCCERT_CONTEXT m_cert; ///< Certificate
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Helper class for auto-destroyable certificates used in wxWidget's item containers
|
||||
///
|
||||
class wxCertificateSelectionClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Default constructor
|
||||
///
|
||||
wxCertificateSelectionClientData();
|
||||
|
||||
///
|
||||
/// Constructs client data object
|
||||
///
|
||||
wxCertificateSelectionClientData(const wchar_t *identity, unsigned char *hash, size_t hash_size);
|
||||
|
||||
///
|
||||
/// Constructs client data object with copy
|
||||
///
|
||||
wxCertificateSelectionClientData(const std::wstring &identity, const std::vector<unsigned char> &hash);
|
||||
|
||||
///
|
||||
/// Constructs client data object with move
|
||||
///
|
||||
wxCertificateSelectionClientData(std::wstring &&identity, std::vector<unsigned char> &&hash);
|
||||
|
||||
///
|
||||
/// Constructs client data object with copy
|
||||
///
|
||||
wxCertificateSelectionClientData(const wxCertificateSelectionClientData &other);
|
||||
|
||||
///
|
||||
/// Constructs client data object with move
|
||||
///
|
||||
wxCertificateSelectionClientData(wxCertificateSelectionClientData &&other);
|
||||
|
||||
public:
|
||||
std::wstring m_identity; ///< Client identity
|
||||
std::vector<unsigned char> m_hash; ///< Client certificate hash (certificates are kept in Personal Certificate Storage)
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Validator for host name
|
||||
///
|
||||
class wxHostNameValidator : public wxValidator
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxHostNameValidator);
|
||||
wxDECLARE_NO_ASSIGN_CLASS(wxHostNameValidator);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Construct the validator with a value to store data
|
||||
///
|
||||
wxHostNameValidator(std::string *val = NULL);
|
||||
|
||||
///
|
||||
/// Copy constructor
|
||||
///
|
||||
wxHostNameValidator(const wxHostNameValidator &other);
|
||||
|
||||
///
|
||||
/// Copies this validator
|
||||
///
|
||||
virtual wxObject* Clone() const;
|
||||
|
||||
///
|
||||
/// Validates the value
|
||||
///
|
||||
virtual bool Validate(wxWindow *parent);
|
||||
|
||||
///
|
||||
/// Transfers the value to the window
|
||||
///
|
||||
virtual bool TransferToWindow();
|
||||
|
||||
///
|
||||
/// Transfers the value from the window
|
||||
///
|
||||
virtual bool TransferFromWindow();
|
||||
|
||||
///
|
||||
/// Parses FQDN value
|
||||
///
|
||||
static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::string *val_out = NULL);
|
||||
|
||||
protected:
|
||||
std::string *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Validator for FQDN
|
||||
///
|
||||
class wxFQDNValidator : public wxValidator
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxFQDNValidator);
|
||||
wxDECLARE_NO_ASSIGN_CLASS(wxFQDNValidator);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Construct the validator with a value to store data
|
||||
///
|
||||
wxFQDNValidator(std::string *val = NULL);
|
||||
|
||||
///
|
||||
/// Copy constructor
|
||||
///
|
||||
wxFQDNValidator(const wxFQDNValidator &other);
|
||||
|
||||
///
|
||||
/// Copies this validator
|
||||
///
|
||||
virtual wxObject* Clone() const;
|
||||
|
||||
///
|
||||
/// Validates the value
|
||||
///
|
||||
virtual bool Validate(wxWindow *parent);
|
||||
|
||||
///
|
||||
/// Transfers the value to the window
|
||||
///
|
||||
virtual bool TransferToWindow();
|
||||
|
||||
///
|
||||
/// Transfers the value from the window
|
||||
///
|
||||
virtual bool TransferFromWindow();
|
||||
|
||||
///
|
||||
/// Parses FQDN value
|
||||
///
|
||||
static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::string *val_out = NULL);
|
||||
|
||||
protected:
|
||||
std::string *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Validator for FQDN lists
|
||||
///
|
||||
class wxFQDNListValidator : public wxValidator
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxFQDNListValidator);
|
||||
wxDECLARE_NO_ASSIGN_CLASS(wxFQDNListValidator);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Construct the validator with a value to store data
|
||||
///
|
||||
wxFQDNListValidator(std::list<std::string> *val = NULL);
|
||||
|
||||
///
|
||||
/// Copy constructor
|
||||
///
|
||||
wxFQDNListValidator(const wxFQDNListValidator &other);
|
||||
|
||||
///
|
||||
/// Copies this validator
|
||||
///
|
||||
virtual wxObject* Clone() const;
|
||||
|
||||
///
|
||||
/// Validates the value
|
||||
///
|
||||
virtual bool Validate(wxWindow *parent);
|
||||
|
||||
///
|
||||
/// Transfers the value to the window
|
||||
///
|
||||
virtual bool TransferToWindow();
|
||||
|
||||
///
|
||||
/// Transfers the value from the window
|
||||
///
|
||||
virtual bool TransferFromWindow();
|
||||
|
||||
///
|
||||
/// Parses FQDN list value
|
||||
///
|
||||
static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::list<std::string> *val_out = NULL);
|
||||
|
||||
protected:
|
||||
std::list<std::string> *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAPTLS credential panel
|
||||
///
|
||||
class wxEAPTLSCredentialsPanel : public wxCredentialsPanel<wxEAPTLSCredentialsPanelBase, eap::credentials_tls>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
wxEAPTLSCredentialsPanel(eap::credentials_tls &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config = false);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual void OnCertSelect(wxCommandEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
winstd::library m_shell32; ///< shell32.dll resource library reference
|
||||
wxIcon m_icon; ///< Panel icon
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAPTLS server trust configuration panel
|
||||
///
|
||||
class wxEAPTLSServerTrustPanel : public wxEAPTLSServerTrustConfigPanelBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
wxEAPTLSServerTrustPanel(eap::config_tls &cfg, wxWindow* parent);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual void OnRootCA(wxCommandEvent& event);
|
||||
virtual void OnRootCADClick(wxCommandEvent& event);
|
||||
virtual void OnRootCAAddStore(wxCommandEvent& event);
|
||||
virtual void OnRootCAAddFile(wxCommandEvent& event);
|
||||
virtual void OnRootCARemove(wxCommandEvent& event);
|
||||
/// \endcond
|
||||
|
||||
///
|
||||
/// Adds a certificate to the list of trusted root CA list
|
||||
///
|
||||
/// \param[in] cert Certificate
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if certificate was added;
|
||||
/// - \c false if duplicate found or an error occured.
|
||||
///
|
||||
bool AddRootCA(PCCERT_CONTEXT cert);
|
||||
|
||||
protected:
|
||||
eap::config_tls &m_cfg; ///< TLS configuration
|
||||
winstd::library m_certmgr; ///< certmgr.dll resource library reference
|
||||
wxIcon m_icon; ///< Panel icon
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAPTLS configuration panel
|
||||
///
|
||||
class wxEAPTLSConfigPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
wxEAPTLSConfigPanel(eap::config_tls &cfg, LPCTSTR pszCredTarget, wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Destructs the configuration panel
|
||||
///
|
||||
virtual ~wxEAPTLSConfigPanel();
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
wxEAPTLSServerTrustPanel *m_server_trust; ///< Server trust configuration panel
|
||||
wxEAPTLSCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel
|
||||
};
|
@@ -1,405 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EAP.h"
|
||||
#include "EAPSerial.h"
|
||||
#include "TLS.h"
|
||||
#include "PAP.h"
|
||||
|
||||
#include <WinStd/Crypt.h>
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class config_ttls;
|
||||
class credentials_ttls;
|
||||
class session_ttls;
|
||||
class peer_ttls;
|
||||
}
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_ttls &val);
|
||||
inline size_t get_pk_size(const eap::config_ttls &val);
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_ttls &val);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// TTLS configuration
|
||||
///
|
||||
class config_ttls : public config_tls
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs configuration
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
config_ttls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
config_ttls(const _In_ config_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
config_ttls(_Inout_ config_ttls &&other);
|
||||
|
||||
///
|
||||
/// Destructs configuration
|
||||
///
|
||||
virtual ~config_ttls();
|
||||
|
||||
///
|
||||
/// Copies configuration
|
||||
///
|
||||
/// \param[in] other Configuration to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_ttls& operator=(const _In_ config_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves configuration
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
config_ttls& operator=(_Inout_ config_ttls &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const { return new config_ttls(*this); }
|
||||
|
||||
/// \name XML configuration management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save configuration to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving configuration
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const;
|
||||
|
||||
///
|
||||
/// Load configuration from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading configuration
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Returns EAP method type of this configuration
|
||||
///
|
||||
/// \returns `eap::type_ttls`
|
||||
///
|
||||
virtual eap::type_t get_method_id() { return eap::type_ttls; }
|
||||
|
||||
public:
|
||||
config_method *m_inner; ///< Inner authentication configuration
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// TTLS credentials
|
||||
///
|
||||
class credentials_ttls : public credentials_tls
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
credentials_ttls(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
credentials_ttls(_In_ const credentials_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
credentials_ttls(_Inout_ credentials_ttls &&other);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_ttls& operator=(_In_ const credentials_ttls &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_ttls& operator=(_Inout_ credentials_ttls &&other);
|
||||
|
||||
///
|
||||
/// Clones credentials
|
||||
///
|
||||
/// \returns Pointer to cloned credentials
|
||||
///
|
||||
virtual config* clone() const { return new credentials_ttls(*this); }
|
||||
|
||||
///
|
||||
/// Resets credentials
|
||||
///
|
||||
virtual void clear();
|
||||
|
||||
///
|
||||
/// Test credentials if blank
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML credentials management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Load credentials from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Storage
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save credentials to Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const;
|
||||
|
||||
///
|
||||
/// Retrieve credentials from Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
credentials *m_inner; ///< Inner credentials
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// TTLS session
|
||||
///
|
||||
class session_ttls : public session
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
session_ttls();
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// TTLS peer
|
||||
///
|
||||
class peer_ttls : public peer<eap::config_ttls, eap::credentials_ttls, int, int>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
peer_ttls();
|
||||
|
||||
///
|
||||
/// Initializes an EAP peer method for EAPHost.
|
||||
///
|
||||
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
|
||||
///
|
||||
virtual DWORD initialize(_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Shuts down the EAP method and prepares to unload its corresponding DLL.
|
||||
///
|
||||
/// \sa [EapPeerShutdown function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363627.aspx)
|
||||
///
|
||||
virtual DWORD shutdown(_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Returns the user data and user identity after being called by EAPHost.
|
||||
///
|
||||
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
|
||||
///
|
||||
virtual DWORD get_identity(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_Out_ BOOL *pfInvokeUI,
|
||||
_Out_ DWORD *pdwUserDataOutSize,
|
||||
_Out_ BYTE **ppUserDataOut,
|
||||
_Out_ WCHAR **ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
|
||||
///
|
||||
/// \sa [EapPeerGetMethodProperties function](https://msdn.microsoft.com/en-us/library/windows/desktop/hh706636.aspx)
|
||||
///
|
||||
virtual DWORD get_method_properties(
|
||||
_In_ DWORD dwVersion,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ DWORD dwEapConnDataSize,
|
||||
_In_count_(dwEapConnDataSize) const BYTE *pEapConnData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
|
||||
_Out_ EAP_ERROR **ppEapError) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a TTLS based method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::config_ttls &val)
|
||||
{
|
||||
pack(cursor, (const eap::config_tls&)val);
|
||||
if (val.m_inner) {
|
||||
if (dynamic_cast<eap::config_pap*>(val.m_inner)) {
|
||||
pack(cursor, (unsigned char)eap::type_pap);
|
||||
pack(cursor, (const eap::config_pap&)*val.m_inner);
|
||||
} else {
|
||||
assert(0); // Unsupported inner authentication method type.
|
||||
pack(cursor, (unsigned char)0);
|
||||
}
|
||||
} else
|
||||
pack(cursor, (unsigned char)0);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a TTLS based method configuration
|
||||
///
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::config_ttls &val)
|
||||
{
|
||||
size_t size_inner = sizeof(unsigned char);
|
||||
if (val.m_inner) {
|
||||
if (dynamic_cast<eap::config_pap*>(val.m_inner))
|
||||
size_inner += get_pk_size((const eap::config_pap&)*val.m_inner);
|
||||
else
|
||||
assert(0); // Unsupported inner authentication method type.
|
||||
}
|
||||
|
||||
return
|
||||
get_pk_size((const eap::config_tls&)val) +
|
||||
size_inner;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a TTLS based method configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Configuration to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::config_ttls &val)
|
||||
{
|
||||
unpack(cursor, (eap::config_tls&)val);
|
||||
|
||||
assert(!val.m_inner);
|
||||
unsigned char eap_type;
|
||||
unpack(cursor, eap_type);
|
||||
switch (eap_type) {
|
||||
case eap::type_pap:
|
||||
val.m_inner = new eap::config_pap(val.m_module);
|
||||
unpack(cursor, (eap::config_pap&)*val.m_inner);
|
||||
break;
|
||||
case 0 : break;
|
||||
default : assert(0); // Unsupported inner authentication method type.
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TTLS.h"
|
||||
#include "EAP_UI.h"
|
||||
#include "../res/wxEAP_UI.h"
|
||||
#include "../res/wxTTLS_UI.h"
|
||||
#include "../res/wxTLS_UI.h"
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class peer_ttls_ui;
|
||||
}
|
||||
|
||||
class wxEAPTTLSConfigPanel;
|
||||
class wxEAPTTLSConfig;
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/icon.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/choicebk.h>
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// TTLS UI peer
|
||||
///
|
||||
class peer_ttls_ui : public peer_ui<eap::config_ttls, eap::credentials_ttls, int, int>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
peer_ttls_ui();
|
||||
|
||||
///
|
||||
/// Raises the EAP method's specific connection configuration user interface dialog on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeConfigUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363614.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[inout] cfg Configuration to edit
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_config_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_Inout_ config_type &cfg,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeIdentityUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363615.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] dwFlags Flags passed to `EapPeerInvokeIdentityUI()` call
|
||||
/// \param[inout] cfg Configuration
|
||||
/// \param[inout] usr User data to edit
|
||||
/// \param[out] ppwszIdentity Pointer to user identity. Free using `module::free_memory()`.
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_identity_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ DWORD dwFlags,
|
||||
_Inout_ config_type &cfg,
|
||||
_Inout_ identity_type &usr,
|
||||
_Out_ LPWSTR *ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
|
||||
///
|
||||
/// Raises a custom interactive user interface dialog for the EAP method on the client.
|
||||
///
|
||||
/// \sa [EapPeerInvokeInteractiveUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363616.aspx)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] req Interactive request
|
||||
/// \param[out] res Interactive response
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c ERROR_SUCCESS if succeeded
|
||||
/// - error code otherwise
|
||||
///
|
||||
virtual DWORD invoke_interactive_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ const interactive_request_type &req,
|
||||
_Out_ interactive_response_type &res,
|
||||
_Out_ EAP_ERROR **ppEapError);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// EAPTTLS configuration panel
|
||||
///
|
||||
class wxEAPTTLSConfigPanel : public wxEAPTTLSConfigPanelBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
wxEAPTTLSConfigPanel(eap::config_ttls &cfg, wxWindow* parent);
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual void OnOuterIdentityCustom(wxCommandEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
eap::config_ttls &m_cfg; ///< TLS configuration
|
||||
winstd::library m_shell32; ///< shell32.dll resource library reference
|
||||
wxIcon m_icon; ///< Panel icon
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAPTTLS configuration
|
||||
///
|
||||
class wxEAPTTLSConfig : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
///
|
||||
/// \param[inout] cfg Configuration data
|
||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||
/// \param[in] parent Parent window
|
||||
///
|
||||
wxEAPTTLSConfig(eap::config_ttls &cfg, LPCTSTR pszCredTarget, wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Destructs the configuration panel
|
||||
///
|
||||
virtual ~wxEAPTTLSConfig();
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
eap::config_ttls &m_cfg; ///< TTLS configuration
|
||||
wxStaticText *m_outer_title; ///< Outer authentication title
|
||||
wxEAPTTLSConfigPanel *m_outer_identity; ///< Outer identity configuration panel
|
||||
wxEAPTLSConfigPanel *m_tls; ///< TLS configuration panel
|
||||
wxStaticText *m_inner_title; ///< Inner authentication title
|
||||
wxChoicebook *m_inner_type; ///< Inner authentication type
|
||||
|
||||
eap::config_pap m_cfg_pap; ///< Temporary PAP configuration
|
||||
};
|
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: EAPMethods\n"
|
||||
"POT-Creation-Date: 2016-06-09 15:19+0200\n"
|
||||
"POT-Creation-Date: 2016-06-10 12:06+0200\n"
|
||||
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||
@@ -10,295 +10,332 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-Basepath: ../..\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: en_US\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: res\n"
|
||||
"X-Poedit-SearchPath-1: MSIBuild\n"
|
||||
"X-Poedit-SearchPath-2: src\n"
|
||||
"X-Poedit-SearchPath-3: include\n"
|
||||
"X-Poedit-SearchPath-0: lib/EAPBase_UI\n"
|
||||
"X-Poedit-SearchPath-1: lib/PAP_UI\n"
|
||||
"X-Poedit-SearchPath-2: lib/TLS_UI\n"
|
||||
"X-Poedit-SearchPath-3: lib/TTLS_UI\n"
|
||||
"X-Poedit-SearchPath-4: EAPMethods\n"
|
||||
|
||||
#: res/wxEAP_UI.cpp:123 res/wxEAP_UI.cpp:200
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:123 lib/EAPBase_UI/res/wxEAP_UI.cpp:200
|
||||
msgid "Client Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:134
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:134
|
||||
msgid "Manage your credentials stored in Windows Credential Manager."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:144
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:144
|
||||
msgid "Identity:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:149
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:149
|
||||
msgid "Enter your user name here (user@domain.org, DOMAINUser, etc.)"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:159
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:159
|
||||
msgid "&Set Credentials..."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:160
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:160
|
||||
msgid "Click here to set or modify your credentials"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:164
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:164
|
||||
msgid "&Clear Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:165
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:165
|
||||
msgid ""
|
||||
"Click to clear your credentials from Credential Manager.\n"
|
||||
"Note: You will be prompted to enter credentials when connecting."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:211
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:211
|
||||
msgid "Please provide your user ID and password."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:221
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:221
|
||||
msgid "User ID:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:226
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:226
|
||||
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:230
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:230
|
||||
msgid "Password:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:235
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:235
|
||||
msgid "Enter your password here"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:242 res/wxTLS_UI.cpp:164
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:242 lib/TLS_UI/res/wxTLS_UI.cpp:164
|
||||
msgid "&Remember"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.cpp:243
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:243
|
||||
msgid "Check if you would like to save username and password"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:17
|
||||
msgid "Server Trust"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:28
|
||||
msgid "Describe the servers you trust to prevent credential interception in case of man-in-the-middle attacks."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:35
|
||||
msgid "Acceptable Certificate Authorities:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:40
|
||||
msgid "List of certificate authorities server's certificate must be issued by"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:47
|
||||
msgid "Add CA from Store..."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:48
|
||||
msgid "Adds a new certificate authority from the certificate store to the list"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:52
|
||||
msgid "Add CA from File..."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:53
|
||||
msgid "Adds a new certificate authority from the file to the list"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:57
|
||||
msgid "&Remove CA"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:59
|
||||
msgid "Removes selected certificate authorities from the list"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:72
|
||||
msgid "Acceptable server &names:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:77
|
||||
msgid "A semicolon delimited list of acceptable server FQDN names; blank to skip name check; \"*\" wildchar allowed"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:81
|
||||
msgid "(Example: foo.bar.com;*.domain.org)"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:120
|
||||
msgid "TLS Client Certificate"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:131
|
||||
msgid "Please select your client certificate to use for authentication."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:138
|
||||
msgid "Co&nnect without providing a client certificate"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:139
|
||||
msgid "Select if your server does not require you to provide a client certificate"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:146
|
||||
msgid "Use the following &certificate:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:147
|
||||
msgid "Select if you need to provide a client certificate when connecting"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:154
|
||||
msgid "Client certificate to use for authentication"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTLS_UI.cpp:165
|
||||
msgid "Check if you would like to save certificate selection"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:17
|
||||
msgid "Outer Identity"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:28
|
||||
msgid "Select the user ID supplicant introduces itself as to authenticator:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:35
|
||||
msgid "&Same as inner identity"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:36
|
||||
msgid "Use my true user name"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:40
|
||||
msgid "Use &empty outer identity (RFC 4822)"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:41
|
||||
msgid "Ommit my user name and use @mydomain.org only"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:48
|
||||
msgid "&Custom outer identity:"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:49
|
||||
msgid "Specify custom outer identity"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxTTLS_UI.cpp:54
|
||||
msgid "Custom outer identity to use"
|
||||
msgstr ""
|
||||
|
||||
#: src/PAP_UI.cpp:41
|
||||
#: lib/PAP_UI/src/PAP_UI.cpp:41
|
||||
msgid "This method requires no additional settings."
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:198
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:17
|
||||
msgid "Server Trust"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:28
|
||||
msgid "Describe the servers you trust to prevent credential interception in case of man-in-the-middle attacks."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:35
|
||||
msgid "Acceptable Certificate Authorities:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:40
|
||||
msgid "List of certificate authorities server's certificate must be issued by"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:47
|
||||
msgid "Add CA from Store..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:48
|
||||
msgid "Adds a new certificate authority from the certificate store to the list"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:52
|
||||
msgid "Add CA from File..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:53
|
||||
msgid "Adds a new certificate authority from the file to the list"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:57
|
||||
msgid "&Remove CA"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:59
|
||||
msgid "Removes selected certificate authorities from the list"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:72
|
||||
msgid "Acceptable server &names:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:77
|
||||
msgid "A semicolon delimited list of acceptable server FQDN names; blank to skip name check; \"*\" wildchar allowed"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:81
|
||||
msgid "(Example: foo.bar.com;*.domain.org)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:120
|
||||
msgid "TLS Client Certificate"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:131
|
||||
msgid "Please select your client certificate to use for authentication."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:138
|
||||
msgid "Co&nnect without providing a client certificate"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:139
|
||||
msgid "Select if your server does not require you to provide a client certificate"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:146
|
||||
msgid "Use the following &certificate:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:147
|
||||
msgid "Select if you need to provide a client certificate when connecting"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:154
|
||||
msgid "Client certificate to use for authentication"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:165
|
||||
msgid "Check if you would like to save certificate selection"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||
#, c-format
|
||||
msgid "Invalid character in host name found: %c"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:198
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||
msgid "Validation conflict"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:550
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:551
|
||||
msgid "Add Certificate"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:551
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:552
|
||||
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:552
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:553
|
||||
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:553
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:554
|
||||
msgid "PKCS #7 Certificate Files (*.p7b)"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:554
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:555
|
||||
msgid "All Files (*.*)"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:570
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||
#, c-format
|
||||
msgid "Invalid or unsupported certificate file %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/TLS_UI.cpp:570
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||
#, fuzzy
|
||||
msgid "Error"
|
||||
msgstr "Napaka pri nalaganju knjižnice MSI.DLL (%1!ld!)."
|
||||
|
||||
#: src/TTLS_UI.cpp:172
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:17
|
||||
msgid "Outer Identity"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:28
|
||||
msgid "Select the user ID supplicant introduces itself as to authenticator:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:35
|
||||
msgid "&Same as inner identity"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:36
|
||||
msgid "Use my true user name"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:40
|
||||
msgid "Use &empty outer identity (RFC 4822)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:41
|
||||
msgid "Ommit my user name and use @mydomain.org only"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:48
|
||||
msgid "&Custom outer identity:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:49
|
||||
msgid "Specify custom outer identity"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:54
|
||||
msgid "Custom outer identity to use"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:92
|
||||
msgid "Outer Authentication"
|
||||
msgstr ""
|
||||
|
||||
#: src/TTLS_UI.cpp:185
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:105
|
||||
msgid "Inner Authentication"
|
||||
msgstr ""
|
||||
|
||||
#: src/TTLS_UI.cpp:191
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:111
|
||||
msgid "Select inner authentication method from the list"
|
||||
msgstr ""
|
||||
|
||||
#: src/TTLS_UI.cpp:192
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:112
|
||||
msgid "PAP"
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:272
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:217
|
||||
msgid "<blank>"
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:278
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:223
|
||||
#, c-format
|
||||
msgid "<error %u>"
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:301
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:246
|
||||
#, c-format
|
||||
msgid "Deleting credentials failed (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:358
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:300
|
||||
#, c-format
|
||||
msgid "Error reading credentials from Credential Manager: %ls (error %u)"
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:361
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:303
|
||||
#, c-format
|
||||
msgid "Reading credentials failed (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:376
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:318
|
||||
#, c-format
|
||||
msgid "Error writing credentials to Credential Manager: %ls (error %u)"
|
||||
msgstr ""
|
||||
|
||||
#: include/EAP_UI.h:379
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:321
|
||||
#, c-format
|
||||
msgid "Writing credentials failed (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.h:56
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:56
|
||||
msgid "EAP Method Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: res/wxEAP_UI.h:81
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:81
|
||||
msgid "EAP Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:3
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:3
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
#, fuzzy
|
||||
msgid "1252"
|
||||
msgstr "1250"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "EAP Peer Methods"
|
||||
msgstr ""
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Modules to support individual EAP methods"
|
||||
msgstr ""
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||
msgid "TTLS"
|
||||
msgstr ""
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||
msgid "Tunneled Transport Layer Security"
|
||||
msgstr ""
|
||||
|
Binary file not shown.
@@ -1,260 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#include "wxEAP_UI.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPConfigDialogBase::wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_banner = new wxEAPBannerPanel( this );
|
||||
|
||||
sb_content->Add( m_banner, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_providers = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
sb_content->Add( m_providers, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttons = new wxStdDialogButtonSizer();
|
||||
m_buttonsOK = new wxButton( this, wxID_OK );
|
||||
m_buttons->AddButton( m_buttonsOK );
|
||||
m_buttonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_buttons->AddButton( m_buttonsCancel );
|
||||
m_buttons->Realize();
|
||||
|
||||
sb_content->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_content );
|
||||
this->Layout();
|
||||
sb_content->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPConfigDialogBase::OnInitDialog ) );
|
||||
}
|
||||
|
||||
wxEAPConfigDialogBase::~wxEAPConfigDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPConfigDialogBase::OnInitDialog ) );
|
||||
|
||||
}
|
||||
|
||||
wxEAPCredentialsDialogBase::wxEAPCredentialsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_banner = new wxEAPBannerPanel( this );
|
||||
|
||||
sb_content->Add( m_banner, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_panels = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
sb_content->Add( m_panels, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttons = new wxStdDialogButtonSizer();
|
||||
m_buttonsOK = new wxButton( this, wxID_OK );
|
||||
m_buttons->AddButton( m_buttonsOK );
|
||||
m_buttonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_buttons->AddButton( m_buttonsCancel );
|
||||
m_buttons->Realize();
|
||||
|
||||
sb_content->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_content );
|
||||
this->Layout();
|
||||
sb_content->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsDialogBase::OnInitDialog ) );
|
||||
}
|
||||
|
||||
wxEAPCredentialsDialogBase::~wxEAPCredentialsDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsDialogBase::OnInitDialog ) );
|
||||
|
||||
}
|
||||
|
||||
wxEAPBannerPanelBase::wxEAPBannerPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
this->SetMinSize( wxSize( -1,48 ) );
|
||||
|
||||
wxBoxSizer* sc_content;
|
||||
sc_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_title = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
||||
m_title->Wrap( -1 );
|
||||
m_title->SetFont( wxFont( 18, 70, 90, 90, false, wxEmptyString ) );
|
||||
m_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
|
||||
sc_content->Add( m_title, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sc_content );
|
||||
this->Layout();
|
||||
sc_content->Fit( this );
|
||||
}
|
||||
|
||||
wxEAPBannerPanelBase::~wxEAPBannerPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_credentials;
|
||||
sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Client Credentials") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_credentials_horiz;
|
||||
sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_credentials_icon = new wxStaticBitmap( sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_credentials_vert;
|
||||
sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Manage your credentials stored in Windows Credential Manager."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_credentials_label->Wrap( 446 );
|
||||
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* sb_credentials_tbl;
|
||||
sb_credentials_tbl = new wxFlexGridSizer( 0, 2, 5, 5 );
|
||||
sb_credentials_tbl->AddGrowableCol( 1 );
|
||||
sb_credentials_tbl->SetFlexibleDirection( wxBOTH );
|
||||
sb_credentials_tbl->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_identity_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Identity:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_identity_label->Wrap( -1 );
|
||||
sb_credentials_tbl->Add( m_identity_label, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
m_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAINUser, etc.)") );
|
||||
|
||||
sb_credentials_tbl->Add( m_identity, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sb_credentials_vert->Add( sb_credentials_tbl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_buttons;
|
||||
sb_buttons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_set = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_set->SetToolTip( _("Click here to set or modify your credentials") );
|
||||
|
||||
sb_buttons->Add( m_set, 0, wxRIGHT, 5 );
|
||||
|
||||
m_clear = new wxButton( sb_credentials->GetStaticBox(), wxID_ANY, _("&Clear Credentials"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_clear->SetToolTip( _("Click to clear your credentials from Credential Manager.\nNote: You will be prompted to enter credentials when connecting.") );
|
||||
|
||||
sb_buttons->Add( m_clear, 0, wxLEFT, 5 );
|
||||
|
||||
|
||||
sb_credentials_vert->Add( sb_buttons, 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
|
||||
sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials->Add( sb_credentials_horiz, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
|
||||
m_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSet ), NULL, this );
|
||||
m_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClear ), NULL, this );
|
||||
}
|
||||
|
||||
wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
|
||||
m_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSet ), NULL, this );
|
||||
m_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClear ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
wxPasswordCredentialsPanelBase::wxPasswordCredentialsPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_credentials;
|
||||
sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Client Credentials") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_credentials_horiz;
|
||||
sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_credentials_icon = new wxStaticBitmap( sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_credentials_vert;
|
||||
sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please provide your user ID and password."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_credentials_label->Wrap( 446 );
|
||||
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* sb_credentials_tbl;
|
||||
sb_credentials_tbl = new wxFlexGridSizer( 0, 2, 5, 5 );
|
||||
sb_credentials_tbl->AddGrowableCol( 1 );
|
||||
sb_credentials_tbl->SetFlexibleDirection( wxBOTH );
|
||||
sb_credentials_tbl->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_identity_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("User ID:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_identity_label->Wrap( -1 );
|
||||
sb_credentials_tbl->Add( m_identity_label, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAIN\\User, etc.)") );
|
||||
|
||||
sb_credentials_tbl->Add( m_identity, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_password_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Password:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_password_label->Wrap( -1 );
|
||||
sb_credentials_tbl->Add( m_password_label, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_password = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
|
||||
m_password->SetToolTip( _("Enter your password here") );
|
||||
|
||||
sb_credentials_tbl->Add( m_password, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sb_credentials_vert->Add( sb_credentials_tbl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_remember = new wxCheckBox( sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_remember->SetHelpText( _("Check if you would like to save username and password") );
|
||||
|
||||
sb_credentials_vert->Add( m_remember, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxPasswordCredentialsPanelBase::~wxPasswordCredentialsPanelBase()
|
||||
{
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,154 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WXEAP_UI_H__
|
||||
#define __WXEAP_UI_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class wxEAPBannerPanel;
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/checkbox.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPConfigDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPConfigDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxEAPBannerPanel *m_banner;
|
||||
wxNotebook* m_providers;
|
||||
wxStdDialogButtonSizer* m_buttons;
|
||||
wxButton* m_buttonsOK;
|
||||
wxButton* m_buttonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Method Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPConfigDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPCredentialsDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPCredentialsDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxEAPBannerPanel *m_banner;
|
||||
wxBoxSizer* m_panels;
|
||||
wxStdDialogButtonSizer* m_buttons;
|
||||
wxButton* m_buttonsOK;
|
||||
wxButton* m_buttonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPCredentialsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Credentials"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPCredentialsDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPBannerPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPBannerPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_title;
|
||||
|
||||
public:
|
||||
|
||||
wxEAPBannerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = 0 );
|
||||
~wxEAPBannerPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPCredentialsConfigPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPCredentialsConfigPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_credentials_icon;
|
||||
wxStaticText* m_credentials_label;
|
||||
wxStaticText* m_identity_label;
|
||||
wxTextCtrl* m_identity;
|
||||
wxButton* m_set;
|
||||
wxButton* m_clear;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnSet( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnClear( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPCredentialsConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPCredentialsConfigPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxPasswordCredentialsPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxPasswordCredentialsPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_credentials_icon;
|
||||
wxStaticText* m_credentials_label;
|
||||
wxStaticText* m_identity_label;
|
||||
wxTextCtrl* m_identity;
|
||||
wxStaticText* m_password_label;
|
||||
wxTextCtrl* m_password;
|
||||
wxCheckBox* m_remember;
|
||||
|
||||
public:
|
||||
|
||||
wxPasswordCredentialsPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxPasswordCredentialsPanelBase();
|
||||
|
||||
};
|
||||
|
||||
#endif //__WXEAP_UI_H__
|
@@ -1,188 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#include "wxTLS_UI.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTLSServerTrustConfigPanelBase::wxEAPTLSServerTrustConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_server_trust;
|
||||
sb_server_trust = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Server Trust") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_server_trust_horiz;
|
||||
sb_server_trust_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_server_trust_icon = new wxStaticBitmap( sb_server_trust->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_server_trust_horiz->Add( m_server_trust_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_server_trust_vert;
|
||||
sb_server_trust_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_server_trust_label = new wxStaticText( sb_server_trust->GetStaticBox(), wxID_ANY, _("Describe the servers you trust to prevent credential interception in case of man-in-the-middle attacks."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_server_trust_label->Wrap( 446 );
|
||||
sb_server_trust_vert->Add( m_server_trust_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_root_ca;
|
||||
sb_root_ca = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_root_ca_lbl = new wxStaticText( sb_server_trust->GetStaticBox(), wxID_ANY, _("Acceptable Certificate Authorities:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_root_ca_lbl->Wrap( -1 );
|
||||
sb_root_ca->Add( m_root_ca_lbl, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_root_ca = new wxListBox( sb_server_trust->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SORT );
|
||||
m_root_ca->SetToolTip( _("List of certificate authorities server's certificate must be issued by") );
|
||||
|
||||
sb_root_ca->Add( m_root_ca, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* sb_root_ca_btn;
|
||||
sb_root_ca_btn = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_root_ca_add_store = new wxButton( sb_server_trust->GetStaticBox(), wxID_ANY, _("Add CA from Store..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_root_ca_add_store->SetToolTip( _("Adds a new certificate authority from the certificate store to the list") );
|
||||
|
||||
sb_root_ca_btn->Add( m_root_ca_add_store, 0, wxRIGHT, 5 );
|
||||
|
||||
m_root_ca_add_file = new wxButton( sb_server_trust->GetStaticBox(), wxID_ANY, _("Add CA from File..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_root_ca_add_file->SetToolTip( _("Adds a new certificate authority from the file to the list") );
|
||||
|
||||
sb_root_ca_btn->Add( m_root_ca_add_file, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_root_ca_remove = new wxButton( sb_server_trust->GetStaticBox(), wxID_ANY, _("&Remove CA"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_root_ca_remove->Enable( false );
|
||||
m_root_ca_remove->SetToolTip( _("Removes selected certificate authorities from the list") );
|
||||
|
||||
sb_root_ca_btn->Add( m_root_ca_remove, 0, wxLEFT, 5 );
|
||||
|
||||
|
||||
sb_root_ca->Add( sb_root_ca_btn, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
sb_server_trust_vert->Add( sb_root_ca, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_server_names;
|
||||
sb_server_names = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_server_names_label = new wxStaticText( sb_server_trust->GetStaticBox(), wxID_ANY, _("Acceptable server &names:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_server_names_label->Wrap( -1 );
|
||||
sb_server_names->Add( m_server_names_label, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_server_names = new wxTextCtrl( sb_server_trust->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_server_names->SetToolTip( _("A semicolon delimited list of acceptable server FQDN names; blank to skip name check; \"*\" wildchar allowed") );
|
||||
|
||||
sb_server_names->Add( m_server_names, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_server_names_note = new wxStaticText( sb_server_trust->GetStaticBox(), wxID_ANY, _("(Example: foo.bar.com;*.domain.org)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_server_names_note->Wrap( -1 );
|
||||
sb_server_names->Add( m_server_names_note, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
sb_server_trust_vert->Add( sb_server_names, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_server_trust_horiz->Add( sb_server_trust_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_server_trust->Add( sb_server_trust_horiz, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_server_trust );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_root_ca->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCA ), NULL, this );
|
||||
m_root_ca->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCADClick ), NULL, this );
|
||||
m_root_ca_add_store->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCAAddStore ), NULL, this );
|
||||
m_root_ca_add_file->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCAAddFile ), NULL, this );
|
||||
m_root_ca_remove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCARemove ), NULL, this );
|
||||
}
|
||||
|
||||
wxEAPTLSServerTrustConfigPanelBase::~wxEAPTLSServerTrustConfigPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_root_ca->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCA ), NULL, this );
|
||||
m_root_ca->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCADClick ), NULL, this );
|
||||
m_root_ca_add_store->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCAAddStore ), NULL, this );
|
||||
m_root_ca_add_file->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCAAddFile ), NULL, this );
|
||||
m_root_ca_remove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPTLSServerTrustConfigPanelBase::OnRootCARemove ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
wxEAPTLSCredentialsPanelBase::wxEAPTLSCredentialsPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_credentials;
|
||||
sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("TLS Client Certificate") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_credentials_horiz;
|
||||
sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_credentials_icon = new wxStaticBitmap( sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_credentials_vert;
|
||||
sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please select your client certificate to use for authentication."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_credentials_label->Wrap( 446 );
|
||||
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_cert_radio;
|
||||
sb_cert_radio = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_cert_none = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Co&nnect without providing a client certificate"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
m_cert_none->SetToolTip( _("Select if your server does not require you to provide a client certificate") );
|
||||
|
||||
sb_cert_radio->Add( m_cert_none, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_cert_select;
|
||||
sb_cert_select = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_cert_select = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use the following &certificate:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cert_select->SetToolTip( _("Select if you need to provide a client certificate when connecting") );
|
||||
|
||||
sb_cert_select->Add( m_cert_select, 0, wxEXPAND, 5 );
|
||||
|
||||
wxArrayString m_cert_select_valChoices;
|
||||
m_cert_select_val = new wxChoice( sb_credentials->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cert_select_valChoices, wxCB_SORT );
|
||||
m_cert_select_val->SetSelection( 0 );
|
||||
m_cert_select_val->SetToolTip( _("Client certificate to use for authentication") );
|
||||
|
||||
sb_cert_select->Add( m_cert_select_val, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_cert_radio->Add( sb_cert_select, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials_vert->Add( sb_cert_radio, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_remember = new wxCheckBox( sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_remember->SetHelpText( _("Check if you would like to save certificate selection") );
|
||||
|
||||
sb_credentials_vert->Add( m_remember, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_cert_select->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxEAPTLSCredentialsPanelBase::OnCertSelect ), NULL, this );
|
||||
}
|
||||
|
||||
wxEAPTLSCredentialsPanelBase::~wxEAPTLSCredentialsPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_cert_select->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxEAPTLSCredentialsPanelBase::OnCertSelect ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,96 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WXTLS_UI_H__
|
||||
#define __WXTLS_UI_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/checkbox.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPTLSServerTrustConfigPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPTLSServerTrustConfigPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_server_trust_icon;
|
||||
wxStaticText* m_server_trust_label;
|
||||
wxStaticText* m_root_ca_lbl;
|
||||
wxListBox* m_root_ca;
|
||||
wxButton* m_root_ca_add_store;
|
||||
wxButton* m_root_ca_add_file;
|
||||
wxButton* m_root_ca_remove;
|
||||
wxStaticText* m_server_names_label;
|
||||
wxTextCtrl* m_server_names;
|
||||
wxStaticText* m_server_names_note;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnRootCA( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRootCADClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRootCAAddStore( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRootCAAddFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRootCARemove( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPTLSServerTrustConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPTLSServerTrustConfigPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPTLSCredentialsPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPTLSCredentialsPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_credentials_icon;
|
||||
wxStaticText* m_credentials_label;
|
||||
wxRadioButton* m_cert_none;
|
||||
wxRadioButton* m_cert_select;
|
||||
wxChoice* m_cert_select_val;
|
||||
wxCheckBox* m_remember;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCertSelect( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPTLSCredentialsPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPTLSCredentialsPanelBase();
|
||||
|
||||
};
|
||||
|
||||
#endif //__WXTLS_UI_H__
|
@@ -1,83 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#include "wxTTLS_UI.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTTLSConfigPanelBase::wxEAPTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_outer_identity;
|
||||
sb_outer_identity = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outer Identity") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_outer_identity_horiz;
|
||||
sb_outer_identity_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_outer_identity_icon = new wxStaticBitmap( sb_outer_identity->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_outer_identity_horiz->Add( m_outer_identity_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_outer_identity_vert;
|
||||
sb_outer_identity_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_outer_identity_label = new wxStaticText( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Select the user ID supplicant introduces itself as to authenticator:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_outer_identity_label->Wrap( 446 );
|
||||
sb_outer_identity_vert->Add( m_outer_identity_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_outer_identity_radio;
|
||||
sb_outer_identity_radio = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_outer_identity_same = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&Same as inner identity"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
m_outer_identity_same->SetToolTip( _("Use my true user name") );
|
||||
|
||||
sb_outer_identity_radio->Add( m_outer_identity_same, 1, wxEXPAND, 5 );
|
||||
|
||||
m_outer_identity_empty = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Use &empty outer identity (RFC 4822)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_outer_identity_empty->SetToolTip( _("Ommit my user name and use @mydomain.org only") );
|
||||
|
||||
sb_outer_identity_radio->Add( m_outer_identity_empty, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_outer_identity_custom;
|
||||
sb_outer_identity_custom = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_outer_identity_custom = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&Custom outer identity:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_outer_identity_custom->SetToolTip( _("Specify custom outer identity") );
|
||||
|
||||
sb_outer_identity_custom->Add( m_outer_identity_custom, 0, wxEXPAND, 5 );
|
||||
|
||||
m_outer_identity_custom_val = new wxTextCtrl( sb_outer_identity->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_outer_identity_custom_val->SetToolTip( _("Custom outer identity to use") );
|
||||
|
||||
sb_outer_identity_custom->Add( m_outer_identity_custom_val, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_outer_identity_radio->Add( sb_outer_identity_custom, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_outer_identity_vert->Add( sb_outer_identity_radio, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_outer_identity_horiz->Add( sb_outer_identity_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_outer_identity->Add( sb_outer_identity_horiz, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_outer_identity );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_outer_identity_custom->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxEAPTTLSConfigPanelBase::OnOuterIdentityCustom ), NULL, this );
|
||||
}
|
||||
|
||||
wxEAPTTLSConfigPanelBase::~wxEAPTTLSConfigPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_outer_identity_custom->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxEAPTTLSConfigPanelBase::OnOuterIdentityCustom ), NULL, this );
|
||||
|
||||
}
|
@@ -1,655 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">.</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">wxTTLS_UI</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">wxTTLS_UI</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header">#include <StdAfx.h></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">1</property>
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">wxEAPTTLSConfigPanelBase</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">500,-1</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Outer Identity</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sb_outer_identity</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sb_outer_identity_horiz</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap">Load From Icon Resource; ; [32; 32]</property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_icon</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sb_outer_identity_vert</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Select the user ID supplicant introduces itself as to authenticator:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_label</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">446</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sb_outer_identity_radio</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxRadioButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">&Same as inner identity</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_same</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRB_GROUP</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Use my true user name</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioButton"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxRadioButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Use &empty outer identity (RFC 4822)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_empty</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Ommit my user name and use @mydomain.org only</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioButton"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sb_outer_identity_custom</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">&Custom outer identity:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_custom</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Specify custom outer identity</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioButton">OnOuterIdentityCustom</event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_outer_identity_custom_val</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Custom outer identity to use</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
@@ -1,58 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WXTTLS_UI_H__
|
||||
#define __WXTTLS_UI_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPTTLSConfigPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPTTLSConfigPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_outer_identity_icon;
|
||||
wxStaticText* m_outer_identity_label;
|
||||
wxRadioButton* m_outer_identity_same;
|
||||
wxRadioButton* m_outer_identity_empty;
|
||||
wxRadioButton* m_outer_identity_custom;
|
||||
wxTextCtrl* m_outer_identity_custom_val;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnOuterIdentityCustom( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPTTLSConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPTTLSConfigPanelBase();
|
||||
|
||||
};
|
||||
|
||||
#endif //__WXTTLS_UI_H__
|
@@ -1,727 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::session
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::session::session()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::session::~session()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::begin(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ DWORD dwMaxSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||
UNREFERENCED_PARAMETER(dwConnectionDataSize);
|
||||
UNREFERENCED_PARAMETER(pConnectionData);
|
||||
UNREFERENCED_PARAMETER(dwUserDataSize);
|
||||
UNREFERENCED_PARAMETER(pUserData);
|
||||
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::end(_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwReceivedPacketSize);
|
||||
UNREFERENCED_PARAMETER(pReceivedPacket);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::get_response_packet(
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pdwSendPacketSize);
|
||||
UNREFERENCED_PARAMETER(pSendPacket);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::get_result(_In_ EapPeerMethodResultReason reason, _Out_ EapPeerMethodResult *ppResult, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(reason);
|
||||
UNREFERENCED_PARAMETER(ppResult);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::get_ui_context(
|
||||
_Out_ DWORD *pdwUIContextDataSize,
|
||||
_Out_ BYTE **ppUIContextData,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pdwUIContextDataSize);
|
||||
UNREFERENCED_PARAMETER(ppUIContextData);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::set_ui_context(
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ const EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwUIContextDataSize);
|
||||
UNREFERENCED_PARAMETER(pUIContextData);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::get_response_attributes(_Out_ EapAttributes *pAttribs, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::session::set_response_attributes(const _In_ EapAttributes *pAttribs, _Out_ EapPeerMethodOutput *pEapOutput, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::config
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config::config(_In_ module &mod) :
|
||||
m_module(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config::config(_In_ const config &other) :
|
||||
m_module(other.m_module)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config::config(_Inout_ config &&other) :
|
||||
m_module(other.m_module)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config::~config()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config& eap::config::operator=(_In_ const config &other)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(other);
|
||||
assert(&m_module == &other.m_module); // Copy configuration within same module only!
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config& eap::config::operator=(_Inout_ config &&other)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(other);
|
||||
assert(&m_module == &other.m_module); // Copy configuration within same module only!
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::config_method
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_method::config_method(_In_ module &mod) :
|
||||
m_allow_save(true),
|
||||
config(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_method::config_method(_In_ const config_method &other) :
|
||||
m_allow_save(other.m_allow_save),
|
||||
m_anonymous_identity(other.m_anonymous_identity),
|
||||
config(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_method::config_method(_Inout_ config_method &&other) :
|
||||
m_allow_save(std::move(other.m_allow_save)),
|
||||
m_anonymous_identity(std::move(other.m_anonymous_identity)),
|
||||
config(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_method& eap::config_method::operator=(_In_ const config_method &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = other;
|
||||
m_allow_save = other.m_allow_save;
|
||||
m_anonymous_identity = other.m_anonymous_identity;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&&)*this = std::move(other);
|
||||
m_allow_save = std::move(other.m_allow_save);
|
||||
m_anonymous_identity = std::move(other.m_anonymous_identity);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_method::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
DWORD dwResult;
|
||||
|
||||
// <ClientSideCredential>
|
||||
com_obj<IXMLDOMElement> pXmlElClientSideCredential;
|
||||
if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <ClientSideCredential> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// <ClientSideCredential>/<allow-save>
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, bstr(L"allow-save"), bstrNamespace, m_allow_save)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <allow-save> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// <ClientSideCredential>/<AnonymousIdentity>
|
||||
if (!m_anonymous_identity.empty())
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, bstr(L"AnonymousIdentity"), bstrNamespace, bstr(m_anonymous_identity))) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <AnonymousIdentity> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_method::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
m_allow_save = true;
|
||||
m_anonymous_identity.clear();
|
||||
|
||||
// <ClientSideCredential>
|
||||
com_obj<IXMLDOMElement> pXmlElClientSideCredential;
|
||||
if (eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential) == ERROR_SUCCESS) {
|
||||
// <allow-save>
|
||||
eapxml::get_element_value(pXmlElClientSideCredential, bstr(L"eap-metadata:allow-save"), &m_allow_save);
|
||||
|
||||
// <AnonymousIdentity>
|
||||
eapxml::get_element_value(pXmlElClientSideCredential, bstr(L"eap-metadata:AnonymousIdentity"), m_anonymous_identity);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials::credentials(_In_ module &mod) : config(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials::credentials(_In_ const credentials &other) :
|
||||
m_identity(other.m_identity),
|
||||
config(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials::credentials(_Inout_ credentials &&other) :
|
||||
m_identity(std::move(other.m_identity)),
|
||||
config(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials& eap::credentials::operator=(_In_ const credentials &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = other;
|
||||
m_identity = other.m_identity;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials& eap::credentials::operator=(_Inout_ credentials &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = std::move(other);
|
||||
m_identity = std::move(other.m_identity);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials::clear()
|
||||
{
|
||||
m_identity.clear();
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials::empty() const
|
||||
{
|
||||
return m_identity.empty();
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pDoc);
|
||||
UNREFERENCED_PARAMETER(pConfigRoot);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
// Yeah, right!? Credentials are non-exportable!
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials_pass
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials_pass::credentials_pass(_In_ module &mod) : credentials(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pass::credentials_pass(_In_ const credentials_pass &other) :
|
||||
m_password(other.m_password),
|
||||
credentials(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pass::credentials_pass(_Inout_ credentials_pass &&other) :
|
||||
m_password(std::move(other.m_password)),
|
||||
credentials(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pass& eap::credentials_pass::operator=(_In_ const credentials_pass &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials&)*this = other;
|
||||
m_password = other.m_password;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pass& eap::credentials_pass::operator=(_Inout_ credentials_pass &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials&)*this = std::move(other);
|
||||
m_password = std::move(other.m_password);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_pass::clear()
|
||||
{
|
||||
credentials::clear();
|
||||
m_password.clear();
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_pass::empty() const
|
||||
{
|
||||
return credentials::empty() && m_password.empty();
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity);
|
||||
|
||||
bstr pass;
|
||||
if ((eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), &pass)) == ERROR_SUCCESS)
|
||||
m_password = pass;
|
||||
SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length());
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
assert(pszTargetName);
|
||||
assert(ppEapError);
|
||||
DWORD dwResult;
|
||||
string password_enc;
|
||||
|
||||
// Prepare cryptographics provider.
|
||||
crypt_prov cp;
|
||||
if (!cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CryptAcquireContext failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Import the public key.
|
||||
HRSRC res = FindResource(m_module.m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PUBLIC), RT_RCDATA);
|
||||
assert(res);
|
||||
HGLOBAL res_handle = LoadResource(m_module.m_instance, res);
|
||||
assert(res_handle);
|
||||
crypt_key key;
|
||||
unique_ptr<CERT_PUBLIC_KEY_INFO, LocalFree_delete<CERT_PUBLIC_KEY_INFO> > keyinfo_data;
|
||||
DWORD keyinfo_size = 0;
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, (const BYTE*)::LockResource(res_handle), ::SizeofResource(m_module.m_instance, res), CRYPT_DECODE_ALLOC_FLAG, NULL, &keyinfo_data, &keyinfo_size)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CryptDecodeObjectEx failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if (!key.import_public(cp, X509_ASN_ENCODING, keyinfo_data.get())) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Public key import failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Convert password to UTF-8.
|
||||
sanitizing_string password_utf8;
|
||||
WideCharToMultiByte(CP_UTF8, 0, m_password.c_str(), (int)m_password.length(), password_utf8, NULL, NULL);
|
||||
|
||||
// Pre-allocate memory to allow space, as encryption will grow the data, and we need additional 16B at the end for MD5 hash.
|
||||
DWORD dwBlockLen;
|
||||
vector<char, sanitizing_allocator<char> > password(password_utf8.length());
|
||||
memcpy(password.data(), password_utf8.c_str(), sizeof(char)*password_utf8.length());
|
||||
if (!CryptGetKeyParam(key, KP_BLOCKLEN, dwBlockLen, 0)) dwBlockLen = 0;
|
||||
password.reserve((password.size() + dwBlockLen - 1) / dwBlockLen * dwBlockLen + 16);
|
||||
|
||||
// Encrypt the password using our public key. Calculate MD5 hash and append it.
|
||||
crypt_hash hash;
|
||||
if (!hash.create(cp, CALG_MD5)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Creating MD5 hash failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
if (!CryptEncrypt(key, hash, TRUE, 0, password)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Encrypting password failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
vector<char> hash_bin;
|
||||
CryptGetHashParam(hash, HP_HASHVAL, hash_bin, 0);
|
||||
password.insert(password.end(), hash_bin.begin(), hash_bin.end());
|
||||
|
||||
// Convert encrypted password to Base64, since CredProtectA() fail for binary strings.
|
||||
string password_base64;
|
||||
base64_enc enc;
|
||||
enc.encode(password_base64, password.data(), password.size());
|
||||
|
||||
// Encrypt the password using user's key.
|
||||
CRED_PROTECTION_TYPE cpt;
|
||||
if (!CredProtectA(TRUE, password_base64.c_str(), (DWORD)password_base64.length(), password_enc, &cpt)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredProtect failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
tstring target(target_name(pszTargetName));
|
||||
|
||||
// Write credentials.
|
||||
assert(password_enc.size()*sizeof(char) < CRED_MAX_CREDENTIAL_BLOB_SIZE);
|
||||
assert(m_identity.length() < CRED_MAX_USERNAME_LENGTH );
|
||||
CREDENTIAL cred = {
|
||||
0, // Flags
|
||||
CRED_TYPE_GENERIC, // Type
|
||||
(LPTSTR)target.c_str(), // TargetName
|
||||
_T(""), // Comment
|
||||
{ 0, 0 }, // LastWritten
|
||||
(DWORD)password_enc.size()*sizeof(char), // CredentialBlobSize
|
||||
(LPBYTE)password_enc.data(), // CredentialBlob
|
||||
CRED_PERSIST_ENTERPRISE, // Persist
|
||||
0, // AttributeCount
|
||||
NULL, // Attributes
|
||||
NULL, // TargetAlias
|
||||
(LPTSTR)m_identity.c_str() // UserName
|
||||
};
|
||||
if (!CredWrite(&cred, 0)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredWrite failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(pszTargetName);
|
||||
DWORD dwResult;
|
||||
|
||||
// Read credentials.
|
||||
unique_ptr<CREDENTIAL, CredFree_delete<CREDENTIAL> > cred;
|
||||
if (!CredRead(target_name(pszTargetName).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredRead failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
m_identity = cred->UserName;
|
||||
|
||||
// Decrypt the password using user's key.
|
||||
string password_base64;
|
||||
if (!CredUnprotectA(TRUE, (LPCSTR)(cred->CredentialBlob), cred->CredentialBlobSize/sizeof(char), password_base64)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredUnprotect failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Convert Base64 to binary encrypted password, since CredProtectA() fail for binary strings.
|
||||
vector<char, sanitizing_allocator<char> > password;
|
||||
base64_dec dec;
|
||||
bool is_last;
|
||||
dec.decode(password, is_last, password_base64.c_str(), password_base64.length());
|
||||
|
||||
// Prepare cryptographics provider.
|
||||
crypt_prov cp;
|
||||
if (!cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CryptAcquireContext failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Create hash.
|
||||
crypt_hash hash;
|
||||
if (!hash.create(cp, CALG_MD5)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Creating MD5 hash failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
DWORD dwHashSize, dwHashSizeSize = sizeof(dwHashSize);
|
||||
CryptGetHashParam(hash, HP_HASHSIZE, (LPBYTE)&dwHashSize, &dwHashSizeSize, 0);
|
||||
if (password.size() < dwHashSize) {
|
||||
*ppEapError = m_module.make_error(dwResult = ERROR_INVALID_DATA, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Encrypted password too short."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Truncate hash from encrypted password.
|
||||
vector<char> hash_bin;
|
||||
size_t enc_size = password.size() - dwHashSize;
|
||||
hash_bin.assign(password.begin() + enc_size, password.end());
|
||||
password.resize(enc_size);
|
||||
|
||||
// Import the private key.
|
||||
HRSRC res = FindResource(m_module.m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PRIVATE), RT_RCDATA);
|
||||
assert(res);
|
||||
HGLOBAL res_handle = LoadResource(m_module.m_instance, res);
|
||||
assert(res_handle);
|
||||
crypt_key key;
|
||||
unique_ptr<unsigned char[], LocalFree_delete<unsigned char[]> > keyinfo_data;
|
||||
DWORD keyinfo_size = 0;
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, PKCS_RSA_PRIVATE_KEY, (const BYTE*)::LockResource(res_handle), ::SizeofResource(m_module.m_instance, res), CRYPT_DECODE_ALLOC_FLAG, NULL, &keyinfo_data, &keyinfo_size)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CryptDecodeObjectEx failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if (!key.import(cp, keyinfo_data.get(), keyinfo_size, NULL, 0)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Private key import failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Decrypt the password using our private key. Calculate MD5 hash and verify it.
|
||||
if (!CryptDecrypt(key, hash, TRUE, 0, password)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Decrypting password failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
vector<char> hash2_bin;
|
||||
CryptGetHashParam(hash, HP_HASHVAL, hash2_bin, 0);
|
||||
if (hash_bin != hash2_bin) {
|
||||
*ppEapError = m_module.make_error(dwResult = ERROR_INVALID_DATA, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Invalid password data."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Convert password from UTF-8.
|
||||
MultiByteToWideChar(CP_UTF8, 0, password.data(), (int)password.size(), m_password);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::module
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::module::module() :
|
||||
m_instance(NULL)
|
||||
{
|
||||
m_ep.create(&EAPMETHOD_TRACE_EVENT_PROVIDER);
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_LOAD, event_data((BYTE)EAPMETHOD_TYPE), event_data::blank);
|
||||
|
||||
m_heap.create(0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
eap::module::~module()
|
||||
{
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_UNLOAD, event_data((BYTE)EAPMETHOD_TYPE), event_data::blank);
|
||||
}
|
||||
|
||||
|
||||
EAP_ERROR* eap::module::make_error(_In_ DWORD dwErrorCode, _In_ DWORD dwReasonCode, _In_ LPCGUID pRootCauseGuid, _In_ LPCGUID pRepairGuid, _In_ LPCGUID pHelpLinkGuid, _In_z_ LPCWSTR pszRootCauseString, _In_z_ LPCWSTR pszRepairString) const
|
||||
{
|
||||
// Calculate memory size requirement.
|
||||
SIZE_T
|
||||
nRootCauseSize = pszRootCauseString != NULL && pszRootCauseString[0] ? (wcslen(pszRootCauseString) + 1)*sizeof(WCHAR) : 0,
|
||||
nRepairStringSize = pszRepairString != NULL && pszRepairString [0] ? (wcslen(pszRepairString ) + 1)*sizeof(WCHAR) : 0,
|
||||
nEapErrorSize = sizeof(EAP_ERROR) + nRootCauseSize + nRepairStringSize;
|
||||
|
||||
EAP_ERROR *pError = (EAP_ERROR*)HeapAlloc(m_heap, 0, nEapErrorSize);
|
||||
if (!pError)
|
||||
return NULL;
|
||||
BYTE *p = (BYTE*)(pError + 1);
|
||||
|
||||
// Fill the error descriptor.
|
||||
pError->dwWinError = dwErrorCode;
|
||||
pError->type.eapType.type = EAPMETHOD_TYPE;
|
||||
pError->type.eapType.dwVendorId = 0;
|
||||
pError->type.eapType.dwVendorType = 0;
|
||||
pError->type.dwAuthorId = 67532;
|
||||
pError->dwReasonCode = dwReasonCode;
|
||||
pError->rootCauseGuid = pRootCauseGuid != NULL ? *pRootCauseGuid : GUID_NULL;
|
||||
pError->repairGuid = pRepairGuid != NULL ? *pRepairGuid : GUID_NULL;
|
||||
pError->helpLinkGuid = pHelpLinkGuid != NULL ? *pHelpLinkGuid : GUID_NULL;
|
||||
if (nRootCauseSize) {
|
||||
pError->pRootCauseString = (LPWSTR)p;
|
||||
memcpy(pError->pRootCauseString, pszRootCauseString, nRootCauseSize);
|
||||
p += nRootCauseSize;
|
||||
} else
|
||||
pError->pRootCauseString = NULL;
|
||||
if (nRepairStringSize) {
|
||||
pError->pRepairString = (LPWSTR)p;
|
||||
memcpy(pError->pRepairString, pszRepairString, nRepairStringSize);
|
||||
p += nRepairStringSize;
|
||||
} else
|
||||
pError->pRepairString = NULL;
|
||||
|
||||
// Write trace event.
|
||||
vector<EVENT_DATA_DESCRIPTOR> evt_desc;
|
||||
evt_desc.reserve(8);
|
||||
evt_desc.push_back(event_data(pError->dwWinError));
|
||||
evt_desc.push_back(event_data(pError->type.eapType.type));
|
||||
evt_desc.push_back(event_data(pError->dwReasonCode));
|
||||
evt_desc.push_back(event_data(&(pError->rootCauseGuid), sizeof(GUID)));
|
||||
evt_desc.push_back(event_data(&(pError->repairGuid), sizeof(GUID)));
|
||||
evt_desc.push_back(event_data(&(pError->helpLinkGuid), sizeof(GUID)));
|
||||
evt_desc.push_back(event_data(pError->pRootCauseString));
|
||||
evt_desc.push_back(event_data(pError->pRepairString));
|
||||
m_ep.write(&EAPMETHOD_TRACE_EAP_ERROR, (ULONG)evt_desc.size(), evt_desc.data());
|
||||
|
||||
return pError;
|
||||
}
|
||||
|
||||
|
||||
BYTE* eap::module::alloc_memory(_In_ size_t size)
|
||||
{
|
||||
return (BYTE*)HeapAlloc(m_heap, 0, size);
|
||||
}
|
||||
|
||||
|
||||
void eap::module::free_memory(_In_ BYTE *ptr)
|
||||
{
|
||||
ETW_FN_VOID;
|
||||
|
||||
// Since we do security here and some of the BLOBs contain credentials, sanitize every memory block before freeing.
|
||||
SecureZeroMemory(ptr, HeapSize(m_heap, 0, ptr));
|
||||
HeapFree(m_heap, 0, ptr);
|
||||
}
|
||||
|
||||
|
||||
void eap::module::free_error_memory(_In_ EAP_ERROR *err)
|
||||
{
|
||||
ETW_FN_VOID;
|
||||
|
||||
// pRootCauseString and pRepairString always trail the ppEapError to reduce number of (de)allocations.
|
||||
HeapFree(m_heap, 0, err);
|
||||
}
|
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPCredentialsDialog
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPCredentialsDialog::wxEAPCredentialsDialog(wxWindow* parent) : wxEAPCredentialsDialogBase(parent)
|
||||
{
|
||||
// Set extra style here, as wxFormBuilder overrides all default flags.
|
||||
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
|
||||
|
||||
m_buttonsOK->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPCredentialsDialog::AddContents(wxPanel **contents, size_t content_count)
|
||||
{
|
||||
if (content_count) {
|
||||
for (size_t i = 0; i < content_count; i++)
|
||||
m_panels->Add(contents[i], 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
this->Layout();
|
||||
this->GetSizer()->Fit(this);
|
||||
contents[0]->SetFocusFromKbd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEAPCredentialsDialog::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
|
||||
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPBannerPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPBannerPanel::wxEAPBannerPanel(wxWindow* parent) : wxEAPBannerPanelBase(parent)
|
||||
{
|
||||
m_title->SetLabelText(wxT(PRODUCT_NAME_STR));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxPasswordCredentialsPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
const wxStringCharType *wxPasswordCredentialsPanel::s_dummy_password = wxT("dummypass");
|
||||
|
||||
|
||||
wxPasswordCredentialsPanel::wxPasswordCredentialsPanel(eap::credentials_pass &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config) :
|
||||
wxCredentialsPanel<wxPasswordCredentialsPanelBase, eap::credentials_pass>(cred, pszCredTarget, parent, is_config)
|
||||
{
|
||||
// Load and set icon.
|
||||
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(269));
|
||||
}
|
||||
|
||||
|
||||
bool wxPasswordCredentialsPanel::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK(__super::TransferDataToWindow(), false);
|
||||
|
||||
m_identity->SetValue(m_cred.m_identity);
|
||||
m_identity->SetSelection(0, -1);
|
||||
m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : s_dummy_password);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxPasswordCredentialsPanel::TransferDataFromWindow()
|
||||
{
|
||||
m_cred.m_identity = m_identity->GetValue();
|
||||
|
||||
wxString pass = m_password->GetValue();
|
||||
if (pass.compare(s_dummy_password) != 0) {
|
||||
m_cred.m_password = pass;
|
||||
pass.assign(pass.length(), wxT('*'));
|
||||
}
|
||||
|
||||
return __super::TransferDataFromWindow();
|
||||
}
|
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#pragma comment(lib, "msxml6.lib")
|
||||
|
||||
|
||||
#if EAPMETHOD_TYPE==21
|
||||
#define _EAPMETHOD_PEER_UI eap::peer_ttls_ui
|
||||
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::config_pap
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_pap::config_pap(_In_ module &mod) : config_pass(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_pap::config_pap(_In_ const config_pap &other) :
|
||||
config_pass(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_pap::config_pap(_Inout_ config_pap &&other) :
|
||||
config_pass(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_pap& eap::config_pap::operator=(_In_ const config_pap &other)
|
||||
{
|
||||
if (this != &other)
|
||||
(config_pass&)*this = other;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config_pap& eap::config_pap::operator=(_Inout_ config_pap &&other)
|
||||
{
|
||||
if (this != &other)
|
||||
(config_pass&&)*this = std::move(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials_pap
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials_pap::credentials_pap(_In_ module &mod) : credentials_pass(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pap::credentials_pap(_In_ const credentials_pap &other) :
|
||||
credentials_pass(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pap::credentials_pap(_Inout_ credentials_pap &&other) :
|
||||
credentials_pass(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pap& eap::credentials_pap::operator=(_In_ const credentials_pap &other)
|
||||
{
|
||||
if (this != &other)
|
||||
(credentials_pass&)*this = other;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_pap& eap::credentials_pap::operator=(_Inout_ credentials_pap &&other)
|
||||
{
|
||||
if (this != &other)
|
||||
(credentials_pass&&)*this = std::move(other);
|
||||
|
||||
return *this;
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxPAPConfigPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxPAPConfigPanel::wxPAPConfigPanel(eap::config_pap &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : wxPanel(parent)
|
||||
{
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
if (cfg.m_allow_save) {
|
||||
m_credentials = new wxPAPCredentialsConfigPanel(cfg, pszCredTarget, this);
|
||||
sb_content->Add(m_credentials, 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
m_label = NULL;
|
||||
} else {
|
||||
m_credentials = NULL;
|
||||
|
||||
m_label = new wxStaticText(this, wxID_ANY, _("This method requires no additional settings."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_label->Wrap(-1);
|
||||
sb_content->Add(m_label, 0, wxALL|wxEXPAND, 5);
|
||||
}
|
||||
|
||||
sb_content->Add(10, 10, 1, wxEXPAND, 5);
|
||||
|
||||
this->SetSizer(sb_content);
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxPAPConfigPanel::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
wxPAPConfigPanel::~wxPAPConfigPanel()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxPAPConfigPanel::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
void wxPAPConfigPanel::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
// Forward the event to child panels.
|
||||
if (m_credentials)
|
||||
m_credentials->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
@@ -1,329 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::config_tls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_tls::config_tls(_In_ module &mod) : config_method(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_tls::config_tls(_In_ const config_tls &other) :
|
||||
m_trusted_root_ca(other.m_trusted_root_ca),
|
||||
m_server_names(other.m_server_names),
|
||||
config_method(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_tls::config_tls(_Inout_ config_tls &&other) :
|
||||
m_trusted_root_ca(std::move(other.m_trusted_root_ca)),
|
||||
m_server_names(std::move(other.m_server_names)),
|
||||
config_method(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_tls& eap::config_tls::operator=(_In_ const eap::config_tls &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config_method&)*this = other;
|
||||
m_trusted_root_ca = other.m_trusted_root_ca;
|
||||
m_server_names = other.m_server_names;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config_tls& eap::config_tls::operator=(_Inout_ eap::config_tls &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config_method&&)*this = std::move(other);
|
||||
m_trusted_root_ca = std::move(other.m_trusted_root_ca);
|
||||
m_server_names = std::move(other.m_server_names);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
|
||||
// <ServerSideCredential>
|
||||
com_obj<IXMLDOMElement> pXmlElServerSideCredential;
|
||||
if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), bstrNamespace, &pXmlElServerSideCredential)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <ServerSideCredential> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
for (list<cert_context>::const_iterator i = m_trusted_root_ca.begin(), i_end = m_trusted_root_ca.end(); i != i_end; ++i) {
|
||||
// <CA>
|
||||
com_obj<IXMLDOMElement> pXmlElCA;
|
||||
if ((dwResult = eapxml::create_element(pDoc, bstr(L"CA"), bstrNamespace, &pXmlElCA))) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <CA> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// <CA>/<format>
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElCA, bstr(L"format"), bstrNamespace, bstr(L"PEM"))) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <format> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// <CA>/<cert-data>
|
||||
const cert_context &cc = *i;
|
||||
if ((dwResult = eapxml::put_element_base64(pDoc, pXmlElCA, bstr(L"cert-data"), bstrNamespace, cc->pbCertEncoded, cc->cbCertEncoded)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <cert-data> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if (FAILED(hr = pXmlElServerSideCredential->appendChild(pXmlElCA, NULL))) {
|
||||
*ppEapError = m_module.make_error(dwResult = HRESULT_CODE(hr), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error appending <CA> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
}
|
||||
|
||||
// <ServerName>
|
||||
for (list<string>::const_iterator i = m_server_names.begin(), i_end = m_server_names.end(); i != i_end; ++i) {
|
||||
wstring str;
|
||||
MultiByteToWideChar(CP_UTF8, 0, i->c_str(), (int)i->length(), str);
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElServerSideCredential, bstr(L"ServerName"), bstrNamespace, bstr(str))) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <ServerName> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
}
|
||||
|
||||
return config_method::save(pDoc, pConfigRoot, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
m_trusted_root_ca.clear();
|
||||
m_server_names.clear();
|
||||
|
||||
// <ServerSideCredential>
|
||||
com_obj<IXMLDOMElement> pXmlElServerSideCredential;
|
||||
if (eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), &pXmlElServerSideCredential) == ERROR_SUCCESS) {
|
||||
// <CA>
|
||||
com_obj<IXMLDOMNodeList> pXmlListCAs;
|
||||
long lCACount = 0;
|
||||
if (eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:CA"), &pXmlListCAs) == ERROR_SUCCESS && SUCCEEDED(pXmlListCAs->get_length(&lCACount))) {
|
||||
for (long j = 0; j < lCACount; j++) {
|
||||
// Load CA certificate.
|
||||
com_obj<IXMLDOMNode> pXmlElCA;
|
||||
pXmlListCAs->get_item(j, &pXmlElCA);
|
||||
bstr bstrFormat;
|
||||
if (eapxml::get_element_value(pXmlElCA, bstr(L"eap-metadata:format"), &bstrFormat) == ERROR_SUCCESS) {
|
||||
if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrFormat, bstrFormat.length(), L"PEM", -1, NULL, NULL, 0) == CSTR_EQUAL) {
|
||||
vector<unsigned char> aData;
|
||||
if (eapxml::get_element_base64(pXmlElCA, bstr(L"eap-metadata:cert-data"), aData) == ERROR_SUCCESS)
|
||||
add_trusted_ca(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, aData.data(), (DWORD)aData.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <ServerName>
|
||||
com_obj<IXMLDOMNodeList> pXmlListServerIDs;
|
||||
long lServerIDCount = 0;
|
||||
if (eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:ServerName"), &pXmlListServerIDs) == ERROR_SUCCESS && SUCCEEDED(pXmlListServerIDs->get_length(&lServerIDCount))) {
|
||||
for (long j = 0; j < lServerIDCount; j++) {
|
||||
// Load server name (<ServerName>).
|
||||
com_obj<IXMLDOMNode> pXmlElServerID;
|
||||
pXmlListServerIDs->get_item(j, &pXmlElServerID);
|
||||
bstr bstrServerID;
|
||||
pXmlElServerID->get_text(&bstrServerID);
|
||||
|
||||
// Server names (FQDNs) are always ASCII. Hopefully. Convert them to UTF-8 anyway for consistent comparison. CP_ANSI varies.
|
||||
string str;
|
||||
WideCharToMultiByte(CP_UTF8, 0, bstrServerID, bstrServerID.length(), str, NULL, NULL);
|
||||
|
||||
m_server_names.push_back(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return config_method::load(pConfigRoot, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
bool eap::config_tls::add_trusted_ca(_In_ DWORD dwCertEncodingType, _In_ const BYTE *pbCertEncoded, _In_ DWORD cbCertEncoded)
|
||||
{
|
||||
cert_context cert;
|
||||
if (!cert.create(dwCertEncodingType, pbCertEncoded, cbCertEncoded)) {
|
||||
// Invalid or unsupported certificate.
|
||||
return false;
|
||||
}
|
||||
|
||||
for (list<cert_context>::const_iterator i = m_trusted_root_ca.cbegin(), i_end = m_trusted_root_ca.cend();; ++i) {
|
||||
if (i != i_end) {
|
||||
if (*i == cert) {
|
||||
// This certificate is already on the list.
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// End of list reached. Append certificate.
|
||||
m_trusted_root_ca.push_back(std::move(cert));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials_tls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials_tls::credentials_tls(_In_ module &mod) : credentials(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_tls::credentials_tls(_In_ const credentials_tls &other) :
|
||||
m_cert_hash(other.m_cert_hash),
|
||||
credentials(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_tls::credentials_tls(_Inout_ credentials_tls &&other) :
|
||||
m_cert_hash(std::move(m_cert_hash)),
|
||||
credentials(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_tls& eap::credentials_tls::operator=(_In_ const credentials_tls &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials&)*this = other;
|
||||
m_cert_hash = other.m_cert_hash;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_tls& eap::credentials_tls::operator=(_Inout_ credentials_tls &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials&)*this = std::move(other);
|
||||
m_cert_hash = std::move(other.m_cert_hash);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void eap::credentials_tls::clear()
|
||||
{
|
||||
credentials::clear();
|
||||
m_cert_hash.clear();
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_tls::empty() const
|
||||
{
|
||||
return credentials::empty() && m_cert_hash.empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
DWORD eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
eapxml::get_element_hex(pConfigRoot, bstr(L"CertHash"), m_cert_hash);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_tls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
assert(pszTargetName);
|
||||
assert(ppEapError);
|
||||
DWORD dwResult;
|
||||
|
||||
tstring target(target_name(pszTargetName));
|
||||
|
||||
// Write credentials.
|
||||
assert(m_cert_hash.size()*sizeof(char) < CRED_MAX_CREDENTIAL_BLOB_SIZE);
|
||||
assert(m_identity.length() < CRED_MAX_USERNAME_LENGTH );
|
||||
CREDENTIAL cred = {
|
||||
0, // Flags
|
||||
CRED_TYPE_GENERIC, // Type
|
||||
(LPTSTR)target.c_str(), // TargetName
|
||||
_T(""), // Comment
|
||||
{ 0, 0 }, // LastWritten
|
||||
(DWORD)m_cert_hash.size()*sizeof(char), // CredentialBlobSize
|
||||
(LPBYTE)m_cert_hash.data(), // CredentialBlob
|
||||
CRED_PERSIST_ENTERPRISE, // Persist
|
||||
0, // AttributeCount
|
||||
NULL, // Attributes
|
||||
NULL, // TargetAlias
|
||||
(LPTSTR)m_identity.c_str() // UserName
|
||||
};
|
||||
if (!CredWrite(&cred, 0)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredWrite failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_tls::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(pszTargetName && _tcslen(pszTargetName) < CRED_MAX_GENERIC_TARGET_NAME_LENGTH);
|
||||
DWORD dwResult;
|
||||
|
||||
// Read credentials.
|
||||
unique_ptr<CREDENTIAL, CredFree_delete<CREDENTIAL> > cred;
|
||||
if (!CredRead(target_name(pszTargetName).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred)) {
|
||||
*ppEapError = m_module.make_error(dwResult = GetLastError(), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" CredRead failed."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if (cred->UserName)
|
||||
m_identity = cred->UserName;
|
||||
else
|
||||
m_identity.clear();
|
||||
|
||||
m_cert_hash.assign(cred->CredentialBlob, cred->CredentialBlob + cred->CredentialBlobSize);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
@@ -1,658 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#pragma comment(lib, "Cryptui.lib")
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::get_cert_title
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void eap::get_cert_title(PCCERT_CONTEXT cert, winstd::tstring &title)
|
||||
{
|
||||
winstd::tstring name, str, issuer;
|
||||
FILETIME ft;
|
||||
SYSTEMTIME st;
|
||||
|
||||
title.clear();
|
||||
|
||||
// Prepare certificate information
|
||||
CertGetNameString(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, name);
|
||||
title += name;
|
||||
|
||||
FileTimeToLocalFileTime(&(cert->pCertInfo->NotBefore), &ft);
|
||||
FileTimeToSystemTime(&ft, &st);
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, str);
|
||||
title += _T(", ");
|
||||
title += str;
|
||||
|
||||
FileTimeToLocalFileTime(&(cert->pCertInfo->NotAfter ), &ft);
|
||||
FileTimeToSystemTime(&ft, &st);
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, str);
|
||||
title += _T('-');
|
||||
title += str;
|
||||
|
||||
CertGetNameString(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, issuer);
|
||||
if (name != issuer) {
|
||||
title += _T(", ");
|
||||
title += issuer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxCertificateClientData
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxCertificateClientData::wxCertificateClientData(PCCERT_CONTEXT cert) : m_cert(cert)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateClientData::~wxCertificateClientData()
|
||||
{
|
||||
if (m_cert)
|
||||
CertFreeCertificateContext(m_cert);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxCertificateSelectionClientData
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData(const wchar_t *identity, unsigned char *hash, size_t hash_size) :
|
||||
m_identity(identity),
|
||||
m_hash(hash, hash + hash_size)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData(const std::wstring &identity, const std::vector<unsigned char> &hash) :
|
||||
m_identity(identity),
|
||||
m_hash(hash)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData(std::wstring &&identity, std::vector<unsigned char> &&hash) :
|
||||
m_identity(std::move(identity)),
|
||||
m_hash(std::move(hash))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData(const wxCertificateSelectionClientData &other) :
|
||||
m_identity(other.m_identity),
|
||||
m_hash(other.m_hash)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxCertificateSelectionClientData::wxCertificateSelectionClientData(wxCertificateSelectionClientData &&other) :
|
||||
m_identity(std::move(other.m_identity)),
|
||||
m_hash(std::move(other.m_hash))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxHostNameValidator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxHostNameValidator, wxValidator);
|
||||
|
||||
|
||||
wxHostNameValidator::wxHostNameValidator(std::string *val) :
|
||||
m_val(val),
|
||||
wxValidator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxHostNameValidator::wxHostNameValidator(const wxHostNameValidator &other) :
|
||||
m_val(other.m_val),
|
||||
wxValidator(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxObject* wxHostNameValidator::Clone() const
|
||||
{
|
||||
return new wxHostNameValidator(*this);
|
||||
}
|
||||
|
||||
|
||||
bool wxHostNameValidator::Validate(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
if (!ctrl->IsEnabled()) return true;
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, parent);
|
||||
}
|
||||
|
||||
|
||||
bool wxHostNameValidator::TransferToWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
|
||||
if (m_val)
|
||||
((wxTextCtrl*)GetWindow())->SetValue(*m_val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxHostNameValidator::TransferFromWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, NULL, m_val);
|
||||
}
|
||||
|
||||
|
||||
bool wxHostNameValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::string *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
|
||||
size_t i = i_start;
|
||||
for (;;) {
|
||||
if (i >= i_end) {
|
||||
// End of host name found.
|
||||
if (val_out) val_out->assign(val_in.c_str() + i_start, i - i_start);
|
||||
return true;
|
||||
} else if (_tcschr(wxT("abcdefghijklmnopqrstuvwxyz0123456789-*"), buf[i])) {
|
||||
// Valid character found.
|
||||
i++;
|
||||
} else {
|
||||
// Invalid character found.
|
||||
ctrl->SetFocus();
|
||||
ctrl->SetSelection(i, i + 1);
|
||||
wxMessageBox(wxString::Format(_("Invalid character in host name found: %c"), buf[i]), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxFQDNValidator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxFQDNValidator, wxValidator);
|
||||
|
||||
|
||||
wxFQDNValidator::wxFQDNValidator(std::string *val) :
|
||||
m_val(val),
|
||||
wxValidator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxFQDNValidator::wxFQDNValidator(const wxFQDNValidator &other) :
|
||||
m_val(other.m_val),
|
||||
wxValidator(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxObject* wxFQDNValidator::Clone() const
|
||||
{
|
||||
return new wxFQDNValidator(*this);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNValidator::Validate(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
if (!ctrl->IsEnabled()) return true;
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, parent);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNValidator::TransferToWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
|
||||
if (m_val)
|
||||
((wxTextCtrl*)GetWindow())->SetValue(*m_val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNValidator::TransferFromWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, NULL, m_val);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::string *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
|
||||
size_t i = i_start;
|
||||
for (;;) {
|
||||
const wxStringCharType *buf_next;
|
||||
if ((buf_next = wmemchr(buf + i, L'.', i_end - i)) != NULL) {
|
||||
// FQDN separator found.
|
||||
if (!wxHostNameValidator::Parse(val_in, i, buf_next - buf, ctrl, parent))
|
||||
return false;
|
||||
i = buf_next - buf + 1;
|
||||
} else if (wxHostNameValidator::Parse(val_in, i, i_end, ctrl, parent)) {
|
||||
// The rest of the FQDN parsed succesfully.
|
||||
if (val_out) val_out->assign(val_in.c_str() + i_start, i_end - i_start);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxFQDNListValidator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxFQDNListValidator, wxValidator);
|
||||
|
||||
|
||||
wxFQDNListValidator::wxFQDNListValidator(std::list<std::string> *val) :
|
||||
m_val(val),
|
||||
wxValidator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxFQDNListValidator::wxFQDNListValidator(const wxFQDNListValidator &other) :
|
||||
m_val(other.m_val),
|
||||
wxValidator(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxObject* wxFQDNListValidator::Clone() const
|
||||
{
|
||||
return new wxFQDNListValidator(*this);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNListValidator::Validate(wxWindow *parent)
|
||||
{
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
if (!ctrl->IsEnabled()) return true;
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, parent);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNListValidator::TransferToWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
|
||||
if (m_val) {
|
||||
wxString str;
|
||||
for (std::list<std::string>::const_iterator name = m_val->cbegin(), name_end = m_val->cend(); name != name_end; ++name) {
|
||||
if (!str.IsEmpty()) str += wxT("; ");
|
||||
str += *name;
|
||||
}
|
||||
((wxTextCtrl*)GetWindow())->SetValue(str);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNListValidator::TransferFromWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, NULL, m_val);
|
||||
}
|
||||
|
||||
|
||||
bool wxFQDNListValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, std::list<std::string> *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
std::string _fqdn, *fqdn = val_out ? &_fqdn : NULL;
|
||||
std::list<std::string> _val_out;
|
||||
|
||||
size_t i = i_start;
|
||||
for (;;) {
|
||||
// Skip initial white-space.
|
||||
for (; i < i_end && _istspace(buf[i]); i++);
|
||||
|
||||
const wxStringCharType *buf_next;
|
||||
if ((buf_next = wmemchr(buf + i, L';', i_end - i)) != NULL) {
|
||||
// FQDN list separator found.
|
||||
|
||||
// Skip trailing white-space.
|
||||
size_t i_next = buf_next - buf;
|
||||
for (; i < i_next && _istspace(buf[i_next - 1]); i_next--);
|
||||
|
||||
if (!wxFQDNValidator::Parse(val_in, i, i_next, ctrl, parent, fqdn))
|
||||
return false;
|
||||
if (fqdn && !fqdn->empty()) _val_out.push_back(std::move(*fqdn));
|
||||
|
||||
i = buf_next - buf + 1;
|
||||
} else {
|
||||
// Skip trailing white-space.
|
||||
for (; i < i_end && _istspace(buf[i_end - 1]); i_end--);
|
||||
|
||||
if (wxHostNameValidator::Parse(val_in, i, i_end, ctrl, parent, fqdn)) {
|
||||
// The rest of the FQDN list parsed succesfully.
|
||||
if (fqdn && !fqdn->empty()) _val_out.push_back(std::move(*fqdn));
|
||||
if (val_out) *val_out = std::move(_val_out);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPTLSCredentialsPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTLSCredentialsPanel::wxEAPTLSCredentialsPanel(eap::credentials_tls &cred, LPCTSTR pszCredTarget, wxWindow* parent, bool is_config) :
|
||||
wxCredentialsPanel<wxEAPTLSCredentialsPanelBase, eap::credentials_tls>(cred, pszCredTarget, parent, is_config)
|
||||
{
|
||||
// Load and set icon.
|
||||
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(269));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTLSCredentialsPanel::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK(__super::TransferDataToWindow(), false);
|
||||
|
||||
// Populate certificate list.
|
||||
bool is_found = false;
|
||||
winstd::cert_store store;
|
||||
if (store.create(CERT_STORE_PROV_SYSTEM, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, _T("My"))) {
|
||||
for (PCCERT_CONTEXT cert = NULL; (cert = CertEnumCertificatesInStore(store, cert)) != NULL;) {
|
||||
DWORD dwKeySpec = 0, dwSize = sizeof(dwKeySpec);
|
||||
if (!CertGetCertificateContextProperty(cert, CERT_KEY_SPEC_PROP_ID, &dwKeySpec, &dwSize) || !dwKeySpec) {
|
||||
// Skip certificates without private key.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prepare certificate information.
|
||||
std::unique_ptr<wxCertificateSelectionClientData> data(new wxCertificateSelectionClientData);
|
||||
eap::get_cert_title(cert, data->m_identity);
|
||||
|
||||
// Add to list.
|
||||
CertGetCertificateContextProperty(cert, CERT_HASH_PROP_ID, data->m_hash);
|
||||
bool is_selected = data->m_hash == m_cred.m_cert_hash;
|
||||
int i = m_cert_select_val->Append(data->m_identity, data.release());
|
||||
if (is_selected) {
|
||||
m_cert_select_val->SetSelection(i);
|
||||
is_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_found) {
|
||||
m_cert_select ->SetValue(true);
|
||||
m_cert_select_val->Enable(true);
|
||||
} else {
|
||||
m_cert_none ->SetValue(true);
|
||||
m_cert_select_val->Enable(false);
|
||||
if (!m_cert_select_val->IsEmpty())
|
||||
m_cert_select_val->SetSelection(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTLSCredentialsPanel::TransferDataFromWindow()
|
||||
{
|
||||
if (m_cert_none->GetValue())
|
||||
m_cred.clear();
|
||||
else {
|
||||
const wxCertificateSelectionClientData *data = dynamic_cast<const wxCertificateSelectionClientData*>(m_cert_select_val->GetClientObject(m_cert_select_val->GetSelection()));
|
||||
if (data) {
|
||||
m_cred.m_identity = data->m_identity;
|
||||
m_cred.m_cert_hash = data->m_hash;
|
||||
} else
|
||||
m_cred.clear();
|
||||
}
|
||||
|
||||
return __super::TransferDataFromWindow();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSCredentialsPanel::OnCertSelect(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
m_cert_select_val->Enable(m_cert_select->GetValue());
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPTLSServerTrustPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTLSServerTrustPanel::wxEAPTLSServerTrustPanel(eap::config_tls &cfg, wxWindow* parent) :
|
||||
m_cfg(cfg),
|
||||
wxEAPTLSServerTrustConfigPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
if (m_certmgr.load(_T("certmgr.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
wxSetIconFromResource(m_server_trust_icon, m_icon, m_certmgr, MAKEINTRESOURCE(218));
|
||||
|
||||
m_server_names->SetValidator(wxFQDNListValidator(&(m_cfg.m_server_names)));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTLSServerTrustPanel::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK(wxEAPTLSServerTrustConfigPanelBase::TransferDataToWindow(), false);
|
||||
|
||||
// Populate trusted CA list.
|
||||
for (std::list<winstd::cert_context>::const_iterator cert = m_cfg.m_trusted_root_ca.cbegin(), cert_end = m_cfg.m_trusted_root_ca.cend(); cert != cert_end; ++cert) {
|
||||
winstd::tstring name;
|
||||
if (CertGetNameString(*cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, name) > 0)
|
||||
m_root_ca->Append(wxString(name), new wxCertificateClientData(cert->duplicate()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTLSServerTrustPanel::TransferDataFromWindow()
|
||||
{
|
||||
// Parse trusted CA list.
|
||||
m_cfg.m_trusted_root_ca.clear();
|
||||
for (unsigned int i = 0, i_end = m_root_ca->GetCount(); i < i_end; i++) {
|
||||
wxCertificateClientData *cert = dynamic_cast<wxCertificateClientData*>(m_root_ca->GetClientObject(i));
|
||||
if (cert)
|
||||
m_cfg.add_trusted_ca(cert->m_cert->dwCertEncodingType, cert->m_cert->pbCertEncoded, cert->m_cert->cbCertEncoded);
|
||||
}
|
||||
|
||||
return wxEAPTLSServerTrustConfigPanelBase::TransferDataFromWindow();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSServerTrustPanel::OnRootCA(wxCommandEvent& event)
|
||||
{
|
||||
wxCertificateClientData *cert = dynamic_cast<wxCertificateClientData*>(event.GetClientObject());
|
||||
m_root_ca_remove->Enable(cert ? true : false);
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSServerTrustPanel::OnRootCADClick(wxCommandEvent& event)
|
||||
{
|
||||
wxCertificateClientData *cert = dynamic_cast<wxCertificateClientData*>(event.GetClientObject());
|
||||
if (cert)
|
||||
CryptUIDlgViewContext(CERT_STORE_CERTIFICATE_CONTEXT, cert->m_cert, this->GetHWND(), NULL, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSServerTrustPanel::OnRootCAAddStore(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
winstd::cert_store store;
|
||||
if (store.create(NULL, _T("ROOT"))) {
|
||||
winstd::cert_context cert;
|
||||
cert.attach(CryptUIDlgSelectCertificateFromStore(store, this->GetHWND(), NULL, NULL, 0, 0, NULL));
|
||||
if (cert)
|
||||
AddRootCA(cert);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSServerTrustPanel::OnRootCAAddFile(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
const wxString separator(wxT("|"));
|
||||
wxFileDialog open_dialog(this, _("Add Certificate"), wxEmptyString, wxEmptyString,
|
||||
_("Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)") + separator + wxT("*.cer;*.crt;*.der;*.p7b;*.pem") + separator +
|
||||
_("X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)") + separator + wxT("*.cer;*.crt;*.der;*.pem") + separator +
|
||||
_("PKCS #7 Certificate Files (*.p7b)") + separator + wxT("*.p7b") + separator +
|
||||
_("All Files (*.*)") + separator + wxT("*.*"),
|
||||
wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE);
|
||||
if (open_dialog.ShowModal() == wxID_CANCEL) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
wxArrayString paths;
|
||||
open_dialog.GetPaths(paths);
|
||||
for (size_t i = 0, i_end = paths.GetCount(); i < i_end; i++) {
|
||||
// Load certificate(s) from file.
|
||||
winstd::cert_store cs;
|
||||
if (cs.create(CERT_STORE_PROV_FILENAME, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, NULL, CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG, (LPCTSTR)(paths[i]))) {
|
||||
for (PCCERT_CONTEXT cert = NULL; (cert = CertEnumCertificatesInStore(cs, cert)) != NULL;)
|
||||
AddRootCA(cert);
|
||||
} else
|
||||
wxMessageBox(wxString::Format(_("Invalid or unsupported certificate file %s"), paths[i]), _("Error"), wxOK | wxICON_EXCLAMATION, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSServerTrustPanel::OnRootCARemove(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
wxArrayInt selections;
|
||||
for (int i = m_root_ca->GetSelections(selections); i--; )
|
||||
m_root_ca->Delete(selections[i]);
|
||||
|
||||
m_root_ca_remove->Enable(false);
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTLSServerTrustPanel::AddRootCA(PCCERT_CONTEXT cert)
|
||||
{
|
||||
for (unsigned int i = 0, i_end = m_root_ca->GetCount(); i < i_end; i++) {
|
||||
wxCertificateClientData *c = dynamic_cast<wxCertificateClientData*>(m_root_ca->GetClientObject(i));
|
||||
if (c && c->m_cert &&
|
||||
c->m_cert->cbCertEncoded == cert->cbCertEncoded &&
|
||||
memcmp(c->m_cert->pbCertEncoded, cert->pbCertEncoded, cert->cbCertEncoded) == 0)
|
||||
{
|
||||
// This certificate is already on the list.
|
||||
m_root_ca->SetSelection(i);
|
||||
m_root_ca_remove->Enable();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add certificate to the list.
|
||||
winstd::tstring name;
|
||||
if (CertGetNameString(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, name) > 0) {
|
||||
int i = m_root_ca->Append(wxString(name), new wxCertificateClientData(CertDuplicateCertificateContext(cert)));
|
||||
if (0 <= i) {
|
||||
m_root_ca->SetSelection(i);
|
||||
m_root_ca_remove->Enable();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPTLSConfigPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTLSConfigPanel::wxEAPTLSConfigPanel(eap::config_tls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) : wxPanel(parent)
|
||||
{
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_server_trust = new wxEAPTLSServerTrustPanel(cfg, this);
|
||||
sb_content->Add(m_server_trust, 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
if (cfg.m_allow_save) {
|
||||
m_credentials = new wxEAPTLSCredentialsConfigPanel(cfg, pszCredTarget, this);
|
||||
sb_content->Add(m_credentials, 0, wxALL|wxEXPAND, 5);
|
||||
} else
|
||||
m_credentials = NULL;
|
||||
|
||||
sb_content->Add(10, 10, 1, wxEXPAND, 5);
|
||||
|
||||
this->SetSizer(sb_content);
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPTLSConfigPanel::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
wxEAPTLSConfigPanel::~wxEAPTLSConfigPanel()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPTLSConfigPanel::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTLSConfigPanel::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
// Forward the event to child panels.
|
||||
m_server_trust->GetEventHandler()->ProcessEvent(event);
|
||||
if (m_credentials)
|
||||
m_credentials->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
@@ -1,375 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
#pragma comment(lib, "Msi.lib")
|
||||
#pragma comment(lib, "msxml6.lib")
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::config_ttls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_ttls::config_ttls(_In_ module &mod) :
|
||||
m_inner(NULL),
|
||||
config_tls(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_ttls::config_ttls(const _In_ config_ttls &other) :
|
||||
m_inner(other.m_inner ? (config_method*)other.m_inner->clone() : NULL),
|
||||
config_tls(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_ttls::config_ttls(_Inout_ config_ttls &&other) :
|
||||
m_inner(other.m_inner),
|
||||
config_tls(std::move(other))
|
||||
{
|
||||
other.m_inner = NULL;
|
||||
}
|
||||
|
||||
|
||||
eap::config_ttls::~config_ttls()
|
||||
{
|
||||
if (m_inner)
|
||||
delete m_inner;
|
||||
}
|
||||
|
||||
|
||||
eap::config_ttls& eap::config_ttls::operator=(const _In_ config_ttls &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config_tls&)*this = other;
|
||||
if (m_inner) delete m_inner;
|
||||
m_inner = other.m_inner ? (config_method*)other.m_inner->clone() : NULL;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config_ttls& eap::config_ttls::operator=(_Inout_ config_ttls &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config_tls&&)*this = std::move(other);
|
||||
if (m_inner) delete m_inner;
|
||||
m_inner = other.m_inner;
|
||||
other.m_inner = NULL;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
DWORD dwResult;
|
||||
|
||||
// <InnerAuthenticationMethod>
|
||||
com_obj<IXMLDOMElement> pXmlElInnerAuthenticationMethod;
|
||||
if ((dwResult = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), bstrNamespace, &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <InnerAuthenticationMethod> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if (dynamic_cast<const config_pap*>(m_inner)) {
|
||||
// <InnerAuthenticationMethod>/<NonEAPAuthMethod>
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pXmlElInnerAuthenticationMethod, bstr(L"NonEAPAuthMethod"), bstrNamespace, bstr(L"PAP"))) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating <NonEAPAuthMethod> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// <InnerAuthenticationMethod>/...
|
||||
if ((dwResult = m_inner->save(pDoc, pXmlElInnerAuthenticationMethod, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
} else
|
||||
return dwResult = ERROR_NOT_SUPPORTED;
|
||||
|
||||
return config_tls::save(pDoc, pConfigRoot, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::config_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(ppEapError);
|
||||
DWORD dwResult;
|
||||
|
||||
// Load inner authentication configuration (<InnerAuthenticationMethod>).
|
||||
com_obj<IXMLDOMElement> pXmlElInnerAuthenticationMethod;
|
||||
if ((dwResult = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error selecting <InnerAuthenticationMethod> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Determine inner authentication type (<EAPMethod> and <NonEAPAuthMethod>).
|
||||
//DWORD dwMethodID;
|
||||
bstr bstrMethod;
|
||||
/*if (eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:EAPMethod"), &dwMethodID) == ERROR_SUCCESS &&
|
||||
dwMethodID == EAP_TYPE_MSCHAPV2)
|
||||
{
|
||||
// MSCHAPv2
|
||||
// TODO: Add MSCHAPv2 support.
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
} else*/ if (eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:NonEAPAuthMethod"), &bstrMethod) == ERROR_SUCCESS &&
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrMethod, bstrMethod.length(), L"PAP", -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||
{
|
||||
// PAP
|
||||
assert(!m_inner);
|
||||
m_inner = new eap::config_pap(m_module);
|
||||
if ((dwResult = m_inner->load(pXmlElInnerAuthenticationMethod, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
} else {
|
||||
*ppEapError = m_module.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Unsupported inner authentication method."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return config_tls::load(pConfigRoot, ppEapError);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials_ttls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials_ttls::credentials_ttls(_In_ module &mod) : credentials_tls(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_ttls::credentials_ttls(_In_ const credentials_ttls &other) :
|
||||
m_inner(other.m_inner ? (credentials*)other.m_inner->clone() : NULL),
|
||||
credentials_tls(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_ttls::credentials_ttls(_Inout_ credentials_ttls &&other) :
|
||||
m_inner(other.m_inner),
|
||||
credentials_tls(std::move(other))
|
||||
{
|
||||
other.m_inner = NULL;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_ttls& eap::credentials_ttls::operator=(_In_ const credentials_ttls &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials_tls&)*this = other;
|
||||
|
||||
if (m_inner) delete m_inner;
|
||||
m_inner = other.m_inner ? (credentials*)other.m_inner->clone() : NULL;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_ttls& eap::credentials_ttls::operator=(_Inout_ credentials_ttls &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(credentials_tls&)*this = std::move(other);
|
||||
|
||||
if (m_inner) delete m_inner;
|
||||
m_inner = other.m_inner;
|
||||
other.m_inner = NULL;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void eap::credentials_ttls::clear()
|
||||
{
|
||||
credentials_tls::clear();
|
||||
if (m_inner)
|
||||
m_inner->clear();
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_ttls::empty() const
|
||||
{
|
||||
return credentials_tls::empty() && (!m_inner || m_inner->empty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
DWORD eap::credentials_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
DWORD dwResult;
|
||||
|
||||
if ((dwResult = credentials_tls::load(pConfigRoot, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
|
||||
if (m_inner) {
|
||||
com_obj<IXMLDOMNode> pXmlElInnerAuthenticationMethod;
|
||||
if ((dwResult = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult = ERROR_NOT_FOUND, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error selecting <InnerAuthenticationMethod> element."), NULL);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
if ((dwResult = m_inner->load(pXmlElInnerAuthenticationMethod, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_ttls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
DWORD dwResult;
|
||||
|
||||
if ((dwResult = credentials_tls::store(pszTargetName, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
|
||||
if (m_inner) {
|
||||
if ((dwResult = m_inner->store(pszTargetName, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::credentials_ttls::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult;
|
||||
|
||||
if ((dwResult = credentials_tls::retrieve(pszTargetName, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
|
||||
if (m_inner) {
|
||||
if ((dwResult = m_inner->retrieve(pszTargetName, ppEapError)) != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::session_ttls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::session_ttls::session_ttls() : session()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::peer_ttls
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::peer_ttls::peer_ttls() : peer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls::initialize(_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
// MSI's feature completeness check removed: It might invoke UI (prompt user for missing MSI),
|
||||
// which would be disasterous in EapHost system service.
|
||||
#if 0
|
||||
// Perform the Microsoft Installer's feature completeness check manually.
|
||||
// If execution got this far in the first place (dependent DLLs are present and loadable).
|
||||
// Furthermore, this increments program usage counter.
|
||||
if (MsiQueryFeatureState(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS")) != INSTALLSTATE_UNKNOWN)
|
||||
MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featEAPTTLS"));
|
||||
#endif
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls::shutdown(_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls::get_identity(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_Out_ BOOL *pfInvokeUI,
|
||||
_Out_ DWORD *pdwUserDataOutSize,
|
||||
_Out_ BYTE **ppUserDataOut,
|
||||
_Out_ WCHAR **ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(dwConnectionDataSize);
|
||||
UNREFERENCED_PARAMETER(pConnectionData);
|
||||
UNREFERENCED_PARAMETER(dwUserDataSize);
|
||||
UNREFERENCED_PARAMETER(pUserData);
|
||||
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||
UNREFERENCED_PARAMETER(pfInvokeUI);
|
||||
UNREFERENCED_PARAMETER(pdwUserDataOutSize);
|
||||
UNREFERENCED_PARAMETER(ppUserDataOut);
|
||||
UNREFERENCED_PARAMETER(ppwszIdentity);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
DWORD dwResult = ERROR_NOT_SUPPORTED;
|
||||
ETW_FN_DWORD(dwResult);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls::get_method_properties(
|
||||
_In_ DWORD dwVersion,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ DWORD dwEapConnDataSize,
|
||||
_In_count_(dwEapConnDataSize) const BYTE *pEapConnData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
|
||||
_Out_ EAP_ERROR **ppEapError) const
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwVersion);
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(hUserImpersonationToken);
|
||||
UNREFERENCED_PARAMETER(dwEapConnDataSize);
|
||||
UNREFERENCED_PARAMETER(pEapConnData);
|
||||
UNREFERENCED_PARAMETER(dwUserDataSize);
|
||||
UNREFERENCED_PARAMETER(pUserData);
|
||||
UNREFERENCED_PARAMETER(pMethodPropertyArray);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
DWORD dwResult = ERROR_NOT_SUPPORTED;
|
||||
ETW_FN_DWORD(dwResult);
|
||||
return dwResult;
|
||||
}
|
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <StdAfx.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::peer_ttls_ui
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::peer_ttls_ui::peer_ttls_ui() : peer_ui<eap::config_ttls, eap::credentials_ttls, int, int>()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls_ui::invoke_config_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_Inout_ config_type &cfg,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
// Initialize application.
|
||||
new wxApp();
|
||||
wxEntryStart(m_instance);
|
||||
|
||||
int result;
|
||||
{
|
||||
// Create wxWidget-approved parent window.
|
||||
wxWindow parent;
|
||||
parent.SetHWND((WXHWND)hwndParent);
|
||||
parent.AdoptAttributesFromHWND();
|
||||
wxTopLevelWindows.Append(&parent);
|
||||
|
||||
// Create and launch configuration dialog.
|
||||
wxEAPConfigDialog<config_ttls, wxEAPTTLSConfig> dlg(cfg, &parent);
|
||||
result = dlg.ShowModal();
|
||||
|
||||
wxTopLevelWindows.DeleteObject(&parent);
|
||||
parent.SetHWND((WXHWND)NULL);
|
||||
}
|
||||
|
||||
// Clean-up and return.
|
||||
wxEntryCleanup();
|
||||
return result == wxID_OK ? ERROR_SUCCESS : ERROR_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls_ui::invoke_identity_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ DWORD dwFlags,
|
||||
_Inout_ config_type &cfg,
|
||||
_Inout_ identity_type &usr,
|
||||
_Out_ LPWSTR *ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(cfg);
|
||||
UNREFERENCED_PARAMETER(usr);
|
||||
UNREFERENCED_PARAMETER(ppwszIdentity);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
InitCommonControls();
|
||||
MessageBox(hwndParent, _T(PRODUCT_NAME_STR) _T(" credential prompt goes here!"), _T(PRODUCT_NAME_STR) _T(" Credentials"), MB_OK);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DWORD eap::peer_ttls_ui::invoke_interactive_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ const interactive_request_type &req,
|
||||
_Out_ interactive_response_type &res,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(req);
|
||||
UNREFERENCED_PARAMETER(res);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
InitCommonControls();
|
||||
MessageBox(hwndParent, _T(PRODUCT_NAME_STR) _T(" interactive UI goes here!"), _T(PRODUCT_NAME_STR) _T(" Prompt"), MB_OK);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPTTLSConfigPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTTLSConfigPanel::wxEAPTTLSConfigPanel(eap::config_ttls &cfg, wxWindow* parent) :
|
||||
m_cfg(cfg),
|
||||
wxEAPTTLSConfigPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
wxSetIconFromResource(m_outer_identity_icon, m_icon, m_shell32, MAKEINTRESOURCE(265));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTTLSConfigPanel::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK(wxEAPTTLSConfigPanelBase::TransferDataToWindow(), false);
|
||||
|
||||
// Populate identity controls.
|
||||
if (m_cfg.m_anonymous_identity.empty()) {
|
||||
m_outer_identity_same->SetValue(true);
|
||||
m_outer_identity_custom_val->Enable(false);
|
||||
} else if (m_cfg.m_anonymous_identity == L"@") {
|
||||
m_outer_identity_empty->SetValue(true);
|
||||
m_outer_identity_custom_val->Enable(false);
|
||||
} else {
|
||||
m_outer_identity_custom->SetValue(true);
|
||||
m_outer_identity_custom_val->Enable(true);
|
||||
m_outer_identity_custom_val->SetValue(m_cfg.m_anonymous_identity);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTTLSConfigPanel::TransferDataFromWindow()
|
||||
{
|
||||
if (m_outer_identity_same->GetValue())
|
||||
m_cfg.m_anonymous_identity.clear();
|
||||
else if (m_outer_identity_empty->GetValue())
|
||||
m_cfg.m_anonymous_identity = L"@";
|
||||
else
|
||||
m_cfg.m_anonymous_identity = m_outer_identity_custom_val->GetValue();
|
||||
|
||||
return wxEAPTTLSConfigPanelBase::TransferDataFromWindow();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTTLSConfigPanel::OnOuterIdentityCustom(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
m_outer_identity_custom_val->Enable(m_outer_identity_custom->GetValue());
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPTTLSConfig
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPTTLSConfig::wxEAPTTLSConfig(eap::config_ttls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) :
|
||||
m_cfg(cfg),
|
||||
m_cfg_pap(cfg.m_module),
|
||||
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
||||
{
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_outer_title = new wxStaticText(this, wxID_ANY, _("Outer Authentication"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_outer_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString));
|
||||
m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) );
|
||||
sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5);
|
||||
|
||||
m_outer_identity = new wxEAPTTLSConfigPanel(m_cfg, this);
|
||||
sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
m_tls = new wxEAPTLSConfigPanel(m_cfg, pszCredTarget, this);
|
||||
sb_content->Add(m_tls, 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
sb_content->Add(20, 20, 1, wxEXPAND, 5);
|
||||
|
||||
m_inner_title = new wxStaticText(this, wxID_ANY, _("Inner Authentication"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_inner_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString));
|
||||
m_inner_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) );
|
||||
sb_content->Add(m_inner_title, 0, wxALL|wxALIGN_RIGHT, 5);
|
||||
|
||||
m_inner_type = new wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT);
|
||||
m_inner_type->SetToolTip( _("Select inner authentication method from the list") );
|
||||
m_inner_type->AddPage(new wxPAPConfigPanel(m_cfg_pap, pszCredTarget, m_inner_type), _("PAP"));
|
||||
sb_content->Add(m_inner_type, 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
wxSize size = sb_content->CalcMin();
|
||||
if (size.y > 500) {
|
||||
// Increase the width to allow space for vertical scroll bar (to prevent horizontal one) and truncate the height.
|
||||
size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X, this);
|
||||
size.y = 500;
|
||||
}
|
||||
this->SetMinSize(size);
|
||||
this->SetScrollRate(5, 5);
|
||||
|
||||
this->SetSizer(sb_content);
|
||||
this->Layout();
|
||||
|
||||
m_outer_identity->SetFocusFromKbd();
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPTTLSConfig::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
wxEAPTTLSConfig::~wxEAPTTLSConfig()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPTTLSConfig::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTTLSConfig::TransferDataToWindow()
|
||||
{
|
||||
eap::config_pap *cfg_pap = dynamic_cast<eap::config_pap*>(m_cfg.m_inner);
|
||||
if (cfg_pap) {
|
||||
m_cfg_pap = *cfg_pap;
|
||||
m_inner_type->SetSelection(0); // 0=PAP
|
||||
} else
|
||||
wxFAIL_MSG(wxT("Unsupported inner authentication method type."));
|
||||
|
||||
return wxScrolledWindow::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPTTLSConfig::TransferDataFromWindow()
|
||||
{
|
||||
wxCHECK(wxScrolledWindow::TransferDataFromWindow(), false);
|
||||
|
||||
switch (m_inner_type->GetSelection()) {
|
||||
case 0: // 0=PAP
|
||||
delete m_cfg.m_inner;
|
||||
m_cfg.m_inner = new eap::config_pap(m_cfg_pap);
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("Unsupported inner authentication method type."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void wxEAPTTLSConfig::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
// Forward the event to child panels.
|
||||
m_outer_identity->GetEventHandler()->ProcessEvent(event);
|
||||
m_tls->GetEventHandler()->ProcessEvent(event);
|
||||
for (wxWindowList::compatibility_iterator inner = m_inner_type->GetChildren().GetFirst(); inner; inner = inner->GetNext())
|
||||
inner->GetData()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
Reference in New Issue
Block a user