Compare commits
43 Commits
1.0-alpha1
...
1.0-alpha3
Author | SHA1 | Date | |
---|---|---|---|
218aa187f6 | |||
f71c4e8356 | |||
4e16111614 | |||
04b8960f33 | |||
eadcc5eadd | |||
6800de3df7 | |||
98273c6bdc | |||
7ac86e1954 | |||
c79d3e74cf | |||
6b541ce1ff | |||
120da591b4 | |||
a406bc5b89 | |||
1a495051bb | |||
6631e1c798 | |||
2e57879994 | |||
3a2cbe1e40 | |||
697a4a377b | |||
318e6f7c5a | |||
1b54307b38 | |||
091dd43bfc | |||
3ba6074745 | |||
30689b10d2 | |||
c371187edc | |||
ec6291f6ac | |||
6c935d53c3 | |||
1eab05075e | |||
993f280624 | |||
54a041aac0 | |||
9df4d5e9b9 | |||
5e37bd0735 | |||
ce4c208468 | |||
7dbe76d4f4 | |||
3d69a343c7 | |||
da84dea727 | |||
9208e75fe6 | |||
5be9806e2e | |||
86cd27a73b | |||
4a69f7976a | |||
1e68895a92 | |||
b9c60adaaa | |||
8437d86913 | |||
da345c1717 | |||
735ea86e86 |
@@ -7,7 +7,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\EAPMethods\EAPMethodEvents\temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>EAPMETHOD_TYPE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
Binary file not shown.
@@ -86,6 +86,8 @@
|
|||||||
<ClInclude Include="StdAfx.h" />
|
<ClInclude Include="StdAfx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\EAPMethods\src\EAP.cpp" />
|
||||||
|
<ClCompile Include="..\EAPMethods\src\PAP.cpp" />
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
<ClCompile Include="StdAfx.cpp">
|
<ClCompile Include="StdAfx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
@@ -98,10 +100,16 @@
|
|||||||
<ResourceCompile Include="CredWrite.rc" />
|
<ResourceCompile Include="CredWrite.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\EAPMethods\EAPMethodEvents\EAPMethodEvents.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@@ -26,10 +26,19 @@
|
|||||||
<ClCompile Include="Main.cpp">
|
<ClCompile Include="Main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\EAPMethods\src\EAP.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\EAPMethods\src\PAP.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="CredWrite.rc">
|
<ResourceCompile Include="CredWrite.rc">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
@@ -1,12 +1,12 @@
|
|||||||
#CredWrite
|
#CredWrite
|
||||||
Imports given credentials to Windows Credential Manager for GEANTLink use
|
Imports given credentials to Windows Credential Manager for G<EFBFBD>ANTLink use
|
||||||
|
|
||||||
##Usage
|
##Usage
|
||||||
```
|
```
|
||||||
CredWrite <username> <password> [<realm>]
|
CredWrite <username> <password> [<realm>]
|
||||||
```
|
```
|
||||||
|
|
||||||
- `username` - a user name usually of the form user@domain
|
- `username` - Base64 encoded UTF-8 user name (usually of the form user@domain or domain\user)
|
||||||
- `password` - Base64 encoded UTF-8 user password
|
- `password` - Base64 encoded UTF-8 user password
|
||||||
- `realm` - A realm ID to allow grouping of credentials over different WLAN profiles (optional, default is domain part of `username`)
|
- `realm` - A realm ID to allow grouping of credentials over different WLAN profiles (optional, default is domain part of `username`)
|
||||||
|
|
||||||
@@ -16,5 +16,4 @@ Return codes:
|
|||||||
- -1 = Invalid parameters
|
- -1 = Invalid parameters
|
||||||
- 0 = Success
|
- 0 = Success
|
||||||
- 1 = Error parsing command line
|
- 1 = Error parsing command line
|
||||||
- 2 = Error encrypting password
|
- 2 = Error encrypting password or writing credentials
|
||||||
- 3 = Error writing credentials to Credential Manager
|
|
||||||
|
Binary file not shown.
Binary file not shown.
1
EAPMethods/.gitignore
vendored
Normal file
1
EAPMethods/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/doc
|
2312
EAPMethods/Doxyfile
Normal file
2312
EAPMethods/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="..\..\include\ResourceDLL.props" />
|
<Import Project="..\..\include\ResourceDLL.props" />
|
||||||
<Import Project="Common.props" />
|
<Import Project="..\build\Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
2
EAPMethods/EAPTTLS/.gitignore
vendored
Normal file
2
EAPMethods/EAPTTLS/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="Common.props" />
|
<Import Project="..\build\Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>EAPMethod.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>..\build\EAPMethod.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
@@ -79,19 +79,21 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\EAPMethods.h" />
|
<ClInclude Include="..\include\EAP.h" />
|
||||||
<ClInclude Include="..\include\EAPSerialize.h" />
|
<ClInclude Include="..\include\EAPSerial.h" />
|
||||||
<ClInclude Include="..\include\EAPTTLS.h" />
|
<ClInclude Include="..\include\TLS.h" />
|
||||||
|
<ClInclude Include="..\include\TTLS.h" />
|
||||||
<ClInclude Include="..\include\EAPXML.h" />
|
<ClInclude Include="..\include\EAPXML.h" />
|
||||||
<ClInclude Include="..\include\PAP.h" />
|
<ClInclude Include="..\include\PAP.h" />
|
||||||
<ClInclude Include="..\include\StdAfx.h" />
|
<ClInclude Include="StdAfx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp" />
|
<ClCompile Include="..\src\EAP.cpp" />
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp" />
|
<ClCompile Include="..\src\TLS.cpp" />
|
||||||
|
<ClCompile Include="..\src\TTLS.cpp" />
|
||||||
<ClCompile Include="..\src\Main.cpp" />
|
<ClCompile Include="..\src\Main.cpp" />
|
||||||
<ClCompile Include="..\src\PAP.cpp" />
|
<ClCompile Include="..\src\PAP.cpp" />
|
||||||
<ClCompile Include="..\src\StdAfx.cpp">
|
<ClCompile Include="StdAfx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
@@ -105,12 +107,12 @@
|
|||||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="EAPMethodEvents.vcxproj">
|
<ProjectReference Include="..\EAPMethodEvents\EAPMethodEvents.vcxproj">
|
||||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="EAPMethod.def" />
|
<None Include="..\build\EAPMethod.def" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
@@ -15,13 +15,10 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\StdAfx.h">
|
<ClInclude Include="StdAfx.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\include\EAPMethods.h">
|
<ClInclude Include="..\include\TTLS.h">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\include\EAPTTLS.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\include\PAP.h">
|
<ClInclude Include="..\include\PAP.h">
|
||||||
@@ -30,26 +27,35 @@
|
|||||||
<ClInclude Include="..\include\EAPXML.h">
|
<ClInclude Include="..\include\EAPXML.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\include\EAPSerialize.h">
|
<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>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\StdAfx.cpp">
|
<ClCompile Include="StdAfx.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\Main.cpp">
|
<ClCompile Include="..\src\Main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\PAP.cpp">
|
<ClCompile Include="..\src\PAP.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EAPTTLS.rc">
|
<ResourceCompile Include="EAPTTLS.rc">
|
||||||
@@ -57,7 +63,7 @@
|
|||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="EAPMethod.def">
|
<None Include="..\build\EAPMethod.def">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
21
EAPMethods/EAPTTLS/StdAfx.cpp
Normal file
21
EAPMethods/EAPTTLS/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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"
|
50
EAPMethods/EAPTTLS/StdAfx.h
Normal file
50
EAPMethods/EAPTTLS/StdAfx.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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")
|
2
EAPMethods/EAPTTLSUI/.gitignore
vendored
Normal file
2
EAPMethods/EAPTTLSUI/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="Common.props" />
|
<Import Project="..\build\Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>EAPMethodUI.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>..\build\EAPMethodUI.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
Binary file not shown.
@@ -79,16 +79,34 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\EAPMethods.h" />
|
<ClInclude Include="..\include\EAP.h" />
|
||||||
<ClInclude Include="..\include\EAPTTLS.h" />
|
<ClInclude Include="..\include\EAPXML.h" />
|
||||||
<ClInclude Include="..\include\StdAfx.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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp" />
|
<ClCompile Include="..\res\wxEAP_UI.cpp" />
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp" />
|
<ClCompile Include="..\res\wxTLS_UI.cpp" />
|
||||||
<ClCompile Include="..\src\MainUI.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\PAP.cpp" />
|
||||||
<ClCompile Include="..\src\StdAfx.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)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
@@ -102,12 +120,15 @@
|
|||||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="EAPMethodEvents.vcxproj">
|
<ProjectReference Include="..\EAPMethodEvents\EAPMethodEvents.vcxproj">
|
||||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="EAPMethodUI.def" />
|
<None Include="..\build\EAPMethodUI.def" />
|
||||||
|
<None Include="..\res\wxEAP_UI.fbp" />
|
||||||
|
<None Include="..\res\wxTLS_UI.fbp" />
|
||||||
|
<None Include="..\res\wxTTLS_UI.fbp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
127
EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj.filters
Normal file
127
EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj.filters
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?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>
|
||||||
|
<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">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<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>
|
21
EAPMethods/EAPTTLSUI/StdAfx.cpp
Normal file
21
EAPMethods/EAPTTLSUI/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
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"
|
65
EAPMethods/EAPTTLSUI/StdAfx.h
Normal file
65
EAPMethods/EAPTTLSUI/StdAfx.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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")
|
@@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir);..\EAPMethodEvents\temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
@@ -1,55 +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>
|
|
||||||
<ClInclude Include="..\include\StdAfx.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\include\EAPMethods.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\include\EAPTTLS.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\src\StdAfx.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\MainUI.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\PAP.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="EAPTTLSUI.rc">
|
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="EAPMethodUI.def">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
1583
EAPMethods/include/EAP.h
Normal file
1583
EAPMethods/include/EAP.h
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
370
EAPMethods/include/EAPSerial.h
Normal file
370
EAPMethods/include/EAPSerial.h
Normal file
@@ -0,0 +1,370 @@
|
|||||||
|
/*
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
444
EAPMethods/include/EAP_UI.h
Normal file
444
EAPMethods/include/EAP_UI.h
Normal file
@@ -0,0 +1,444 @@
|
|||||||
|
/*
|
||||||
|
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;
|
||||||
|
}
|
Binary file not shown.
53
EAPMethods/include/PAP_UI.h
Normal file
53
EAPMethods/include/PAP_UI.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
};
|
Binary file not shown.
352
EAPMethods/include/TLS.h
Normal file
352
EAPMethods/include/TLS.h
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
/*
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
346
EAPMethods/include/TLS_UI.h
Normal file
346
EAPMethods/include/TLS_UI.h
Normal file
@@ -0,0 +1,346 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
};
|
405
EAPMethods/include/TTLS.h
Normal file
405
EAPMethods/include/TTLS.h
Normal file
@@ -0,0 +1,405 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
181
EAPMethods/include/TTLS_UI.h
Normal file
181
EAPMethods/include/TTLS_UI.h
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
};
|
304
EAPMethods/locale/EAPMethods.pot
Normal file
304
EAPMethods/locale/EAPMethods.pot
Normal file
@@ -0,0 +1,304 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: EAPMethods\n"
|
||||||
|
"POT-Creation-Date: 2016-06-09 15:19+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"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.8\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"
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:123 res/wxEAP_UI.cpp:200
|
||||||
|
msgid "Client Credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:134
|
||||||
|
msgid "Manage your credentials stored in Windows Credential Manager."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:144
|
||||||
|
msgid "Identity:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:149
|
||||||
|
msgid "Enter your user name here (user@domain.org, DOMAINUser, etc.)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:159
|
||||||
|
msgid "&Set Credentials..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:160
|
||||||
|
msgid "Click here to set or modify your credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:164
|
||||||
|
msgid "&Clear Credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: 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
|
||||||
|
msgid "Please provide your user ID and password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:221
|
||||||
|
msgid "User ID:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:226
|
||||||
|
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:230
|
||||||
|
msgid "Password:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:235
|
||||||
|
msgid "Enter your password here"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.cpp:242 res/wxTLS_UI.cpp:164
|
||||||
|
msgid "&Remember"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: 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
|
||||||
|
msgid "This method requires no additional settings."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:198
|
||||||
|
#, c-format
|
||||||
|
msgid "Invalid character in host name found: %c"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:198
|
||||||
|
msgid "Validation conflict"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:550
|
||||||
|
msgid "Add Certificate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:551
|
||||||
|
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:552
|
||||||
|
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:553
|
||||||
|
msgid "PKCS #7 Certificate Files (*.p7b)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:554
|
||||||
|
msgid "All Files (*.*)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:570
|
||||||
|
#, c-format
|
||||||
|
msgid "Invalid or unsupported certificate file %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TLS_UI.cpp:570
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Error"
|
||||||
|
msgstr "Napaka pri nalaganju knjižnice MSI.DLL (%1!ld!)."
|
||||||
|
|
||||||
|
#: src/TTLS_UI.cpp:172
|
||||||
|
msgid "Outer Authentication"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TTLS_UI.cpp:185
|
||||||
|
msgid "Inner Authentication"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TTLS_UI.cpp:191
|
||||||
|
msgid "Select inner authentication method from the list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/TTLS_UI.cpp:192
|
||||||
|
msgid "PAP"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:272
|
||||||
|
msgid "<blank>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:278
|
||||||
|
#, c-format
|
||||||
|
msgid "<error %u>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:301
|
||||||
|
#, c-format
|
||||||
|
msgid "Deleting credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:358
|
||||||
|
#, c-format
|
||||||
|
msgid "Error reading credentials from Credential Manager: %ls (error %u)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:361
|
||||||
|
#, c-format
|
||||||
|
msgid "Reading credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:376
|
||||||
|
#, c-format
|
||||||
|
msgid "Error writing credentials to Credential Manager: %ls (error %u)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: include/EAP_UI.h:379
|
||||||
|
#, c-format
|
||||||
|
msgid "Writing credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.h:56
|
||||||
|
msgid "EAP Method Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: res/wxEAP_UI.h:81
|
||||||
|
msgid "EAP Credentials"
|
||||||
|
msgstr ""
|
260
EAPMethods/res/wxEAP_UI.cpp
Normal file
260
EAPMethods/res/wxEAP_UI.cpp
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
}
|
1956
EAPMethods/res/wxEAP_UI.fbp
Normal file
1956
EAPMethods/res/wxEAP_UI.fbp
Normal file
File diff suppressed because it is too large
Load Diff
154
EAPMethods/res/wxEAP_UI.h
Normal file
154
EAPMethods/res/wxEAP_UI.h
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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__
|
188
EAPMethods/res/wxTLS_UI.cpp
Normal file
188
EAPMethods/res/wxTLS_UI.cpp
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 );
|
||||||
|
|
||||||
|
}
|
1625
EAPMethods/res/wxTLS_UI.fbp
Normal file
1625
EAPMethods/res/wxTLS_UI.fbp
Normal file
File diff suppressed because it is too large
Load Diff
96
EAPMethods/res/wxTLS_UI.h
Normal file
96
EAPMethods/res/wxTLS_UI.h
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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__
|
83
EAPMethods/res/wxTTLS_UI.cpp
Normal file
83
EAPMethods/res/wxTTLS_UI.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 );
|
||||||
|
|
||||||
|
}
|
655
EAPMethods/res/wxTTLS_UI.fbp
Normal file
655
EAPMethods/res/wxTTLS_UI.fbp
Normal file
@@ -0,0 +1,655 @@
|
|||||||
|
<?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>
|
58
EAPMethods/res/wxTTLS_UI.h
Normal file
58
EAPMethods/res/wxTTLS_UI.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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__
|
727
EAPMethods/src/EAP.cpp
Normal file
727
EAPMethods/src/EAP.cpp
Normal file
@@ -0,0 +1,727 @@
|
|||||||
|
/*
|
||||||
|
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);
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
106
EAPMethods/src/EAP_UI.cpp
Normal file
106
EAPMethods/src/EAP_UI.cpp
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
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();
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
453
EAPMethods/src/Main_UI.cpp
Normal file
453
EAPMethods/src/Main_UI.cpp
Normal file
@@ -0,0 +1,453 @@
|
|||||||
|
/*
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
#if EAPMETHOD_TYPE==21
|
||||||
|
#define _EAPMETHOD_PEER_UI eap::peer_ttls_ui
|
||||||
|
#else
|
||||||
|
#error Unknown EAP Method type.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HANDLE g_act_ctx = NULL;
|
||||||
|
_EAPMETHOD_PEER_UI g_peer;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// DLL main entry point
|
||||||
|
///
|
||||||
|
/// \sa [DllMain entry point](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583.aspx)
|
||||||
|
///
|
||||||
|
BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lpvReserved);
|
||||||
|
|
||||||
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
g_peer.m_instance = hinstDLL;
|
||||||
|
|
||||||
|
// Save current activation context, as proper activation context is set at this time only (LoadLibrary() call).
|
||||||
|
GetCurrentActCtx(&g_act_ctx);
|
||||||
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||||
|
if (g_act_ctx)
|
||||||
|
ReleaseActCtx(g_act_ctx);
|
||||||
|
|
||||||
|
// wxWidgets library has some global objects allocating data on heap in constructors,
|
||||||
|
// causing false-positive memory leak reports.
|
||||||
|
//assert(!_CrtDumpMemoryLeaks());
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Releases all memory associated with an opaque user interface context data buffer.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerFreeMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363606.aspx)
|
||||||
|
///
|
||||||
|
VOID WINAPI EapPeerFreeMemory(_In_ void *pUIContextData)
|
||||||
|
{
|
||||||
|
if (pUIContextData)
|
||||||
|
g_peer.free_memory((BYTE*)pUIContextData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Releases error-specific memory allocated by the EAP peer method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerFreeErrorMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363605.aspx)
|
||||||
|
///
|
||||||
|
VOID WINAPI EapPeerFreeErrorMemory(_In_ EAP_ERROR *ppEapError)
|
||||||
|
{
|
||||||
|
if (ppEapError)
|
||||||
|
g_peer.free_error_memory(ppEapError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts XML into the configuration BLOB.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerConfigXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363602.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerConfigXml2Blob(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||||
|
_In_ IXMLDOMDocument2 *pConfigDoc,
|
||||||
|
_Out_ BYTE **ppConfigOut,
|
||||||
|
_Out_ DWORD *pdwConfigOutSize,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
else if (eapMethodType.eapType.type != EAPMETHOD_TYPE)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)eapMethodType.eapType.type, (int)EAPMETHOD_TYPE).c_str(), NULL);
|
||||||
|
else if (eapMethodType.dwAuthorId != 67532)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)eapMethodType.dwAuthorId, (int)67532).c_str(), NULL);
|
||||||
|
else if (!pConfigDoc)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pConfigDoc is NULL."), NULL);
|
||||||
|
else if (!ppConfigOut)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppConfigOut is NULL."), NULL);
|
||||||
|
else if (!pdwConfigOutSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pdwConfigOutSize is NULL."), NULL);
|
||||||
|
else {
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
|
||||||
|
// <Config>
|
||||||
|
pConfigDoc->setProperty(winstd::bstr(L"SelectionNamespaces"), winstd::variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||||
|
winstd::com_obj<IXMLDOMElement> pXmlElConfig;
|
||||||
|
if ((dwResult = eapxml::select_element(pConfigDoc, winstd::bstr(L"//eaphostconfig:Config"), &pXmlElConfig)) != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
// Load configuration.
|
||||||
|
pConfigDoc->setProperty(winstd::bstr(L"SelectionNamespaces"), winstd::variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||||
|
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||||
|
dwResult = cfg.load(pXmlElConfig, ppEapError);
|
||||||
|
if (dwResult != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
// Allocate BLOB for configuration.
|
||||||
|
assert(ppConfigOut);
|
||||||
|
assert(pdwConfigOutSize);
|
||||||
|
*pdwConfigOutSize = (DWORD)eapserial::get_pk_size(cfg);
|
||||||
|
*ppConfigOut = g_peer.alloc_memory(*pdwConfigOutSize);
|
||||||
|
if (!*ppConfigOut) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, 0, NULL, NULL, NULL, winstd::tstring_printf(_T(__FUNCTION__) _T(" Error allocating memory for configuration BLOB (%uB)."), *pdwConfigOutSize).c_str(), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pack BLOB to output.
|
||||||
|
unsigned char *cursor = *ppConfigOut;
|
||||||
|
eapserial::pack(cursor, cfg);
|
||||||
|
assert(cursor - *ppConfigOut <= (ptrdiff_t)*pdwConfigOutSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts the configuration BLOB to XML.
|
||||||
|
///
|
||||||
|
/// The configuration BLOB is returned in the ppConnectionDataOut parameter of the EapPeerInvokeConfigUI function.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerConfigBlob2Xml function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363601.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerConfigBlob2Xml(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||||
|
_In_count_(dwConfigInSize) const BYTE *pConfigIn,
|
||||||
|
_In_ DWORD dwConfigInSize,
|
||||||
|
_Out_ IXMLDOMDocument2 **ppConfigDoc,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
else if (eapMethodType.eapType.type != EAPMETHOD_TYPE)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)eapMethodType.eapType.type, (int)EAPMETHOD_TYPE).c_str(), NULL);
|
||||||
|
else if (eapMethodType.dwAuthorId != 67532)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)eapMethodType.dwAuthorId, (int)67532).c_str(), NULL);
|
||||||
|
else if (!pConfigIn && dwConfigInSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pConfigIn is NULL."), NULL);
|
||||||
|
else if (!ppConfigDoc)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppConfigDoc is NULL."), NULL);
|
||||||
|
else {
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// Unpack configuration.
|
||||||
|
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||||
|
if (pConfigIn || !dwConfigInSize) {
|
||||||
|
const unsigned char *cursor = pConfigIn;
|
||||||
|
eapserial::unpack(cursor, cfg);
|
||||||
|
assert(cursor - pConfigIn <= (ptrdiff_t)dwConfigInSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create configuration XML document.
|
||||||
|
winstd::com_obj<IXMLDOMDocument2> pDoc;
|
||||||
|
if (FAILED(hr = pDoc.create(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER))) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = HRESULT_CODE(hr), 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error creating XML document."), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDoc->put_async(VARIANT_FALSE);
|
||||||
|
|
||||||
|
// Load empty XML configuration.
|
||||||
|
VARIANT_BOOL isSuccess = VARIANT_FALSE;
|
||||||
|
if (FAILED((hr = pDoc->loadXML(L"<Config xmlns=\"http://www.microsoft.com/provisioning/EapHostConfig\"><EAPIdentityProviderList xmlns=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\"></EAPIdentityProviderList></Config>", &isSuccess))))
|
||||||
|
return dwResult = HRESULT_CODE(hr);
|
||||||
|
if (!isSuccess) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_XML_PARSE_ERROR, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Loading XML template failed."), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select <Config> node.
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlElConfig;
|
||||||
|
pDoc->setProperty(winstd::bstr(L"SelectionNamespaces"), winstd::variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||||
|
if ((dwResult = eapxml::select_node(pDoc, winstd::bstr(L"eaphostconfig:Config"), &pXmlElConfig)) != ERROR_SUCCESS) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" Error selecting <Config> element."), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save all providers.
|
||||||
|
pDoc->setProperty(winstd::bstr(L"SelectionNamespaces"), winstd::variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||||
|
if ((dwResult = cfg.save(pDoc, pXmlElConfig, ppEapError)) != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
*ppConfigDoc = pDoc.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeConfigUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataInSize,
|
||||||
|
_In_count_(dwConnectionDataInSize) const BYTE *pConnectionDataIn,
|
||||||
|
_Out_ DWORD *pdwConnectionDataOutSize,
|
||||||
|
_Out_ BYTE **ppConnectionDataOut,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
winstd::actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
else if (!pEapType)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pEapType is NULL."), NULL);
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str(), NULL);
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str(), NULL);
|
||||||
|
else if (!pConnectionDataIn && dwConnectionDataInSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pConnectionDataIn is NULL."), NULL);
|
||||||
|
else if (!pdwConnectionDataOutSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pdwConnectionDataOutSize is NULL."), NULL);
|
||||||
|
else if (!ppConnectionDataOut)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppConnectionDataOut is NULL."), NULL);
|
||||||
|
else {
|
||||||
|
// Unpack configuration.
|
||||||
|
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||||
|
if (pConnectionDataIn || !dwConnectionDataInSize) {
|
||||||
|
const unsigned char *cursor = pConnectionDataIn;
|
||||||
|
eapserial::unpack(cursor, cfg);
|
||||||
|
assert(cursor - pConnectionDataIn <= (ptrdiff_t)dwConnectionDataInSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((dwResult = g_peer.invoke_config_ui(hwndParent, cfg, ppEapError)) != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
// Allocate BLOB for configuration.
|
||||||
|
assert(ppConnectionDataOut);
|
||||||
|
assert(pdwConnectionDataOutSize);
|
||||||
|
*pdwConnectionDataOutSize = (DWORD)eapserial::get_pk_size(cfg);
|
||||||
|
*ppConnectionDataOut = g_peer.alloc_memory(*pdwConnectionDataOutSize);
|
||||||
|
if (!*ppConnectionDataOut) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, 0, NULL, NULL, NULL, winstd::tstring_printf(_T(__FUNCTION__) _T(" Error allocating memory for configuration BLOB (%uB)."), *pdwConnectionDataOutSize).c_str(), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pack BLOB to output.
|
||||||
|
unsigned char *cursor = *ppConnectionDataOut;
|
||||||
|
eapserial::pack(cursor, cfg);
|
||||||
|
assert(cursor - *ppConnectionDataOut <= (ptrdiff_t)*pdwConnectionDataOutSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeIdentityUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwUserDataSize,
|
||||||
|
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||||
|
_Out_ DWORD *pdwUserDataOutSize,
|
||||||
|
_Out_ BYTE **ppUserDataOut,
|
||||||
|
_Out_ LPWSTR *ppwszIdentity,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
winstd::actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
else if (!pEapType)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pEapType is NULL."), NULL);
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str(), NULL);
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str(), NULL);
|
||||||
|
else if (!pConnectionData && dwConnectionDataSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pConnectionData is NULL."), NULL);
|
||||||
|
else if (!pUserData && dwUserDataSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pUserData is NULL."), NULL);
|
||||||
|
else if (!pdwUserDataOutSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pdwUserDataOutSize is NULL."), NULL);
|
||||||
|
else if (!ppUserDataOut)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppUserDataOut is NULL."), NULL);
|
||||||
|
else if (!ppwszIdentity)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppwszIdentity is NULL."), NULL);
|
||||||
|
else {
|
||||||
|
// Unpack configuration.
|
||||||
|
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||||
|
if (pConnectionData || !dwConnectionDataSize) {
|
||||||
|
const unsigned char *cursor = pConnectionData;
|
||||||
|
eapserial::unpack(cursor, cfg);
|
||||||
|
assert(cursor - pConnectionData <= (ptrdiff_t)dwConnectionDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unpack configuration.
|
||||||
|
_EAPMETHOD_PEER_UI::identity_type usr(g_peer);
|
||||||
|
if (pUserData || !dwUserDataSize) {
|
||||||
|
const unsigned char *cursor = pUserData;
|
||||||
|
eapserial::unpack(cursor, usr);
|
||||||
|
assert(cursor - pUserData <= (ptrdiff_t)dwUserDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((dwResult = g_peer.invoke_identity_ui(hwndParent, dwFlags, cfg, usr, ppwszIdentity, ppEapError)) != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
// Allocate BLOB for user data.
|
||||||
|
assert(ppUserDataOut);
|
||||||
|
assert(pdwUserDataOutSize);
|
||||||
|
*pdwUserDataOutSize = (DWORD)eapserial::get_pk_size(usr);
|
||||||
|
*ppUserDataOut = g_peer.alloc_memory(*pdwUserDataOutSize);
|
||||||
|
if (!*ppUserDataOut) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, 0, NULL, NULL, NULL, winstd::tstring_printf(_T(__FUNCTION__) _T(" Error allocating memory for configuration BLOB (%uB)."), *pdwUserDataOutSize).c_str(), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pack BLOB to output.
|
||||||
|
unsigned char *cursor = *ppUserDataOut;
|
||||||
|
eapserial::pack(cursor, usr);
|
||||||
|
assert(cursor - *ppUserDataOut <= (ptrdiff_t)*pdwUserDataOutSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeInteractiveUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_Out_ DWORD *pdwDataFromInteractiveUISize,
|
||||||
|
_Out_ BYTE **ppDataFromInteractiveUI,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
winstd::actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
else if (!pEapType)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pEapType is NULL."), NULL);
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str(), NULL);
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, 0, NULL, NULL, NULL, winstd::wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str(), NULL);
|
||||||
|
else if (!pUIContextData && dwUIContextDataSize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pUIContextData is NULL."), NULL);
|
||||||
|
else if (!pdwDataFromInteractiveUISize)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" pdwDataFromInteractiveUISize is NULL."), NULL);
|
||||||
|
else if (!ppDataFromInteractiveUI)
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, 0, NULL, NULL, NULL, _T(__FUNCTION__) _T(" ppDataFromInteractiveUI is NULL."), NULL);
|
||||||
|
else {
|
||||||
|
// Unpack request.
|
||||||
|
_EAPMETHOD_PEER_UI::interactive_request_type req;
|
||||||
|
if (pUIContextData || !dwUIContextDataSize) {
|
||||||
|
const unsigned char *cursor = pUIContextData;
|
||||||
|
eapserial::unpack(cursor, req);
|
||||||
|
assert(cursor - pUIContextData <= (ptrdiff_t)dwUIContextDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
_EAPMETHOD_PEER_UI::interactive_response_type res;
|
||||||
|
if ((dwResult = g_peer.invoke_interactive_ui(hwndParent, req, res, ppEapError)) != ERROR_SUCCESS)
|
||||||
|
return dwResult;
|
||||||
|
|
||||||
|
// Allocate BLOB for user data.
|
||||||
|
assert(ppDataFromInteractiveUI);
|
||||||
|
assert(pdwDataFromInteractiveUISize);
|
||||||
|
*pdwDataFromInteractiveUISize = (DWORD)eapserial::get_pk_size(res);
|
||||||
|
*ppDataFromInteractiveUI = g_peer.alloc_memory(*pdwDataFromInteractiveUISize);
|
||||||
|
if (!*ppDataFromInteractiveUI) {
|
||||||
|
*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, 0, NULL, NULL, NULL, winstd::tstring_printf(_T(__FUNCTION__) _T(" Error allocating memory for interactive response (%uB)."), *pdwDataFromInteractiveUISize).c_str(), NULL);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pack BLOB to output.
|
||||||
|
unsigned char *cursor = *ppDataFromInteractiveUI;
|
||||||
|
eapserial::pack(cursor, res);
|
||||||
|
assert(cursor - *ppDataFromInteractiveUI <= (ptrdiff_t)*pdwDataFromInteractiveUISize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
Binary file not shown.
68
EAPMethods/src/PAP_UI.cpp
Normal file
68
EAPMethods/src/PAP_UI.cpp
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
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);
|
||||||
|
}
|
Binary file not shown.
329
EAPMethods/src/TLS.cpp
Normal file
329
EAPMethods/src/TLS.cpp
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
/*
|
||||||
|
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;
|
||||||
|
}
|
658
EAPMethods/src/TLS_UI.cpp
Normal file
658
EAPMethods/src/TLS_UI.cpp
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
/*
|
||||||
|
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);
|
||||||
|
}
|
375
EAPMethods/src/TTLS.cpp
Normal file
375
EAPMethods/src/TTLS.cpp
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
/*
|
||||||
|
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;
|
||||||
|
}
|
259
EAPMethods/src/TTLS_UI.cpp
Normal file
259
EAPMethods/src/TTLS_UI.cpp
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
/*
|
||||||
|
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);
|
||||||
|
}
|
@@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EAP Methods", "EAP Methods", "{60BAAC3D-DC98-4C19-BC40-1A86963DE86C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EAP Methods", "EAP Methods", "{60BAAC3D-DC98-4C19-BC40-1A86963DE86C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLS", "EAPMethods\build\EAPTTLS.vcxproj", "{331B6077-E3E2-4867-B93E-9D3F57280DE7}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLS", "EAPMethods\EAPTTLS\EAPTTLS.vcxproj", "{331B6077-E3E2-4867-B93E-9D3F57280DE7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E66A3FE1-4EE4-401F-8EAD-BE518B230393}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E66A3FE1-4EE4-401F-8EAD-BE518B230393}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -18,9 +18,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CredWrite", "CredWrite\CredWrite.vcxproj", "{2D3CE079-7EB1-4F47-B79E-F0310671ECCB}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CredWrite", "CredWrite\CredWrite.vcxproj", "{2D3CE079-7EB1-4F47-B79E-F0310671ECCB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPMethodEvents", "EAPMethods\build\EAPMethodEvents.vcxproj", "{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPMethodEvents", "EAPMethods\EAPMethodEvents\EAPMethodEvents.vcxproj", "{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLSUI", "EAPMethods\build\EAPTTLSUI.vcxproj", "{DD7A97CA-F18E-43B7-95C4-D06E6A291624}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLSUI", "EAPMethods\EAPTTLSUI\EAPTTLSUI.vcxproj", "{DD7A97CA-F18E-43B7-95C4-D06E6A291624}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@@ -26,11 +26,13 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||||
<OutDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
<OutDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
||||||
|
<IncludePath>$(WXWIN)\include\msvc;$(WXWIN)\include;$(IncludePath)</IncludePath>
|
||||||
|
<SourcePath>$(WXWIN)\src\aui;$(WXWIN)\src\cocoa;$(WXWIN)\src\common;$(WXWIN)\src\dfb;$(WXWIN)\src\expat;$(WXWIN)\src\generic;$(WXWIN)\src\gtk;$(WXWIN)\src\gtk1;$(WXWIN)\src\html;$(WXWIN)\src\jpeg;$(WXWIN)\src\motif;$(WXWIN)\src\msdos;$(WXWIN)\src\msw;$(WXWIN)\src\os2;$(WXWIN)\src\osx;$(WXWIN)\src\png;$(WXWIN)\src\propgrid;$(WXWIN)\src\regex;$(WXWIN)\src\ribbon;$(WXWIN)\src\richtext;$(WXWIN)\src\stc;$(WXWIN)\src\tiff;$(WXWIN)\src\univ;$(WXWIN)\src\unix;$(WXWIN)\src\x11;$(WXWIN)\src\xml;$(WXWIN)\src\xrc;$(WXWIN)\src\zlib;$(SourcePath)</SourcePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;ISOLATION_AWARE_ENABLED=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
// Product version as a single DWORD
|
// Product version as a single DWORD
|
||||||
// Note: Used for version comparison within C/C++ code.
|
// Note: Used for version comparison within C/C++ code.
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION 0x00ff0100
|
#define PRODUCT_VERSION 0x00ff0300
|
||||||
|
|
||||||
//
|
//
|
||||||
// Product version by components
|
// Product version by components
|
||||||
@@ -39,26 +39,26 @@
|
|||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_MAJ 0
|
#define PRODUCT_VERSION_MAJ 0
|
||||||
#define PRODUCT_VERSION_MIN 255
|
#define PRODUCT_VERSION_MIN 255
|
||||||
#define PRODUCT_VERSION_REV 1
|
#define PRODUCT_VERSION_REV 3
|
||||||
#define PRODUCT_VERSION_BUILD 0
|
#define PRODUCT_VERSION_BUILD 0
|
||||||
|
|
||||||
//
|
//
|
||||||
// Human readable product version and build year for UI
|
// Human readable product version and build year for UI
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_STR "1.0-alpha1"
|
#define PRODUCT_VERSION_STR "1.0-alpha3"
|
||||||
#define PRODUCT_BUILD_YEAR_STR "2016"
|
#define PRODUCT_BUILD_YEAR_STR "2016"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Numerical version presentation for ProductVersion propery in
|
// Numerical version presentation for ProductVersion propery in
|
||||||
// MSI packages (syntax: N.N[.N[.N]])
|
// MSI packages (syntax: N.N[.N[.N]])
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_INST "0.255.1"
|
#define PRODUCT_VERSION_INST "0.255.3"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The product code for ProductCode property in MSI packages
|
// The product code for ProductCode property in MSI packages
|
||||||
// Replace with new on every version change, regardless how minor it is.
|
// Replace with new on every version change, regardless how minor it is.
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_GUID "{8D570776-75B9-4BD0-856B-FB19D7B65543}"
|
#define PRODUCT_VERSION_GUID "{14FCBB4F-BA19-46D7-B881-CA5AE7F42991}"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Since the product name is not finally confirmed at the time of
|
// Since the product name is not finally confirmed at the time of
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
<Import Project="Common.props" />
|
<Import Project="Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<LibraryPath>$(WXWIN)\lib\vc_lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
<Import Project="Common.props" />
|
<Import Project="Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<LibraryPath>$(WXWIN)\lib\vc_x64_lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX64</TargetMachine>
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
Submodule lib/WinStd updated: 46b77c7f69...bc0967edc3
Reference in New Issue
Block a user