Method | Description | |
---|---|---|
CreateSecret ( ) : string |
Creates a 80 bit secret key to be shared with the user on wich the future valid TOTP codes will be based. The CryptoSecureRequirement is
|
|
CreateSecret ( int bits ) : string |
Creates a secret key with the specified number of bits of entropy to be shared with the user on wich the future valid TOTP codes will be based. The CryptoSecureRequirement is
|
|
CreateSecret ( int bits, CryptoSecureRequirement cryptoSecureRequirement ) : string |
Creates a secret key with the specified number of bits of entropy and specified CryptoSecureRequirement to be shared with the user on wich the future valid TOTP codes will be based.
|
|
GetCode ( string secret ) : string |
Gets a TOTP code based on the specified secret for the current time.
|
|
GetCode ( string secret, System.DateTime dateTime ) : string |
Gets a TOTP code based on the specified secret for the specified DateTime.
|
|
GetCode ( string secret, long timestamp ) : string |
Gets a TOTP code based on the specified secret for the specified timestamp.
|
|
GetQrCodeImageAsDataUri ( string label, string secret ) : string |
Retrieves / generates a QR code to be displayed to the user for sharing the shared secret and easy input of this code by scanning with a default size (DEFAULTQRCODESIZE).
|
|
GetQrCodeImageAsDataUri ( string label, string secret, int size ) : string |
Retrieves / generates a QR code to be displayed to the user for sharing the shared secret and easy input of this code by scanning with a specified size.
|
|
TwoFactorAuth ( ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, Algorithm algorithm ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, Algorithm algorithm, IQrCodeProvider qrcodeprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, Algorithm algorithm, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, Algorithm algorithm, IRngProvider rngprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, IQrCodeProvider qrcodeprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, IRngProvider rngprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, int digits ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, int digits, int period ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm, IQrCodeProvider qrcodeprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System |
Intializes a new instance of the TwoFactorAuth class.
|
|
VerifyCode ( string secret, string code ) : bool |
Verifies a TOTP code with the shared secret for the current time and with a DEFAULTDISCREPANCY.
|
|
VerifyCode ( string secret, string code, int discrepancy ) : bool |
Verifies a TOTP code with the shared secret for the current time and with a specified discrepancy.
|
|
VerifyCode ( string secret, string code, int discrepancy, System.DateTime dateTime ) : bool |
Verifies a TOTP code with the shared secret for the specified DateTime and with a specified discrepancy.
|
|
VerifyCode ( string secret, string code, int discrepancy, long timestamp ) : bool |
Verifies a TOTP code with the shared secret for the specified timestamp and with a specified discrepancy.
|
Method | Description | |
---|---|---|
CodeEquals ( string safe, string user ) : bool |
Provides a timing-attack safe method of comparing 2 strings.
|
|
DateTimeToTimestamp ( System.DateTime value ) : long |
Converts a DateTime to timestamp (based on UNIX EPOCH, see EPOCH).
|
|
GetQrText ( string label, string secret ) : string |
Generates a TOTP Uri with specified label and secret.
|
|
GetTimeSlice ( long timestamp, int offset ) : long |
Calculates the timeslice (e.g. number of periods since EPOCH) for a given timestamp and offset (specified in number of periods).
|
public CreateSecret ( int bits ) : string | ||
bits | int | The number of bits of entropy to use. |
return | string |
public CreateSecret ( int bits, CryptoSecureRequirement cryptoSecureRequirement ) : string | ||
bits | int | The number of bits of entropy to use. |
cryptoSecureRequirement | CryptoSecureRequirement | The |
return | string |
public GetCode ( string secret ) : string | ||
secret | string | The shared secret. |
return | string |
public GetCode ( string secret, System.DateTime dateTime ) : string | ||
secret | string | The shared secret. |
dateTime | System.DateTime | The |
return | string |
public GetCode ( string secret, long timestamp ) : string | ||
secret | string | The shared secret. |
timestamp | long | The timestamp for the TOTP code. |
return | string |
public GetQrCodeImageAsDataUri ( string label, string secret ) : string | ||
label | string | The label to identify which account a key is associated with. |
secret | string | The shared secret. |
return | string |
public GetQrCodeImageAsDataUri ( string label, string secret, int size ) : string | ||
label | string | The label to identify which account a key is associated with. |
secret | string | The shared secret. |
size | int | The desired size, in pixels (width and height equal), of the QR code. |
return | string |
public TwoFactorAuth ( string issuer ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
return | System |
public TwoFactorAuth ( string issuer, Algorithm algorithm ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
return | System |
public TwoFactorAuth ( string issuer, Algorithm algorithm, IQrCodeProvider qrcodeprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
qrcodeprovider | IQrCodeProvider | The |
return | System |
public TwoFactorAuth ( string issuer, Algorithm algorithm, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
qrcodeprovider | IQrCodeProvider | The |
rngprovider | IRngProvider | The |
return | System |
public TwoFactorAuth ( string issuer, Algorithm algorithm, IRngProvider rngprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
rngprovider | IRngProvider | The |
return | System |
public TwoFactorAuth ( string issuer, IQrCodeProvider qrcodeprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
qrcodeprovider | IQrCodeProvider | The |
return | System |
public TwoFactorAuth ( string issuer, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
qrcodeprovider | IQrCodeProvider | The |
rngprovider | IRngProvider | The |
return | System |
public TwoFactorAuth ( string issuer, IRngProvider rngprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
rngprovider | IRngProvider | The |
return | System |
public TwoFactorAuth ( string issuer, int digits ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
digits | int | The number of digits to be displayed to the user / required for verification. |
return | System |
public TwoFactorAuth ( string issuer, int digits, int period ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
digits | int | The number of digits to be displayed to the user / required for verification. |
period | int | The period, specified in seconds, a TOTP is valid. |
return | System |
public TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
digits | int | The number of digits to be displayed to the user / required for verification. |
period | int | The period, specified in seconds, a TOTP is valid. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
return | System |
public TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm, IQrCodeProvider qrcodeprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
digits | int | The number of digits to be displayed to the user / required for verification. |
period | int | The period, specified in seconds, a TOTP is valid. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
qrcodeprovider | IQrCodeProvider | The |
return | System |
public TwoFactorAuth ( string issuer, int digits, int period, Algorithm algorithm, IQrCodeProvider qrcodeprovider, IRngProvider rngprovider ) : System | ||
issuer | string | The issuer of the TOTP authentication token. |
digits | int | The number of digits to be displayed to the user / required for verification. |
period | int | The period, specified in seconds, a TOTP is valid. |
algorithm | Algorithm | The algorithm to use when generating TOTP codes. |
qrcodeprovider | IQrCodeProvider | The |
rngprovider | IRngProvider | The |
return | System |
public VerifyCode ( string secret, string code ) : bool | ||
secret | string | The shared secret. |
code | string | The TOTP code to verify. |
return | bool |
public VerifyCode ( string secret, string code, int discrepancy ) : bool | ||
secret | string | The shared secret. |
code | string | The TOTP code to verify. |
discrepancy | int | The allowed time discrepancy (in both directions) in number of |
return | bool |
public VerifyCode ( string secret, string code, int discrepancy, System.DateTime dateTime ) : bool | ||
secret | string | The shared secret. |
code | string | The TOTP code to verify. |
discrepancy | int | The allowed time discrepancy (in both directions) in number of |
dateTime | System.DateTime | The |
return | bool |
public VerifyCode ( string secret, string code, int discrepancy, long timestamp ) : bool | ||
secret | string | The shared secret. |
code | string | The TOTP code to verify. |
discrepancy | int | The allowed time discrepancy (in both directions) in number of |
timestamp | long | The timestamp for wich to verify the TOTP code. |
return | bool |