Example #1
0
 /// <summary>
 ///     Initializes a new instance of the TimeBasedOtpGenerator class. This
 ///     is used when the client and server do not share a counter
 ///     value but the clocks between the two are synchronized within
 ///     reasonable margins of each other.
 /// </summary>
 /// <param name="secretKey">The secret key.</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The HMAC algorithm to use.</param>
 public TimeBasedOtpGenerator(Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     this.counterOtp = new CounterBasedOtpGenerator(secretKey, otpLength, hmacAlgorithm);
 }
 /// <summary>
 ///     Initializes a new instance of the CounterBasedOtpGenerator class.
 /// </summary>
 /// <param name="username">Usually a cryptographically secure key, I've altered the algorithm to take a username to fit the specs</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The hashing algorithm to use.</param>
 public OathTimeOtpGenerator(byte[] username, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     _otpGenerator = new OathOtpGenerator(username, otpLength, hmacAlgorithm);
 }
 /// <summary>
 ///     Initializes a new instance of the TimeBasedOtpGenerator class. This
 ///     is used when the client and server do not share a counter
 ///     value but the clocks between the two are synchronized within
 ///     reasonable margins of each other.
 /// </summary>
 /// <param name="secretKey">The secret key.</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The HMAC algorithm to use.</param>
 public TimeBasedOtpGenerator(Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     this.counterOtp = new CounterBasedOtpGenerator(secretKey, otpLength, hmacAlgorithm);
 }
 /// <summary>
 ///     Initializes a new instance of the CounterBasedOtpGenerator class.
 ///     This is used when the client and server share a counter value.
 /// </summary>
 /// <param name="secretKey">The secret key.</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The hashing algorithm to use.</param>
 public CounterBasedOtpGenerator(Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     this.secretKey = secretKey;
     this.otpLength = otpLength;
     this.hmacAlgorithm = hmacAlgorithm;
 }
 /// <summary>
 ///     Initializes a new instance of the CounterBasedOtpGenerator class.
 ///     This is used when the client and server share a counter value.
 /// </summary>
 /// <param name="secretKey">The secret key.</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The hashing algorithm to use.</param>
 public CounterBasedOtpGenerator(Key secretKey, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     this.secretKey = secretKey;
     this.otpLength = otpLength;
     this.hmacAlgorithm = hmacAlgorithm;
 }