Class TimeBasedPasswordGenerator
Used to generate passwords based on a specific time, using the
Inherited Members
Namespace: Yort.Otp
Assembly: cs.temp.dll.dll
Syntax
public sealed class TimeBasedPasswordGenerator : OnetimePasswordGeneratorBase, IOnetimePasswordGenerator, IDisposable
Remarks
Default values are SHA1, a 30 second time interval and a password length of 6. The current time from the device's clock is used (dynamically) to create the password, so the GeneratedPassword property will change over time.
//Configures a password generator using a base 32 secret (as typically provided by Google).
var passwordGenerator = new TimeBasedPassword();
passwordGenerator.SetSecret(TimeBasedPassword.SecretFromBase32String("JBSWY3DPEHPK3PXP"));
var password = passwordGenerator.GeneratedPassword;
Constructors
| Name | Description |
|---|---|
| TimeBasedPasswordGenerator() | Default constructor |
| TimeBasedPasswordGenerator() | Default constructor |
| TimeBasedPasswordGenerator(Boolean) | Partial constructor. |
| TimeBasedPasswordGenerator(Boolean) | Partial constructor. |
| TimeBasedPasswordGenerator(Boolean, Byte[]) | Full constructor, initialises this instance with an already known secret. |
| TimeBasedPasswordGenerator(Boolean, Byte[]) | Full constructor, initialises this instance with an already known secret. |
Properties
| Name | Description |
|---|---|
| MovingFactor | Uses the Timestamp or current clock time and TimeInterval to generate the counter/moving factor for password generation. |
| MovingFactor | Uses the Timestamp or current clock time and TimeInterval to generate the counter/moving factor for password generation. |
| TimeInterval | Sets or returns the amount of time each generated password is valid for. The default is 30 seconds. |
| TimeInterval | Sets or returns the amount of time each generated password is valid for. The default is 30 seconds. |
| Timestamp | Sets or returns the date and time to calculate a password for. If null, the current date and time from the device/OS clock is used. |
| Timestamp | Sets or returns the date and time to calculate a password for. If null, the current date and time from the device/OS clock is used. |
| ValidUntilUtc | Sets or returns the last second at which the value of GeneratedPassword is valid until. |
| ValidUntilUtc | Sets or returns the last second at which the value of GeneratedPassword is valid until. |