-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSharp Wrapper for wolfCrypt. Adds RNG and ECC template.
- Loading branch information
Showing
9 changed files
with
826 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("wolfCrypt-Test")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("wolfSSL")] | ||
[assembly: AssemblyProduct("wolfCrypt-Test")] | ||
[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("a4f4a244-1306-47f4-a168-31f78d7362fa")] | ||
|
||
// 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.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* wolfCrypt-Test.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 | ||
*/ | ||
|
||
/* Tests for the wolfCrypt C# wrapper */ | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.IO; | ||
using wolfSSL.CSharp; | ||
|
||
public class wolfCrypt_Test_CSharp | ||
{ | ||
private static void random_test() | ||
{ | ||
int ret, i, zeroCount = 0; | ||
Byte[] data = new Byte[128]; | ||
|
||
/* Random Test */ | ||
ret = wolfcrypt.Random(data, data.Length); | ||
if (ret == 0) { | ||
/* Check for 0's */ | ||
for (i=0; i<(int)data.Length; i++) { | ||
if (data[i] == 0) { | ||
zeroCount++; | ||
} | ||
} | ||
if (zeroCount == data.Length) { | ||
Console.WriteLine("RNG zero check error"); | ||
} | ||
else { | ||
Console.WriteLine("RNG Test Passed\n"); | ||
} | ||
} | ||
else { | ||
Console.WriteLine("RNG Error" + wolfcrypt.GetError(ret)); | ||
} | ||
} | ||
|
||
private static void ecc_test() | ||
{ | ||
|
||
} | ||
|
||
public static void Main(string[] args) | ||
{ | ||
wolfcrypt.Init(); | ||
|
||
random_test(); | ||
ecc_test(); | ||
|
||
wolfcrypt.Cleanup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?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>{A4F4A244-1306-47F4-A168-31F78D7362FA}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>wolfCrypt_Test</RootNamespace> | ||
<AssemblyName>wolfCrypt-Test</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="wolfCrypt-test.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</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> |
Oops, something went wrong.