diff --git a/source/Zyan.Communication/Security/SecureRemotePassword/SrpAuthenticationProvider.cs b/source/Zyan.Communication/Security/SecureRemotePassword/SrpAuthenticationProvider.cs index e9882f91..97f65701 100644 --- a/source/Zyan.Communication/Security/SecureRemotePassword/SrpAuthenticationProvider.cs +++ b/source/Zyan.Communication/Security/SecureRemotePassword/SrpAuthenticationProvider.cs @@ -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); } diff --git a/source/Zyan.Communication/Zyan.Communication.Android.csproj b/source/Zyan.Communication/Zyan.Communication.Android.csproj index ae5a98ce..17591015 100644 --- a/source/Zyan.Communication/Zyan.Communication.Android.csproj +++ b/source/Zyan.Communication/Zyan.Communication.Android.csproj @@ -55,7 +55,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.3.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Communication/Zyan.Communication.Fx3.csproj b/source/Zyan.Communication/Zyan.Communication.Fx3.csproj index e09b4819..c96c3135 100644 --- a/source/Zyan.Communication/Zyan.Communication.Fx3.csproj +++ b/source/Zyan.Communication/Zyan.Communication.Fx3.csproj @@ -70,7 +70,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net35\srp.dll + ..\packages\srp.1.0.1\lib\net35\srp.dll True diff --git a/source/Zyan.Communication/Zyan.Communication.Fx4.csproj b/source/Zyan.Communication/Zyan.Communication.Fx4.csproj index 3c389ddc..239fcc8e 100644 --- a/source/Zyan.Communication/Zyan.Communication.Fx4.csproj +++ b/source/Zyan.Communication/Zyan.Communication.Fx4.csproj @@ -58,7 +58,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net40\srp.dll + ..\packages\srp.1.0.1\lib\net40\srp.dll True diff --git a/source/Zyan.Communication/Zyan.Communication.Fx45.csproj b/source/Zyan.Communication/Zyan.Communication.Fx45.csproj index 9828d71d..9c5698c4 100644 --- a/source/Zyan.Communication/Zyan.Communication.Fx45.csproj +++ b/source/Zyan.Communication/Zyan.Communication.Fx45.csproj @@ -58,6 +58,7 @@ true + @@ -78,8 +79,7 @@ True - ..\packages\srp.1.0.0\lib\net45\srp.dll - True + ..\packages\srp.1.0.1\lib\net45\srp.dll diff --git a/source/Zyan.Communication/Zyan.Communication.Mono.csproj b/source/Zyan.Communication/Zyan.Communication.Mono.csproj index 657815b5..f33e61b0 100644 --- a/source/Zyan.Communication/Zyan.Communication.Mono.csproj +++ b/source/Zyan.Communication/Zyan.Communication.Mono.csproj @@ -75,7 +75,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Communication/Zyan.Communication.csproj b/source/Zyan.Communication/Zyan.Communication.csproj index ea7f49a3..1222ac65 100644 --- a/source/Zyan.Communication/Zyan.Communication.csproj +++ b/source/Zyan.Communication/Zyan.Communication.csproj @@ -76,7 +76,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Communication/packages.config b/source/Zyan.Communication/packages.config index dded7d48..45958591 100644 --- a/source/Zyan.Communication/packages.config +++ b/source/Zyan.Communication/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/source/Zyan.Tests/SecureRemotePasswordTests.cs b/source/Zyan.Tests/SecureRemotePasswordTests.cs index 4e37a4c7..a31dc177 100644 --- a/source/Zyan.Tests/SecureRemotePasswordTests.cs +++ b/source/Zyan.Tests/SecureRemotePasswordTests.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Security.Cryptography; using SecureRemotePassword; +using H = SecureRemotePassword.SrpParameters.SrpHashFunction; namespace Zyan.Tests { @@ -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); @@ -247,21 +248,21 @@ public void SrpHashComputesValidStringHashes() var sample = string.Concat(parts); var srpint = SrpInteger.FromHex(sample); - var md5 = new SrpHash().HashFunction; + H md5 = new SrpHash().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().HashSizeBytes); - var sha256 = new SrpHash().HashFunction; + H sha256 = new SrpHash().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().HashSizeBytes); - var sha512 = new SrpHash().HashFunction; + H sha512 = new SrpHash().ComputeHash; var hash512 = SrpInteger.FromHex("f2406fd4b33b15a6b47ff78ccac7cd80eec7944092425b640d740e7dc695fdd42f583a9b4a4b98ffa5409680181999bfe319f2a3b50ddb111e8405019a8c552a"); Assert.AreEqual(hash512, sha512(srpint.ToHex().ToUpper())); Assert.AreEqual(hash512, sha512(sample)); @@ -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().HashFunction; + H md5 = new SrpHash().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().HashSizeBytes); - var sha256 = new SrpHash().HashFunction; + H sha256 = new SrpHash().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().HashSizeBytes); - var sha512 = new SrpHash().HashFunction; + H sha512 = new SrpHash().ComputeHash; var hash512 = SrpInteger.FromHex("F6CDE2A0F819314CDDE55FC227D8D7DAE3D28CC556222A0A8AD66D91CCAD4AAD6094F517A2182360C9AACF6A3DC323162CB6FD8CDFFEDB0FE038F55E85FFB5B6"); Assert.AreEqual(hash512, sha512(srpint)); Assert.AreEqual(hash512, sha512(sample)); @@ -313,7 +314,7 @@ public void SrpClientDerivesThePrivateKeyAndVerifier() // validate intermediate steps var userName = "hacker@example.com"; var password = "secret"; - var H = new SrpHash().HashFunction; + H H = new SrpHash().ComputeHash; var step1 = H($"{userName}:{password}"); Assert.AreEqual(SrpInteger.FromHex("ed3250071433e544b62b5dd0341564825a697357b5379f07aabca795a4e0a109"), step1); @@ -502,8 +503,8 @@ 7BCF1885 C529F566 660E57EC 68EDBC3C 05726CC0 2FD4CBF4 976EAA9A FD5138FE 8376435B 9FC61D2F C0EB06E3"); var g = SrpInteger.FromHex("02"); var p = SrpParameters.Create(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); diff --git a/source/Zyan.Tests/Zyan.Tests.Fx3.csproj b/source/Zyan.Tests/Zyan.Tests.Fx3.csproj index 275a9c60..385adbb2 100644 --- a/source/Zyan.Tests/Zyan.Tests.Fx3.csproj +++ b/source/Zyan.Tests/Zyan.Tests.Fx3.csproj @@ -65,8 +65,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net35\srp.dll - True + ..\packages\srp.1.0.1\lib\net35\srp.dll @@ -113,6 +112,7 @@ Always + diff --git a/source/Zyan.Tests/Zyan.Tests.Mono.csproj b/source/Zyan.Tests/Zyan.Tests.Mono.csproj index e51972ef..7ac0cb78 100644 --- a/source/Zyan.Tests/Zyan.Tests.Mono.csproj +++ b/source/Zyan.Tests/Zyan.Tests.Mono.csproj @@ -53,7 +53,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Tests/Zyan.Tests.NUnit.csproj b/source/Zyan.Tests/Zyan.Tests.NUnit.csproj index 67ae3b21..c9905ba1 100644 --- a/source/Zyan.Tests/Zyan.Tests.NUnit.csproj +++ b/source/Zyan.Tests/Zyan.Tests.NUnit.csproj @@ -59,7 +59,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net45\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Tests/Zyan.Tests.csproj b/source/Zyan.Tests/Zyan.Tests.csproj index 2296784b..68ef1cd6 100644 --- a/source/Zyan.Tests/Zyan.Tests.csproj +++ b/source/Zyan.Tests/Zyan.Tests.csproj @@ -69,7 +69,7 @@ ..\packages\Zyan.SafeDeserializationHelpers.0.5.0\lib\net35\Zyan.SafeDeserializationHelpers.dll - ..\packages\srp.1.0.0\lib\net45\srp.dll + ..\packages\srp.1.0.1\lib\net45\srp.dll True diff --git a/source/Zyan.Tests/packages.config b/source/Zyan.Tests/packages.config index dded7d48..45958591 100644 --- a/source/Zyan.Tests/packages.config +++ b/source/Zyan.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file