Skip to content

Commit

Permalink
Updated SRP Nuget package reference to v1.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
yallie committed Jun 25, 2018
1 parent a314ba5 commit e7bdc14
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private AuthResponseMessage AuthStep1(AuthRequestMessage authRequest)
}

// generate fake salt and B values so that attacker cannot tell whether the given user exists or not
var fakeSalt = SrpParameters.H(userName + UnknownUserSalt).ToHex();
var fakeSalt = SrpParameters.Hash(userName + UnknownUserSalt).ToHex();
var fakeEphemeral = SrpServer.GenerateEphemeral(fakeSalt);
return ResponseStep1(fakeSalt, fakeEphemeral.Public);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.3.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Communication/Zyan.Communication.Fx3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net35\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net35\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Communication/Zyan.Communication.Fx4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net40\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net40\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions source/Zyan.Communication/Zyan.Communication.Fx45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.configuration" />
Expand All @@ -78,8 +79,7 @@
<Private>True</Private>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Communication/Zyan.Communication.Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Communication/Zyan.Communication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Communication/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="srp" version="1.0.0" targetFramework="net46" />
<package id="srp" version="1.0.1" targetFramework="net46" />
<package id="Zyan.SafeDeserializationHelpers" version="0.5.0" targetFramework="net35" />
</packages>
23 changes: 12 additions & 11 deletions source/Zyan.Tests/SecureRemotePasswordTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Security.Cryptography;
using SecureRemotePassword;
using H = SecureRemotePassword.SrpParameters.SrpHashFunction;

namespace Zyan.Tests
{
Expand Down Expand Up @@ -169,8 +170,8 @@ public void SrpIntegetModPowCompatibleWithJsbn()
public void SrpIntegerModPowRegressionTest()
{
var p = new SrpParameters();
var g = p.G;
var N = p.N;
var g = p.Generator;
var N = p.Prime;

var a = SrpInteger.FromHex("64e1124e73967bb4806cf5e3f151c574d0012147255e10fca02e9b4bafc8f4ba");
var A = g.ModPow(a, N);
Expand Down Expand Up @@ -247,21 +248,21 @@ public void SrpHashComputesValidStringHashes()
var sample = string.Concat(parts);
var srpint = SrpInteger.FromHex(sample);

var md5 = new SrpHash<MD5>().HashFunction;
H md5 = new SrpHash<MD5>().ComputeHash;
var hashmd5 = SrpInteger.FromHex("34ada39bbabfa6e663f1aad3d7814121");
Assert.AreEqual(hashmd5, md5(srpint.ToHex().ToUpper()));
Assert.AreEqual(hashmd5, md5(sample));
Assert.AreEqual(hashmd5, md5(parts));
Assert.AreEqual(16, new SrpHash<MD5>().HashSizeBytes);

var sha256 = new SrpHash<SHA256>().HashFunction;
H sha256 = new SrpHash<SHA256>().ComputeHash;
var hash256 = SrpInteger.FromHex("1767fe8c94508ad3514b8332493fab5396757fe347023fc9d1fef6d26c3a70d3");
Assert.AreEqual(hash256, sha256(srpint.ToHex().ToUpper()));
Assert.AreEqual(hash256, sha256(sample));
Assert.AreEqual(hash256, sha256(parts));
Assert.AreEqual(256 / 8, new SrpHash<SHA256>().HashSizeBytes);

var sha512 = new SrpHash<SHA512>().HashFunction;
H sha512 = new SrpHash<SHA512>().ComputeHash;
var hash512 = SrpInteger.FromHex("f2406fd4b33b15a6b47ff78ccac7cd80eec7944092425b640d740e7dc695fdd42f583a9b4a4b98ffa5409680181999bfe319f2a3b50ddb111e8405019a8c552a");
Assert.AreEqual(hash512, sha512(srpint.ToHex().ToUpper()));
Assert.AreEqual(hash512, sha512(sample));
Expand All @@ -276,21 +277,21 @@ public void SrpHashComputesValidSrpIntegerHashes()
var sample = string.Concat(parts);
var srpint = SrpInteger.FromHex("48 65 6C 6C 6F 20 77 6F 72 6c 64 21");

var md5 = new SrpHash<MD5>().HashFunction;
H md5 = new SrpHash<MD5>().ComputeHash;
var hashmd5 = SrpInteger.FromHex("86FB269D190D2C85F6E0468CECA42A20");
Assert.AreEqual(hashmd5, md5(srpint));
Assert.AreEqual(hashmd5, md5(sample));
Assert.AreEqual(hashmd5, md5(parts));
Assert.AreEqual(16, new SrpHash<MD5>().HashSizeBytes);

var sha256 = new SrpHash<SHA256>().HashFunction;
H sha256 = new SrpHash<SHA256>().ComputeHash;
var hash256 = SrpInteger.FromHex("C0535E4BE2B79FFD93291305436BF889314E4A3FAEC05ECFFCBB7DF31AD9E51A");
Assert.AreEqual(hash256, sha256(srpint));
Assert.AreEqual(hash256, sha256(sample));
Assert.AreEqual(hash256, sha256(parts));
Assert.AreEqual(256 / 8, new SrpHash<SHA256>().HashSizeBytes);

var sha512 = new SrpHash<SHA512>().HashFunction;
H sha512 = new SrpHash<SHA512>().ComputeHash;
var hash512 = SrpInteger.FromHex("F6CDE2A0F819314CDDE55FC227D8D7DAE3D28CC556222A0A8AD66D91CCAD4AAD6094F517A2182360C9AACF6A3DC323162CB6FD8CDFFEDB0FE038F55E85FFB5B6");
Assert.AreEqual(hash512, sha512(srpint));
Assert.AreEqual(hash512, sha512(sample));
Expand All @@ -313,7 +314,7 @@ public void SrpClientDerivesThePrivateKeyAndVerifier()
// validate intermediate steps
var userName = "[email protected]";
var password = "secret";
var H = new SrpHash<SHA256>().HashFunction;
H H = new SrpHash<SHA256>().ComputeHash;
var step1 = H($"{userName}:{password}");
Assert.AreEqual(SrpInteger.FromHex("ed3250071433e544b62b5dd0341564825a697357b5379f07aabca795a4e0a109"), step1);

Expand Down Expand Up @@ -502,8 +503,8 @@ 7BCF1885 C529F566 660E57EC 68EDBC3C 05726CC0 2FD4CBF4 976EAA9A
FD5138FE 8376435B 9FC61D2F C0EB06E3");
var g = SrpInteger.FromHex("02");
var p = SrpParameters.Create<SHA1>(N, g);
var H = p.H;
var k = p.K;
var H = p.Hash;
var k = p.Multiplier;
var kx = SrpInteger.FromHex(@"7556AA04 5AEF2CDD 07ABAF0F 665C3E81 8913186F");
Assert.AreEqual(kx, k);

Expand Down
4 changes: 2 additions & 2 deletions source/Zyan.Tests/Zyan.Tests.Fx3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net35\srp.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\srp.1.0.1\lib\net35\srp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -113,6 +112,7 @@
<None Include="DistributedEvents.GenericTest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Zyan.Communication\Zyan.Communication.Fx3.csproj">
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Tests/Zyan.Tests.Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Tests/Zyan.Tests.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net45\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Tests/Zyan.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<HintPath>..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll</HintPath>
</Reference>
<Reference Include="srp">
<HintPath>..\packages\srp.1.0.0\lib\net45\srp.dll</HintPath>
<HintPath>..\packages\srp.1.0.1\lib\net45\srp.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Zyan.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="srp" version="1.0.0" targetFramework="net46" />
<package id="srp" version="1.0.1" targetFramework="net46" />
<package id="Zyan.SafeDeserializationHelpers" version="0.5.0" targetFramework="net35" />
</packages>

0 comments on commit e7bdc14

Please sign in to comment.