Skip to content

Implementation of One Time Password (time and counter based) targeting .NET Standard 1.6.

License

Notifications You must be signed in to change notification settings

Cryptolens/OneTimePassword

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

One Time Password

A .NET core library that implements HOTP based on rfc4226 and TOTP based on rfc6238.

It's compatible with the Google Authenticator App.

Example

First, we need to create a shared secret (stored on the server and by the client)

var secret = OneTimePassword.CreateSharedSecret();

Time-based

For a time-based token, we use:

OneTimePassword.TimeBasedPassword(secret)

Counter-based

For a counter-based token, we use:

OneTimePassword.CounterBasedPassword(secret, 1)

The counter here is 1.

Google Authenticator App

To get a Google Authenticator friendly shared secret:

OneTimePassword.SharedSecretToString(secret);

Referencing from .NET Framework, .NET Core and others

One Time Password targets the .NET Standard 1.6, which should be compatible with .NET Framework 4.6.1 and .NET Core 1.0. For other frameworks, please see this.

It's seems to be important to install NETStandard.Library for everything to work, especially on the .NET Framework.

About

Implementation of One Time Password (time and counter based) targeting .NET Standard 1.6.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages