Skip to content

Some Oath/OpenAuTHentication implementations like HOTP, TOTP & OCRA

License

Notifications You must be signed in to change notification settings

LsquaredTechnologies/Oath

Repository files navigation

Oath / OpenAuTHentication

License: MIT Azure build status Travis build status Coverage Status NuGet version

Documentation

HOTP

RFC-4226

var options = new OtpGeneratorOptions
{
    AlgorithmName = "HMACSHA1",  // default value
    CodeLength = 6
};
var hotpGenerator = new HotpGenerator(options);
var code = hotpGenerator.Generate(Secret, counter);

TOTP

RFC-6238

var options = new TotpGeneratorOptions
{
    AlgorithmName = "HMACSHA256",
    CodeLength = 8,  // default value
    TimeStep = TimeSpan.FromSeconds(30), // default value
    // can also specify a time provider
    // TimeProvider = new DefaultTimeProvider()
};
var totpGenerator = new TotpGenerator(options);
var code = hotpGenerator.Generate(Secret);

Oath Challenge-Response (OCRA)

RFC-6287

var question = int.Parse("75423695").ToString("X");
var ocraGenerator = OcraGenerator.Create("OCRA-1:HOTP-SHA1-6:QN08");
var code = ocraGenerator.Generate(Secret, question);
var counter = "123";
var question = int.Parse("75423695").ToString("X");
var password = Hash("1234");
var ocraGenerator = OcraGenerator.Create("OCRA-1:HOTP-SHA256-8:C-QN08-PSHA1");
var code = ocraGenerator.Generate(Secret, counter, question, password);

About

Some Oath/OpenAuTHentication implementations like HOTP, TOTP & OCRA

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages