summaryrefslogtreecommitdiffstats
path: root/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
diff options
context:
space:
mode:
authorChristoph Enzmann <christoph.enzmann@confer.ch>2013-12-05 17:47:33 +0100
committerChristoph Enzmann <christoph.enzmann@confer.ch>2013-12-05 17:47:33 +0100
commit3e3f949d007812349c623da09f539ab465d46b50 (patch)
tree99563a436dc76c982acc0cf13fa027a08a5a7f5a /TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
parent9b8c9cc8bafa315516b6ac704859c6d13ce1b768 (diff)
downloadTwoStepsAuthenticator-3e3f949d007812349c623da09f539ab465d46b50.zip
TwoStepsAuthenticator-3e3f949d007812349c623da09f539ab465d46b50.tar.gz
TwoStepsAuthenticator-3e3f949d007812349c623da09f539ab465d46b50.tar.bz2
Methods for synchronization
Diffstat (limited to 'TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs')
-rw-r--r--TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs b/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
index 4738ba1..ecb96c0 100644
--- a/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
+++ b/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
@@ -38,5 +38,17 @@ namespace TwoStepsAuthenticator.UnitTests {
}
+ [Test]
+ public void VerifyUsedCounter() {
+ var authenticator = new CounterAuthenticator();
+
+ // Test Values from http://www.ietf.org/rfc/rfc4226.txt - Appendix D
+ var base32Secret = Base32Encoding.ToString(Encoding.ASCII.GetBytes("12345678901234567890"));
+
+ long usedCounter;
+ Assert.True(authenticator.CheckCode(base32Secret, "520489", 0L, out usedCounter));
+
+ Assert.AreEqual(usedCounter, 9L);
+ }
}
}