jennings / OATH.Net

A small library that implements the HOTP and TOTP algorithms for two-factor authentication. Compatible with the Google Authenticator app for iPhone and Android.
https://www.nuget.org/packages/OATH.Net/
28 stars 14 forks source link

Support for Step counts in greater than 4 bytes (HOTP) and support for custom time interval (TOTP) #7

Closed carlos-sarmiento closed 10 years ago

carlos-sarmiento commented 10 years ago

Made some very small changes to the code in order to support step counts greater than 4 bytes (aka in the range of 'long' instead of 'int') and added a constructor for using a custom time interval for clients that don't use 30 seconds as their password window.

Just as a warning, in order to get the code to compile quickly on my machine I changed the project files to remove the dependencies on semver and other things. Sorry for that :S

jennings commented 10 years ago

Thanks!

It's a good change, but I'm wary of merging it in without tests. Do you have some known-good values for time intervals that are not 30 seconds that you can add tests for? The tests in the project now are from the OATH specifications.

Also, it's good form to only make one logical change during a commit. Can you clean up commit f890f98 so it doesn't change the project file at all? There's no reason to commit that while adding configurable time intervals.

carlos-sarmiento commented 10 years ago

I do have some values which I used for testing, but they are from a hardware token (that uses 60 seconds as the time window). The issue is that I cannot include the key for the token in a public repository. Nevertheless, the change is only in the division for the number of steps (instead of dividing by 30, we divide by timeInterval) and adding a new parameter in the constructors (while keeping the default at 30).

I will look for a public source and generate some tokens from there and sorry for the messup with the commit. As soon as I fix the test I'll fix that and resubmit the pull request

jennings commented 10 years ago

No worries. Yours is a smart change, I'm sure it will be useful to others. And, your contribution nudged me to put this on the NuGet Gallery, so your work will be even easier for others to find.