C# Class OathNet.CounterBasedOtpGenerator

Implements the OATH HOTP algorithm.
ファイルを表示 Open project: jennings/OATH.Net Class Usage Examples

Public Methods

Method Description
CounterBasedOtpGenerator ( Key secretKey, int otpLength ) : System

Initializes a new instance of the CounterBasedOtpGenerator class. This is used when the client and server share a counter value.

CounterBasedOtpGenerator ( Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm ) : System

Initializes a new instance of the CounterBasedOtpGenerator class. This is used when the client and server share a counter value.

GenerateOtp ( int counter ) : string

Generates the OTP for the given counter value. The client and server compute this independently and come up with the same result, provided they use the same shared key.

Method Details

CounterBasedOtpGenerator() public method

Initializes a new instance of the CounterBasedOtpGenerator class. This is used when the client and server share a counter value.
public CounterBasedOtpGenerator ( Key secretKey, int otpLength ) : System
secretKey Key The secret key.
otpLength int The number of digits in the OTP to generate.
return System

CounterBasedOtpGenerator() public method

Initializes a new instance of the CounterBasedOtpGenerator class. This is used when the client and server share a counter value.
public CounterBasedOtpGenerator ( Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm ) : System
secretKey Key The secret key.
otpLength int The number of digits in the OTP to generate.
hmacAlgorithm IHMACAlgorithm The hashing algorithm to use.
return System

GenerateOtp() public method

Generates the OTP for the given counter value. The client and server compute this independently and come up with the same result, provided they use the same shared key.
public GenerateOtp ( int counter ) : string
counter int The counter value to use.
return string