Merge pull request #2849 from dgarske/csharp_wrapper

CSharp wrapper improvements
pull/2873/head
JacobBarthelmeh 2020-03-26 09:10:24 -06:00 committed by GitHub
commit 1bc2ecff6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 1197 additions and 120 deletions

View File

@ -0,0 +1,41 @@
# wolfSSL CSharp wrapper files
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/Settings.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/Settings.settings
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/Properties/Settings.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/Properties/Settings.settings
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp.sln
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/Resources.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/Resources.resx
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/wolfSSL_CSharp.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/Properties/Settings.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/Properties/Settings.settings
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.csproj

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-DTLS-PSK-Server")] [assembly: AssemblyProduct("wolfSSL-DTLS-PSK-Server")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-DTLS-Server")] [assembly: AssemblyProduct("wolfSSL-DTLS-Server")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-Example-IOCallbacks")] [assembly: AssemblyProduct("wolfSSL-Example-IOCallbacks")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -235,7 +235,7 @@ class wolfSSL_Example_IOCallbacks
if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS) if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;
@ -244,7 +244,7 @@ class wolfSSL_Example_IOCallbacks
if (wolfssl.accept(ssl) != wolfssl.SUCCESS) if (wolfssl.accept(ssl) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("wolfSSL-TLS-Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-TLS-Client")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("05aad2b4-445e-4f0e-8e16-8f8512696505")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace wolfSSL_TLS_CSharp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

View File

@ -0,0 +1,210 @@
/* wolfSSL-TLS-Client.cs
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL 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 2 of the License, or
* (at your option) any later version.
*
* wolfSSL 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using wolfSSL.CSharp;
public class wolfSSL_TLS_Client
{
/// <summary>
/// Example of a logging function
/// </summary>
/// <param name="lvl">level of log</param>
/// <param name="msg">message to log</param>
public static void standard_log(int lvl, StringBuilder msg)
{
Console.WriteLine(msg);
}
private static void clean(IntPtr ssl, IntPtr ctx)
{
wolfssl.free(ssl);
wolfssl.CTX_free(ctx);
wolfssl.Cleanup();
}
/// <summary>
/// Verification callback
/// </summary>
/// <param name="preverify">1=Verify Okay, 0=Failure</param>
/// <param name="x509_ctx">Certificate in WOLFSSL_X509_STORE_CTX format</param>
private static int myVerify(int preverify, IntPtr x509_ctx)
{
/* Use the provided verification */
/* Can optionally override failures by returning non-zero value */
return preverify;
}
public static void Main(string[] args)
{
IntPtr ctx;
IntPtr ssl;
Socket tcp;
/* These paths should be changed for use */
string caCert = @"ca-cert.pem";
StringBuilder dhparam = new StringBuilder("dh2048.pem");
StringBuilder buff = new StringBuilder(1024);
StringBuilder reply = new StringBuilder("Hello, this is the wolfSSL C# wrapper");
//example of function used for setting logging
wolfssl.SetLogging(standard_log);
wolfssl.Init();
Console.WriteLine("Calling ctx Init from wolfSSL");
ctx = wolfssl.CTX_new(wolfssl.usev23_client());
if (ctx == IntPtr.Zero)
{
Console.WriteLine("Error in creating ctx structure");
return;
}
Console.WriteLine("Finished init of ctx .... now load in CA");
if (!File.Exists(caCert))
{
Console.WriteLine("Could not find CA cert file");
wolfssl.CTX_free(ctx);
return;
}
if (wolfssl.CTX_load_verify_locations(ctx, caCert, null)
!= wolfssl.SUCCESS)
{
Console.WriteLine("Error loading CA cert");
}
StringBuilder ciphers = new StringBuilder(new String(' ', 4096));
wolfssl.get_ciphers(ciphers, 4096);
Console.WriteLine("Ciphers : " + ciphers.ToString());
/* Uncomment Section to enable specific cipher suite */
#if false
ciphers = new StringBuilder("ECDHE-ECDSA-AES128-GCM-SHA256");
if (wolfssl.CTX_set_cipher_list(ctx, ciphers) != wolfssl.SUCCESS)
{
Console.WriteLine("ERROR CTX_set_cipher_list()");
wolfssl.CTX_free(ctx);
return;
}
#endif
short minDhKey = 128;
wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey);
/* Setup Verify Callback */
if (wolfssl.CTX_set_verify(ctx, wolfssl.SSL_VERIFY_PEER, myVerify)
!= wolfssl.SUCCESS)
{
Console.WriteLine("Error setting verify callback!");
}
/* set up TCP socket */
tcp = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
try
{
tcp.Connect("localhost", 11111);
}
catch (Exception e)
{
Console.WriteLine("tcp.Connect() error " + e.ToString());
wolfssl.CTX_free(ctx);
return;
}
if (!tcp.Connected)
{
Console.WriteLine("tcp.Connect() failed!");
tcp.Close();
wolfssl.CTX_free(ctx);
return;
}
Console.WriteLine("Connected TCP");
ssl = wolfssl.new_ssl(ctx);
if (ssl == IntPtr.Zero)
{
Console.WriteLine("Error in creating ssl object");
wolfssl.CTX_free(ctx);
return;
}
Console.WriteLine("Connection made wolfSSL_connect ");
if (wolfssl.set_fd(ssl, tcp) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.WriteLine(wolfssl.get_error(ssl));
tcp.Close();
clean(ssl, ctx);
return;
}
wolfssl.SetTmpDH_file(ssl, dhparam, wolfssl.SSL_FILETYPE_PEM);
if (wolfssl.connect(ssl) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.WriteLine(wolfssl.get_error(ssl));
tcp.Close();
clean(ssl, ctx);
return;
}
/* print out results of TLS/SSL accept */
Console.WriteLine("SSL version is " + wolfssl.get_version(ssl));
Console.WriteLine("SSL cipher suite is " + wolfssl.get_current_cipher(ssl));
if (wolfssl.write(ssl, reply, reply.Length) != reply.Length)
{
Console.WriteLine("Error in write");
tcp.Close();
clean(ssl, ctx);
return;
}
/* read and print out the message then reply */
if (wolfssl.read(ssl, buff, 1023) < 0)
{
Console.WriteLine("Error in read");
tcp.Close();
clean(ssl, ctx);
return;
}
Console.WriteLine(buff);
wolfssl.shutdown(ssl);
tcp.Close();
clean(ssl, ctx);
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>wolfSSL_TLS_Client</RootNamespace>
<AssemblyName>wolfSSL-TLS-Client</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\DLL Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\DLL Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\x64\DLL Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\x64\DLL Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="wolfSSL-TLS-Client.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\wolfSSL_CSharp\wolfSSL_CSharp.csproj">
<Project>{52609808-0418-46d3-8e17-141927a1a39a}</Project>
<Name>wolfSSL_CSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-TLS-PSK-Server")] [assembly: AssemblyProduct("wolfSSL-TLS-PSK-Server")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/ */
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -165,7 +165,7 @@ public class wolfSSL_TLS_PSK_Server
if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS) if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;
@ -176,7 +176,7 @@ public class wolfSSL_TLS_PSK_Server
if (wolfssl.accept(ssl) != wolfssl.SUCCESS) if (wolfssl.accept(ssl) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-TLS-Server")] [assembly: AssemblyProduct("wolfSSL-TLS-Server")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/ */
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -108,7 +108,7 @@ public class wolfSSL_TLS_CSHarp
wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey); wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey);
/* set up TCP socket */ /* set up TCP socket */
IPAddress ip = IPAddress.Parse("0.0.0.0"); //bind to any IPAddress ip = IPAddress.Parse("0.0.0.0"); /* bind to any */
TcpListener tcp = new TcpListener(ip, 11111); TcpListener tcp = new TcpListener(ip, 11111);
tcp.Start(); tcp.Start();
@ -126,7 +126,7 @@ public class wolfSSL_TLS_CSHarp
if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS) if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;
@ -137,7 +137,7 @@ public class wolfSSL_TLS_CSHarp
if (wolfssl.accept(ssl) != wolfssl.SUCCESS) if (wolfssl.accept(ssl) != wolfssl.SUCCESS)
{ {
/* get and print out the error */ /* get and print out the error */
Console.Write(wolfssl.get_error(ssl)); Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop(); tcp.Stop();
clean(ssl, ctx); clean(ssl, ctx);
return; return;

View File

@ -7,7 +7,7 @@
<ProjectGuid>{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}</ProjectGuid> <ProjectGuid>{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>wolfSSL_TLS_CSharp</RootNamespace> <RootNamespace>wolfSSL_TLS_Server</RootNamespace>
<AssemblyName>wolfSSL-TLS-Server</AssemblyName> <AssemblyName>wolfSSL-TLS-Server</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("wolfSSL-TLS-Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL-TLS-Server")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("716e8f30-1318-4e3b-b788-d0380b397a4c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace wolfSSL_TLS_CSharp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

View File

@ -0,0 +1,194 @@
/* wolfSSL-TLS-ServerThreaded.cs
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL 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 2 of the License, or
* (at your option) any later version.
*
* wolfSSL 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using wolfSSL.CSharp;
public class wolfSSL_TLS_ServerThread
{
private IntPtr _ctx;
private Socket _fd;
public wolfSSL_TLS_ServerThread(IntPtr ctx, Socket fd)
{
_ctx = ctx;
_fd = fd;
}
private const int kEchoBufSz = 1024;
public void start_client()
{
StringBuilder buff = new StringBuilder(kEchoBufSz);
IntPtr ssl = wolfssl.new_ssl(_ctx);
if (ssl == IntPtr.Zero)
{
Console.WriteLine("Error in creating ssl object");
return;
}
if (wolfssl.set_fd(ssl, _fd) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.WriteLine(wolfssl.get_error(ssl));
_fd.Close();
wolfssl.free(ssl);
return;
}
Console.WriteLine("Starting TLS handshake");
if (wolfssl.accept(ssl) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.WriteLine("Failed " + wolfssl.get_error(ssl));
_fd.Close();
wolfssl.free(ssl);
return;
}
/* print out results of TLS/SSL accept */
Console.WriteLine("SSL version is " + wolfssl.get_version(ssl));
Console.WriteLine("SSL cipher suite is " + wolfssl.get_current_cipher(ssl));
/* echo data until error */
while (true)
{
/* read and print out the message then reply */
if (wolfssl.read(ssl, buff, kEchoBufSz-1) < 0)
{
Console.WriteLine("Error in read");
break;
}
Console.WriteLine(buff);
if (wolfssl.write(ssl, buff, buff.Length) != buff.Length)
{
Console.WriteLine("Error in write");
break;
}
}
Console.WriteLine("Closing " + wolfssl.get_error(ssl));
_fd.Close();
wolfssl.free(ssl);
}
}
public class wolfSSL_TLS_ServerThreaded
{
/// <summary>
/// Example of a logging function
/// </summary>
/// <param name="lvl">level of log</param>
/// <param name="msg">message to log</param>
public static void standard_log(int lvl, StringBuilder msg)
{
Console.WriteLine(msg);
}
public static void Main(string[] args)
{
IntPtr ctx;
/* These paths should be changed for use */
string fileCert = @"server-cert.pem";
string fileKey = @"server-key.pem";
StringBuilder dhparam = new StringBuilder("dh2048.pem");
/* example of function used for setting logging */
wolfssl.SetLogging(standard_log);
wolfssl.Init();
Console.WriteLine("Calling ctx Init from wolfSSL");
ctx = wolfssl.CTX_new(wolfssl.usev23_server());
if (ctx == IntPtr.Zero)
{
Console.WriteLine("Error in creating ctx structure");
return;
}
Console.WriteLine("Finished init of ctx .... now load in cert and key");
if (!File.Exists(fileCert) || !File.Exists(fileKey))
{
Console.WriteLine("Could not find cert or key file");
wolfssl.CTX_free(ctx);
return;
}
if (wolfssl.CTX_use_certificate_file(ctx, fileCert, wolfssl.SSL_FILETYPE_PEM) != wolfssl.SUCCESS)
{
Console.WriteLine("Error in setting cert file");
wolfssl.CTX_free(ctx);
return;
}
if (wolfssl.CTX_use_PrivateKey_file(ctx, fileKey, wolfssl.SSL_FILETYPE_PEM) != wolfssl.SUCCESS)
{
Console.WriteLine("Error in setting key file");
wolfssl.CTX_free(ctx);
return;
}
StringBuilder ciphers = new StringBuilder(new String(' ', 4096));
wolfssl.get_ciphers(ciphers, 4096);
Console.WriteLine("Ciphers : " + ciphers.ToString());
short minDhKey = 128;
wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey);
wolfssl.CTX_SetTmpDH_file(ctx, dhparam, wolfssl.SSL_FILETYPE_PEM);
/* set up TCP socket */
IPAddress ip = IPAddress.Parse("0.0.0.0"); /* bind to any */
TcpListener tcp = new TcpListener(ip, 11111);
tcp.Start();
Console.WriteLine("Started TCP and waiting for a connection");
while (true) {
try
{
Socket fd = tcp.AcceptSocket();
Console.WriteLine("Got client connection");
/* Spin up thread for client */
wolfSSL_TLS_ServerThread thread = new wolfSSL_TLS_ServerThread(ctx, fd);
Thread thr = new Thread(new ThreadStart(thread.start_client));
thr.Start();
}
catch(Exception ex)
{
Console.WriteLine("Server Exception " + ex.ToString());
break;
}
}
tcp.Stop();
wolfssl.CTX_free(ctx);
wolfssl.Cleanup();
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>wolfSSL_TLS_ServerThreaded</RootNamespace>
<AssemblyName>wolfSSL-TLS-ServerThreaded</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\DLL Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\DLL Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\x64\DLL Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\x64\DLL Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="wolfSSL-TLS-ServerThreaded.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\wolfSSL_CSharp\wolfSSL_CSharp.csproj">
<Project>{52609808-0418-46d3-8e17-141927a1a39a}</Project>
<Name>wolfSSL_CSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -25,78 +25,140 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsuite", "..\..\testsuit
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wolfSSL-Example-IOCallbacks", "wolfSSL-Example-IOCallbacks\wolfSSL-Example-IOCallbacks.csproj", "{E2415718-0A15-48DB-A774-01FB0093B626}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wolfSSL-Example-IOCallbacks", "wolfSSL-Example-IOCallbacks\wolfSSL-Example-IOCallbacks.csproj", "{E2415718-0A15-48DB-A774-01FB0093B626}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wolfSSL-TLS-Client", "wolfSSL-TLS-Client\wolfSSL-TLS-Client.csproj", "{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wolfSSL-TLS-ServerThreaded", "wolfSSL-TLS-ServerThreaded\wolfSSL-TLS-ServerThreaded.csproj", "{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
DLL Debug|Any CPU = DLL Debug|Any CPU
DLL Debug|Win32 = DLL Debug|Win32 DLL Debug|Win32 = DLL Debug|Win32
DLL Debug|x64 = DLL Debug|x64 DLL Debug|x64 = DLL Debug|x64
DLL Release|Any CPU = DLL Release|Any CPU
DLL Release|Win32 = DLL Release|Win32 DLL Release|Win32 = DLL Release|Win32
DLL Release|x64 = DLL Release|x64 DLL Release|x64 = DLL Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Win32.Build.0 = Debug|Any CPU {52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|x64.ActiveCfg = Debug|x64 {52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|x64.ActiveCfg = Debug|x64
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|x64.Build.0 = Debug|x64 {52609808-0418-46D3-8E17-141927A1A39A}.DLL Debug|x64.Build.0 = Debug|x64
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Win32.ActiveCfg = Release|Any CPU {52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Win32.Build.0 = Release|Any CPU {52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|Win32.Build.0 = Release|Any CPU
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|x64.ActiveCfg = Release|x64 {52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|x64.ActiveCfg = Release|x64
{52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|x64.Build.0 = Release|x64 {52609808-0418-46D3-8E17-141927A1A39A}.DLL Release|x64.Build.0 = Release|x64
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Win32.Build.0 = Debug|Any CPU {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|x64.ActiveCfg = Debug|x64 {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|x64.ActiveCfg = Debug|x64
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|x64.Build.0 = Debug|x64 {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Debug|x64.Build.0 = Debug|x64
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Win32.ActiveCfg = Release|Any CPU {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Win32.Build.0 = Release|Any CPU {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|Win32.Build.0 = Release|Any CPU
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|x64.ActiveCfg = Release|x64 {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|x64.ActiveCfg = Release|x64
{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|x64.Build.0 = Release|x64 {8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}.DLL Release|x64.Build.0 = Release|x64
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Win32.Build.0 = Debug|Any CPU {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|x64.ActiveCfg = Debug|x64 {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|x64.ActiveCfg = Debug|x64
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|x64.Build.0 = Debug|x64 {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Debug|x64.Build.0 = Debug|x64
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Win32.ActiveCfg = Release|Any CPU {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Win32.Build.0 = Release|Any CPU {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|Win32.Build.0 = Release|Any CPU
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|x64.ActiveCfg = Release|x64 {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|x64.ActiveCfg = Release|x64
{030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|x64.Build.0 = Release|x64 {030431C7-26AB-4447-815B-F27E88BE5D5B}.DLL Release|x64.Build.0 = Release|x64
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Win32.Build.0 = Debug|Any CPU {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|x64.ActiveCfg = Debug|x64 {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|x64.ActiveCfg = Debug|x64
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|x64.Build.0 = Debug|x64 {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Debug|x64.Build.0 = Debug|x64
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Win32.ActiveCfg = Release|Any CPU {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Win32.Build.0 = Release|Any CPU {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|Win32.Build.0 = Release|Any CPU
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|x64.ActiveCfg = Release|x64 {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|x64.ActiveCfg = Release|x64
{730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|x64.Build.0 = Release|x64 {730F047E-37A6-498F-A543-B6C98AA7B338}.DLL Release|x64.Build.0 = Release|x64
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Win32.Build.0 = Debug|Any CPU {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|x64.ActiveCfg = Debug|x64 {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|x64.ActiveCfg = Debug|x64
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|x64.Build.0 = Debug|x64 {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Debug|x64.Build.0 = Debug|x64
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Win32.ActiveCfg = Release|Any CPU {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Win32.Build.0 = Release|Any CPU {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|Win32.Build.0 = Release|Any CPU
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|x64.ActiveCfg = Release|x64 {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|x64.ActiveCfg = Release|x64
{77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|x64.Build.0 = Release|x64 {77AEF1BE-4BE3-4837-8188-2A06E4D963F5}.DLL Release|x64.Build.0 = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Any CPU.ActiveCfg = DLL Debug|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Any CPU.Build.0 = DLL Debug|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.Build.0 = DLL Debug|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.ActiveCfg = DLL Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.Build.0 = DLL Debug|x64 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.Build.0 = DLL Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Any CPU.ActiveCfg = DLL Release|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Any CPU.Build.0 = DLL Release|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.ActiveCfg = DLL Release|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.Build.0 = DLL Release|Win32 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.Build.0 = DLL Release|Win32
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.ActiveCfg = DLL Release|x64 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.ActiveCfg = DLL Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.Build.0 = DLL Release|x64 {73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.Build.0 = DLL Release|x64
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Any CPU.ActiveCfg = DLL Debug|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Any CPU.Build.0 = DLL Debug|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|Win32.Build.0 = DLL Debug|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|x64.ActiveCfg = DLL Debug|x64
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|x64.Build.0 = DLL Debug|x64 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Debug|x64.Build.0 = DLL Debug|x64
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Any CPU.ActiveCfg = DLL Release|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Any CPU.Build.0 = DLL Release|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Win32.ActiveCfg = DLL Release|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Win32.Build.0 = DLL Release|Win32 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|Win32.Build.0 = DLL Release|Win32
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|x64.ActiveCfg = DLL Release|x64 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|x64.ActiveCfg = DLL Release|x64
{611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|x64.Build.0 = DLL Release|x64 {611E8971-46E0-4D0A-B5A1-632C3B00CB80}.DLL Release|x64.Build.0 = DLL Release|x64
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Win32.Build.0 = Debug|Any CPU {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|x64.ActiveCfg = Debug|x64 {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|x64.ActiveCfg = Debug|x64
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|x64.Build.0 = Debug|x64 {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Debug|x64.Build.0 = Debug|x64
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Win32.ActiveCfg = Release|Any CPU {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Win32.Build.0 = Release|Any CPU {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|Win32.Build.0 = Release|Any CPU
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|x64.ActiveCfg = Release|x64 {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|x64.ActiveCfg = Release|x64
{E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|x64.Build.0 = Release|x64 {E2415718-0A15-48DB-A774-01FB0093B626}.DLL Release|x64.Build.0 = Release|x64
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|x64.ActiveCfg = Debug|x64
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Debug|x64.Build.0 = Debug|x64
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|Win32.Build.0 = Release|Any CPU
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|x64.ActiveCfg = Release|x64
{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}.DLL Release|x64.Build.0 = Release|x64
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|Any CPU.Build.0 = Debug|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|Win32.ActiveCfg = Debug|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|Win32.Build.0 = Debug|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|x64.ActiveCfg = Debug|x64
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Debug|x64.Build.0 = Debug|x64
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|Any CPU.ActiveCfg = Release|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|Any CPU.Build.0 = Release|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|Win32.ActiveCfg = Release|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|Win32.Build.0 = Release|Any CPU
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|x64.ActiveCfg = Release|x64
{8ABD2E8F-AEE7-40ED-A966-900ACFAE555F}.DLL Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -105,4 +167,7 @@ Global
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {252D09D0-D007-4AEB-9F7A-A74408039A8A} {73973223-5EE8-41CA-8E88-1D60E89A237B} = {252D09D0-D007-4AEB-9F7A-A74408039A8A}
{611E8971-46E0-4D0A-B5A1-632C3B00CB80} = {252D09D0-D007-4AEB-9F7A-A74408039A8A} {611E8971-46E0-4D0A-B5A1-632C3B00CB80} = {252D09D0-D007-4AEB-9F7A-A74408039A8A}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63D316F8-C4EE-449A-B9A6-FC673C4D5D31}
EndGlobalSection
EndGlobal EndGlobal

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("wolfSSL")] [assembly: AssemblyCompany("wolfSSL")]
[assembly: AssemblyProduct("wolfSSL.CSharp")] [assembly: AssemblyProduct("wolfSSL.CSharp")]
[assembly: AssemblyCopyright("Copyright wolfSSL 2015")] [assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -50,22 +50,20 @@ namespace wolfSSL.CSharp {
/******************************** /********************************
* Class for keeping ctx/ssl handles alive * Class for keeping ctx handles alive
*/ */
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
private class ctx_handles private class ctx_handle
{ {
private GCHandle rec_cb; private GCHandle rec_cb;
private GCHandle snd_cb; private GCHandle snd_cb;
private GCHandle psk_cb; private GCHandle psk_cb;
private GCHandle fd_pin;
private IntPtr ctx; private IntPtr ctx;
public void set_receive(GCHandle input) public void set_receive(GCHandle input)
{ {
this.rec_cb = input; this.rec_cb = input;
} }
public GCHandle get_receive() public GCHandle get_receive()
{ {
return this.rec_cb; return this.rec_cb;
@ -75,7 +73,6 @@ namespace wolfSSL.CSharp {
{ {
this.snd_cb = input; this.snd_cb = input;
} }
public GCHandle get_send() public GCHandle get_send()
{ {
return this.snd_cb; return this.snd_cb;
@ -85,27 +82,15 @@ namespace wolfSSL.CSharp {
{ {
this.psk_cb = input; this.psk_cb = input;
} }
public GCHandle get_psk() public GCHandle get_psk()
{ {
return this.psk_cb; return this.psk_cb;
} }
public void set_fd(GCHandle input)
{
this.fd_pin = input;
}
public GCHandle get_fd()
{
return this.fd_pin;
}
public void set_ctx(IntPtr input) public void set_ctx(IntPtr input)
{ {
this.ctx = input; this.ctx = input;
} }
public IntPtr get_ctx() public IntPtr get_ctx()
{ {
return this.ctx; return this.ctx;
@ -116,7 +101,7 @@ namespace wolfSSL.CSharp {
/// </summary> /// </summary>
public void free() public void free()
{ {
log(INFO_LOG, "freeing handles"); log(INFO_LOG, "freeing ctx handle");
if (!Object.Equals(this.rec_cb, default(GCHandle))) if (!Object.Equals(this.rec_cb, default(GCHandle)))
{ {
this.rec_cb.Free(); this.rec_cb.Free();
@ -129,10 +114,57 @@ namespace wolfSSL.CSharp {
{ {
this.psk_cb.Free(); this.psk_cb.Free();
} }
}
}
/********************************
* Class for keeping ssl handle alive
*/
[StructLayout(LayoutKind.Sequential)]
private class ssl_handle
{
private GCHandle fd_pin;
private GCHandle psk_cb;
private IntPtr ssl;
public void set_fd(GCHandle input)
{
this.fd_pin = input;
}
public GCHandle get_fd()
{
return this.fd_pin;
}
public void set_psk(GCHandle input)
{
this.psk_cb = input;
}
public GCHandle get_psk()
{
return this.psk_cb;
}
public void set_ssl(IntPtr input)
{
this.ssl = input;
}
public IntPtr get_ssl()
{
return this.ssl;
}
public void free()
{
log(INFO_LOG, "freeing ssl handle");
if (!Object.Equals(this.fd_pin, default(GCHandle))) if (!Object.Equals(this.fd_pin, default(GCHandle)))
{ {
this.fd_pin.Free(); this.fd_pin.Free();
} }
if (!Object.Equals(this.psk_cb, default(GCHandle)))
{
this.psk_cb.Free();
}
} }
} }
@ -152,10 +184,14 @@ namespace wolfSSL.CSharp {
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfTLSv1_2_server_method(); private extern static IntPtr wolfTLSv1_2_server_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfTLSv1_3_server_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfSSLv23_server_method(); private extern static IntPtr wolfSSLv23_server_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfTLSv1_2_client_method(); private extern static IntPtr wolfTLSv1_2_client_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfTLSv1_3_client_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfSSLv23_client_method(); private extern static IntPtr wolfSSLv23_client_method();
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr wolfDTLSv1_2_server_method(); private extern static IntPtr wolfDTLSv1_2_server_method();
@ -278,6 +314,18 @@ namespace wolfSSL.CSharp {
private extern static int wolfSSL_CTX_SetMinDhKey_Sz(IntPtr ctx, short size); private extern static int wolfSSL_CTX_SetMinDhKey_Sz(IntPtr ctx, short size);
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)] [DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static int wolfSSL_SetTmpDH_file(IntPtr ssl, StringBuilder dhParam, int type); private extern static int wolfSSL_SetTmpDH_file(IntPtr ssl, StringBuilder dhParam, int type);
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static int wolfSSL_CTX_SetTmpDH_file(IntPtr ctx, StringBuilder dhParam, int type);
/********************************
* Verify Callback
*/
public delegate int CallbackVerify_delegate(int ret, IntPtr x509_ctx);
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static void wolfSSL_CTX_set_verify(IntPtr ctx, int mode, CallbackVerify_delegate vc);
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
private extern static void wolfSSL_set_verify(IntPtr ssl, int mode, CallbackVerify_delegate vc);
/******************************** /********************************
@ -286,6 +334,13 @@ namespace wolfSSL.CSharp {
public static readonly int SSL_FILETYPE_PEM = 1; public static readonly int SSL_FILETYPE_PEM = 1;
public static readonly int SSL_FILETYPE_ASN1= 2; public static readonly int SSL_FILETYPE_ASN1= 2;
public static readonly int SSL_FILETYPE_RAW = 3; public static readonly int SSL_FILETYPE_RAW = 3;
public static readonly int SSL_VERIFY_NONE = 0;
public static readonly int SSL_VERIFY_PEER = 1;
public static readonly int SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2;
public static readonly int SSL_VERIFY_CLIENT_ONCE = 4;
public static readonly int SSL_VERIFY_FAIL_EXCEPT_PSK = 8;
public static readonly int CBIO_ERR_GENERAL = -1; public static readonly int CBIO_ERR_GENERAL = -1;
public static readonly int CBIO_ERR_WANT_READ = -2; public static readonly int CBIO_ERR_WANT_READ = -2;
public static readonly int CBIO_ERR_WANT_WRITE = -2; public static readonly int CBIO_ERR_WANT_WRITE = -2;
@ -304,13 +359,25 @@ namespace wolfSSL.CSharp {
public static readonly int FAILURE = 0; public static readonly int FAILURE = 0;
private static IntPtr unwrap(IntPtr ctx) private static IntPtr unwrap_ctx(IntPtr ctx)
{ {
try { try {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
return handles.get_ctx(); return handles.get_ctx();
} catch (Exception e) } catch (Exception e)
{
log(ERROR_LOG, "wolfssl ctx pointer is incorrect " + e);
return IntPtr.Zero;
}
}
private static IntPtr unwrap_ssl(IntPtr ssl)
{
try {
GCHandle gch = GCHandle.FromIntPtr(ssl);
ssl_handle handles = (ssl_handle)gch.Target;
return handles.get_ssl();
} catch (Exception e)
{ {
log(ERROR_LOG, "wolfssl pointer is incorrect " + e); log(ERROR_LOG, "wolfssl pointer is incorrect " + e);
return IntPtr.Zero; return IntPtr.Zero;
@ -496,19 +563,19 @@ namespace wolfSSL.CSharp {
try try
{ {
ctx_handles io; ssl_handle io;
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "new_ssl error"); log(ERROR_LOG, "new_ssl ctx unwrap error");
return IntPtr.Zero; return IntPtr.Zero;
} }
io = new ctx_handles(); io = new ssl_handle();
io.set_ctx(wolfSSL_new(local_ctx)); io.set_ssl(wolfSSL_new(local_ctx));
/* check if null */ /* check if null */
if (io.get_ctx() == IntPtr.Zero) if (io.get_ssl() == IntPtr.Zero)
{ {
return IntPtr.Zero; return IntPtr.Zero;
} }
@ -535,10 +602,10 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "accept error"); log(ERROR_LOG, "accept ssl unwrap error");
return FAILURE; return FAILURE;
} }
@ -563,10 +630,10 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "connect error"); log(ERROR_LOG, "connect ssl unwrap error");
return FAILURE; return FAILURE;
} }
@ -593,14 +660,16 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
IntPtr data; IntPtr data;
int ret; int ret;
byte[] msg; byte[] msg;
buf.Clear(); /* Clear incomming buffer */
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "read error"); log(ERROR_LOG, "read ssl unwrap error");
return FAILURE; return FAILURE;
} }
data = Marshal.AllocHGlobal(sz); data = Marshal.AllocHGlobal(sz);
@ -645,13 +714,13 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
IntPtr data; IntPtr data;
int ret; int ret;
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl read error"); log(ERROR_LOG, "read ssl unwrap error");
return FAILURE; return FAILURE;
} }
data = Marshal.AllocHGlobal(sz); data = Marshal.AllocHGlobal(sz);
@ -688,13 +757,13 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
IntPtr data; IntPtr data;
int ret; int ret;
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "write error"); log(ERROR_LOG, "write ssl unwrap error");
return FAILURE; return FAILURE;
} }
@ -727,13 +796,13 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
IntPtr data; IntPtr data;
int ret; int ret;
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "write error"); log(ERROR_LOG, "write ssl unwrap error");
return FAILURE; return FAILURE;
} }
data = Marshal.AllocHGlobal(sz); data = Marshal.AllocHGlobal(sz);
@ -761,9 +830,9 @@ namespace wolfSSL.CSharp {
{ {
IntPtr sslCtx; IntPtr sslCtx;
GCHandle gch = GCHandle.FromIntPtr(ssl); GCHandle gch = GCHandle.FromIntPtr(ssl);
ctx_handles handles = (ctx_handles)gch.Target; ssl_handle handles = (ssl_handle)gch.Target;
sslCtx = handles.get_ctx(); sslCtx = handles.get_ssl();
wolfSSL_free(sslCtx); wolfSSL_free(sslCtx);
handles.free(); handles.free();
gch.Free(); gch.Free();
@ -786,10 +855,10 @@ namespace wolfSSL.CSharp {
return FAILURE; return FAILURE;
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl shutdown error"); log(ERROR_LOG, "shutdown ssl unwrap error");
return FAILURE; return FAILURE;
} }
@ -813,7 +882,7 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
/* check if already stored handle needs freed */ /* check if already stored handle needs freed */
gch = handles.get_receive(); gch = handles.get_receive();
@ -844,7 +913,7 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
/* check if already stored handle needs freed */ /* check if already stored handle needs freed */
gch = handles.get_send(); gch = handles.get_send();
@ -878,7 +947,7 @@ namespace wolfSSL.CSharp {
if (ctx == IntPtr.Zero) if (ctx == IntPtr.Zero)
return ctx; return ctx;
ctx_handles io = new ctx_handles(); ctx_handle io = new ctx_handle();
io.set_ctx(ctx); io.set_ctx(ctx);
CallbackIORecv_delegate recv = new CallbackIORecv_delegate(wolfssl.wolfSSLCbIORecv); CallbackIORecv_delegate recv = new CallbackIORecv_delegate(wolfssl.wolfSSLCbIORecv);
@ -913,7 +982,7 @@ namespace wolfSSL.CSharp {
if (ctx == IntPtr.Zero) if (ctx == IntPtr.Zero)
return ctx; return ctx;
ctx_handles io = new ctx_handles(); ctx_handle io = new ctx_handle();
io.set_ctx(ctx); io.set_ctx(ctx);
CallbackIORecv_delegate recv = new CallbackIORecv_delegate(wolfssl.wolfSSL_dtlsCbIORecv); CallbackIORecv_delegate recv = new CallbackIORecv_delegate(wolfssl.wolfSSL_dtlsCbIORecv);
@ -944,7 +1013,7 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
wolfSSL_CTX_free(handles.get_ctx()); wolfSSL_CTX_free(handles.get_ctx());
handles.free(); handles.free();
gch.Free(); gch.Free();
@ -966,10 +1035,10 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX use psk identity hint error"); log(ERROR_LOG, "CTX use psk identity hint unwrap error");
return FAILURE; return FAILURE;
} }
@ -993,7 +1062,7 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
handles.set_psk(GCHandle.Alloc(psk_cb)); handles.set_psk(GCHandle.Alloc(psk_cb));
wolfSSL_CTX_set_psk_server_callback(handles.get_ctx(), psk_cb); wolfSSL_CTX_set_psk_server_callback(handles.get_ctx(), psk_cb);
@ -1015,7 +1084,7 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ctx); GCHandle gch = GCHandle.FromIntPtr(ctx);
ctx_handles handles = (ctx_handles)gch.Target; ctx_handle handles = (ctx_handle)gch.Target;
handles.set_psk(GCHandle.Alloc(psk_cb)); handles.set_psk(GCHandle.Alloc(psk_cb));
wolfSSL_CTX_set_psk_client_callback(handles.get_ctx(), psk_cb); wolfSSL_CTX_set_psk_client_callback(handles.get_ctx(), psk_cb);
@ -1037,10 +1106,10 @@ namespace wolfSSL.CSharp {
try try
{ {
GCHandle gch = GCHandle.FromIntPtr(ssl); GCHandle gch = GCHandle.FromIntPtr(ssl);
ctx_handles handles = (ctx_handles)gch.Target; ssl_handle handles = (ssl_handle)gch.Target;
handles.set_psk(GCHandle.Alloc(psk_cb)); handles.set_psk(GCHandle.Alloc(psk_cb));
wolfSSL_set_psk_server_callback(handles.get_ctx(), psk_cb); wolfSSL_set_psk_server_callback(handles.get_ssl(), psk_cb);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1068,8 +1137,8 @@ namespace wolfSSL.CSharp {
if (!fd.Equals(null)) if (!fd.Equals(null))
{ {
GCHandle gch = GCHandle.FromIntPtr(ssl); GCHandle gch = GCHandle.FromIntPtr(ssl);
ctx_handles handles = (ctx_handles)gch.Target; ssl_handle handles = (ssl_handle)gch.Target;
IntPtr sslCtx = handles.get_ctx(); IntPtr sslCtx = handles.get_ssl();
IntPtr ptr; IntPtr ptr;
GCHandle fd_pin = GCHandle.Alloc(fd); GCHandle fd_pin = GCHandle.Alloc(fd);
@ -1107,7 +1176,7 @@ namespace wolfSSL.CSharp {
try try
{ {
IntPtr ptr; IntPtr ptr;
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl get_fd error"); log(ERROR_LOG, "wolfssl get_fd error");
@ -1153,7 +1222,7 @@ namespace wolfSSL.CSharp {
IntPtr ptr; IntPtr ptr;
DTLS_con con; DTLS_con con;
GCHandle gch = GCHandle.FromIntPtr(ssl); GCHandle gch = GCHandle.FromIntPtr(ssl);
ctx_handles handles = (ctx_handles)gch.Target; ssl_handle handles = (ssl_handle)gch.Target;
GCHandle fd_pin; GCHandle fd_pin;
con = new DTLS_con(); con = new DTLS_con();
@ -1162,8 +1231,8 @@ namespace wolfSSL.CSharp {
fd_pin = GCHandle.Alloc(con); fd_pin = GCHandle.Alloc(con);
handles.set_fd(fd_pin); handles.set_fd(fd_pin);
ptr = GCHandle.ToIntPtr(fd_pin); ptr = GCHandle.ToIntPtr(fd_pin);
wolfSSL_SetIOWriteCtx(handles.get_ctx(), ptr); //pass along the socket for writing to wolfSSL_SetIOWriteCtx(handles.get_ssl(), ptr); //pass along the socket for writing to
wolfSSL_SetIOReadCtx(handles.get_ctx(), ptr); //pass along the socket for reading from wolfSSL_SetIOReadCtx(handles.get_ssl(), ptr); //pass along the socket for reading from
return SUCCESS; return SUCCESS;
} }
@ -1187,7 +1256,7 @@ namespace wolfSSL.CSharp {
try try
{ {
IntPtr ptr; IntPtr ptr;
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl get_dtls_fd error"); log(ERROR_LOG, "wolfssl get_dtls_fd error");
@ -1283,6 +1352,23 @@ namespace wolfSSL.CSharp {
} }
} }
/// <summary>
/// Set up TLS version 1.3 method
/// </summary>
/// <returns>pointer to TLSv1.3 method</returns>
public static IntPtr useTLSv1_3_server()
{
try
{
return wolfTLSv1_3_server_method();
}
catch (Exception e)
{
log(ERROR_LOG, "wolfssl error " + e.ToString());
return IntPtr.Zero;
}
}
/// <summary> /// <summary>
/// Use any TLS version /// Use any TLS version
@ -1319,6 +1405,22 @@ namespace wolfSSL.CSharp {
} }
} }
/// <summary>
/// Set up TLS version 1.3 method
/// </summary>
/// <returns>pointer to TLSv1.3 method</returns>
public static IntPtr useTLSv1_3_client()
{
try
{
return wolfTLSv1_3_client_method();
}
catch (Exception e)
{
log(ERROR_LOG, "wolfssl error " + e.ToString());
return IntPtr.Zero;
}
}
/// <summary> /// <summary>
/// Use any TLS version /// Use any TLS version
@ -1389,7 +1491,7 @@ namespace wolfSSL.CSharp {
IntPtr ssl_cipher_ptr; IntPtr ssl_cipher_ptr;
string ssl_cipher_str; string ssl_cipher_str;
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl get_current_cipher error"); log(ERROR_LOG, "wolfssl get_current_cipher error");
@ -1420,7 +1522,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX set cipher list error"); log(ERROR_LOG, "CTX set cipher list error");
@ -1447,7 +1549,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl set_cipher_list error"); log(ERROR_LOG, "wolfssl set_cipher_list error");
@ -1479,7 +1581,7 @@ namespace wolfSSL.CSharp {
IntPtr version_ptr; IntPtr version_ptr;
string version; string version;
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl get_version error"); log(ERROR_LOG, "wolfssl get_version error");
@ -1515,7 +1617,7 @@ namespace wolfSSL.CSharp {
StringBuilder err_name; StringBuilder err_name;
StringBuilder ret; StringBuilder ret;
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl get_error error"); log(ERROR_LOG, "wolfssl get_error error");
@ -1550,7 +1652,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX use certificate file error"); log(ERROR_LOG, "CTX use certificate file error");
@ -1578,7 +1680,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX load verify locations certificate file error"); log(ERROR_LOG, "CTX load verify locations certificate file error");
@ -1605,7 +1707,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX use PrivateKey file error"); log(ERROR_LOG, "CTX use PrivateKey file error");
@ -1633,10 +1735,10 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr sslCtx = unwrap(ssl); IntPtr sslCtx = unwrap_ssl(ssl);
if (sslCtx == IntPtr.Zero) if (sslCtx == IntPtr.Zero)
{ {
log(ERROR_LOG, "wolfssl SetTmpDH_file error"); log(ERROR_LOG, "SetTmpDH_file ssl unwrap error");
return FAILURE; return FAILURE;
} }
@ -1644,7 +1746,34 @@ namespace wolfSSL.CSharp {
} }
catch (Exception e) catch (Exception e)
{ {
log(ERROR_LOG, "wolfssl set tmp dh file error " + e.ToString()); log(ERROR_LOG, "SetTmpDH_file error " + e.ToString());
return FAILURE;
}
}
/// <summary>
/// Set temporary DH parameters
/// </summary>
/// <param name="ctx">Structure to set in</param>
/// <param name="dhparam">file name</param>
/// <param name="file_type">type of file ie PEM</param>
/// <returns>1 on success</returns>
public static int CTX_SetTmpDH_file(IntPtr ctx, StringBuilder dhparam, int file_type)
{
try
{
IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero)
{
log(ERROR_LOG, "CTX_SetTmpDH_file ctx unwrap error");
return FAILURE;
}
return wolfSSL_CTX_SetTmpDH_file(local_ctx, dhparam, file_type);
}
catch (Exception e)
{
log(ERROR_LOG, "CTX_SetTmpDH_file error " + e.ToString());
return FAILURE; return FAILURE;
} }
} }
@ -1660,7 +1789,7 @@ namespace wolfSSL.CSharp {
{ {
try try
{ {
IntPtr local_ctx = unwrap(ctx); IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero) if (local_ctx == IntPtr.Zero)
{ {
log(ERROR_LOG, "CTX SetMinDhKey_Sz error"); log(ERROR_LOG, "CTX SetMinDhKey_Sz error");
@ -1676,6 +1805,60 @@ namespace wolfSSL.CSharp {
} }
} }
/// <summary>
/// Set the certificate verification mode and optional callback function
/// </summary>
/// <param name="ctx">pointer to CTX that the function is set in</param>
/// <param name="mode">See SSL_VERIFY options</param>
/// <param name="vc">Optional verify callback function to use</param>
public static int CTX_set_verify(IntPtr ctx, int mode, CallbackVerify_delegate vc)
{
try
{
IntPtr local_ctx = unwrap_ctx(ctx);
if (local_ctx == IntPtr.Zero)
{
log(ERROR_LOG, "CTX set_verify error");
return FAILURE;
}
wolfSSL_CTX_set_verify(local_ctx, mode, vc);
return SUCCESS;
}
catch (Exception e)
{
log(ERROR_LOG, "wolfssl ctx set verify error " + e.ToString());
return FAILURE;
}
}
/// <summary>
/// Set the certificate verification mode and optional callback function
/// </summary>
/// <param name="ctx">pointer to SSL object that the function is set in</param>
/// <param name="mode">See SSL_VERIFY options</param>
/// <param name="vc">Optional verify callback function to use</param>
public static int set_verify(IntPtr ssl, int mode, CallbackVerify_delegate vc)
{
try
{
IntPtr local_ssl = unwrap_ssl(ssl);
if (local_ssl == IntPtr.Zero)
{
log(ERROR_LOG, "set_verify error");
return FAILURE;
}
wolfSSL_set_verify(local_ssl, mode, vc);
return SUCCESS;
}
catch (Exception e)
{
log(ERROR_LOG, "wolfssl set verify error " + e.ToString());
return FAILURE;
}
}
/// <summary> /// <summary>
/// Set the function to use for logging /// Set the function to use for logging

View File

@ -67,7 +67,8 @@
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>xcopy "$(ProjectDir)..\..\..\certs\server-key.pem" "$(TargetDir)" /Y /R <PreBuildEvent>xcopy "$(ProjectDir)..\..\..\certs\server-key.pem" "$(TargetDir)" /Y /R
xcopy "$(ProjectDir)..\..\..\certs\server-cert.pem" "$(TargetDir)" /Y /R xcopy "$(ProjectDir)..\..\..\certs\server-cert.pem" "$(TargetDir)" /Y /R
xcopy "$(ProjectDir)..\..\..\certs\dh2048.pem" "$(TargetDir)" /Y /R</PreBuildEvent> xcopy "$(ProjectDir)..\..\..\certs\dh2048.pem" "$(TargetDir)" /Y /R
xcopy "$(ProjectDir)..\..\..\certs\ca-cert.pem" "$(TargetDir)" /Y /R</PreBuildEvent>
</PropertyGroup> </PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -4,33 +4,4 @@
include wrapper/python/wolfcrypt/include.am include wrapper/python/wolfcrypt/include.am
include wrapper/python/wolfssl/include.am include wrapper/python/wolfssl/include.am
include wrapper/CSharp/include.am
# wolfSSL CSharp wrapper files
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/Settings.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/Properties/Settings.settings
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/App.config
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.csproj
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp.sln
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/AssemblyInfo.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/Resources.Designer.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/Properties/Resources.resx
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs
EXTRA_DIST+= wrapper/CSharp/wolfSSL_CSharp/wolfSSL_CSharp.csproj