Skip to content

Commit

Permalink
Upgrade netfx45 to netstandard2 & Fixed DIGEST-MD5 issue
Browse files Browse the repository at this point in the history
1. Support netcore (Upgrade netfx45 to netstandard2)
2. Removed System.Configuration dependency (Netfx legacy)
3. Removed RIPEMD-160 algorithm (Not supported in netcore)
4. Fixed DIGEST-MD5 issue (Please refer to smiley22#3)
5. Excluded /Tests folder from project (For building only)
  • Loading branch information
kaleyroy committed May 8, 2020
1 parent e8ec2d6 commit 89f6286
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 104 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,6 @@ pip-log.txt

# Mac crap
.DS_Store
*.old
/.vs/S22.Sasl/v16/Server/sqlite3
/.vs/S22.Sasl/DesignTimeBuild
2 changes: 1 addition & 1 deletion Mechanisms/SaslSrp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private Tuple<string, Type> SelectHashAlgorithm(string list) {
{ "SHA-256", typeof(SHA256Managed) },
{ "SHA-384", typeof(SHA384Managed) },
{ "SHA-512", typeof(SHA512Managed) },
{ "RIPEMD-160", typeof(RIPEMD160Managed) },
//{ "RIPEMD-160", typeof(RIPEMD160Managed) },
{ "MD5", typeof(MD5CryptoServiceProvider) }
};
foreach (KeyValuePair<string, Type> p in l) {
Expand Down
107 changes: 12 additions & 95 deletions S22.Sasl.csproj
Original file line number Diff line number Diff line change
@@ -1,106 +1,23 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B860646A-13A2-47D9-9790-4719A91BF35B}</ProjectGuid>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>S22.Sasl</RootNamespace>
<AssemblyName>S22.Sasl</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\S22.Sasl.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions.cs" />
<Compile Include="Mechanisms\ByteBuilder.cs" />
<Compile Include="Mechanisms\Ntlm\Extensions.cs" />
<Compile Include="Mechanisms\Ntlm\Flags.cs" />
<Compile Include="Mechanisms\Ntlm\Helpers.cs" />
<Compile Include="Mechanisms\Ntlm\MD4.cs" />
<Compile Include="Mechanisms\Ntlm\MessageType.cs" />
<Compile Include="Mechanisms\Ntlm\OSVersion.cs" />
<Compile Include="Mechanisms\Ntlm\Responses.cs" />
<Compile Include="Mechanisms\Ntlm\SecurityBuffer.cs" />
<Compile Include="Mechanisms\Ntlm\Type1Message.cs" />
<Compile Include="Mechanisms\Ntlm\Type2Message.cs" />
<Compile Include="Mechanisms\Ntlm\Type3Message.cs" />
<Compile Include="Mechanisms\SaslCramMd5.cs" />
<Compile Include="Mechanisms\SaslDigestMd5.cs" />
<Compile Include="Mechanisms\SaslNtlm.cs" />
<Compile Include="Mechanisms\SaslNtlmv2.cs" />
<Compile Include="Mechanisms\SaslOAuth.cs" />
<Compile Include="Mechanisms\SaslOAuth2.cs" />
<Compile Include="Mechanisms\SaslPlain.cs" />
<Compile Include="Mechanisms\SaslScramSha1.cs" />
<Compile Include="Mechanisms\SaslSrp.cs" />
<Compile Include="Mechanisms\Srp\ClientMessage1.cs" />
<Compile Include="Mechanisms\Srp\ClientMessage2.cs" />
<Compile Include="Mechanisms\Srp\Extensions.cs" />
<Compile Include="Mechanisms\Srp\Helper.cs" />
<Compile Include="Mechanisms\Srp\Mpi.cs" />
<Compile Include="Mechanisms\Srp\OctetSequence.cs" />
<Compile Include="Mechanisms\Srp\ServerMessage1.cs" />
<Compile Include="Mechanisms\Srp\ServerMessage2.cs" />
<Compile Include="Mechanisms\Srp\Utf8String.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SaslConfiguration.cs" />
<Compile Include="SaslException.cs" />
<Compile Include="SaslFactory.cs" />
<Compile Include="SaslMechanism.cs" />
<Compile Include="Tests\CramMd5Test.cs" />
<Compile Include="Tests\DigestMd5Test.cs" />
<Compile Include="Tests\NtlmTest.cs" />
<Compile Include="Tests\OAuth2Test.cs" />
<Compile Include="Tests\PlainTest.cs" />
<Compile Include="Tests\ScramSha1Test.cs" />
<Compile Include="Tests\SrpTest.cs" />
<Compile Remove="SaslConfiguration.cs" />
<Compile Remove="Tests\CramMd5Test.cs" />
<Compile Remove="Tests\DigestMd5Test.cs" />
<Compile Remove="Tests\NtlmTest.cs" />
<Compile Remove="Tests\OAuth2Test.cs" />
<Compile Remove="Tests\PlainTest.cs" />
<Compile Remove="Tests\ScramSha1Test.cs" />
<Compile Remove="Tests\SrpTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="License.md" />
<None Include="Readme.md" />
<Folder Include="Tests\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
16 changes: 8 additions & 8 deletions SaslFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Configuration;
//using System.Configuration;

namespace S22.Sasl {
/// <summary>
Expand Down Expand Up @@ -90,13 +90,13 @@ static SaslFactory() {
{ "Srp", typeof(Mechanisms.SaslSrp) }
};
// Register any custom mechanisms configured in the app.config.
var configSection = ConfigurationManager.GetSection("saslConfigSection")
as SaslConfigurationSection;
if (configSection != null) {
foreach(SaslProvider provider in configSection.SaslProviders) {
mechanisms.Add(provider.Name, Type.GetType(provider.Type));
}
}
//var configSection = ConfigurationManager.GetSection("saslConfigSection")
// as SaslConfigurationSection;
//if (configSection != null) {
// foreach(SaslProvider provider in configSection.SaslProviders) {
// mechanisms.Add(provider.Name, Type.GetType(provider.Type));
// }
//}
}
}
}

0 comments on commit 89f6286

Please # to comment.