C# 클래스 Google.Authenticator.TwoFactorAuthenticator

파일 보기 프로젝트 열기: BrandonPotter/GoogleAuthenticator 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
_epoch DateTime

공개 메소드들

메소드 설명
GeneratePINAtInterval ( string accountSecretKey, long counter, int digits = 6 ) : string
GenerateSetupCode ( string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight ) : SetupCode

Generate a setup code for a Google Authenticator user to scan.

GenerateSetupCode ( string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight ) : SetupCode

Generate a setup code for a Google Authenticator user to scan (with issuer ID).

GenerateSetupCode ( string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight, bool useHttps ) : SetupCode

Generate a setup code for a Google Authenticator user to scan (with issuer ID).

GetCurrentPIN ( string accountSecretKey ) : string
GetCurrentPIN ( string accountSecretKey, System.DateTime now ) : string
GetCurrentPINs ( string accountSecretKey ) : string[]
GetCurrentPINs ( string accountSecretKey, System.TimeSpan timeTolerance ) : string[]
TwoFactorAuthenticator ( ) : System
TwoFactorAuthenticator ( bool useManagedSha1, bool useUnmanagedOnFail ) : System
ValidateTwoFactorPIN ( string accountSecretKey, string twoFactorCodeFromClient ) : bool
ValidateTwoFactorPIN ( string accountSecretKey, string twoFactorCodeFromClient, TimeSpan timeTolerance ) : bool

비공개 메소드들

메소드 설명
Base32Encode ( byte data ) : string
EncodeAccountSecretKey ( string accountSecretKey ) : string
GenerateHashedCode ( byte key, long iterationNumber, int digits = 6 ) : string
GenerateHashedCode ( string secret, long iterationNumber, int digits = 6 ) : string
GetCurrentCounter ( ) : long
GetCurrentCounter ( System.DateTime now, System.DateTime epoch, int timeStep ) : long
UrlEncode ( string value ) : string
getHMACSha1Algorithm ( byte key ) : HMACSHA1

Creates a HMACSHA1 algorithm to use to hash the counter bytes. By default, this will attempt to use the managed SHA1 class (SHA1Manager) and on exception (FIPS-compliant machine policy, etc) will attempt to use the unmanaged SHA1 class (SHA1CryptoServiceProvider).

메소드 상세

GeneratePINAtInterval() 공개 메소드

public GeneratePINAtInterval ( string accountSecretKey, long counter, int digits = 6 ) : string
accountSecretKey string
counter long
digits int
리턴 string

GenerateSetupCode() 공개 메소드

Generate a setup code for a Google Authenticator user to scan.
public GenerateSetupCode ( string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight ) : SetupCode
accountTitleNoSpaces string Account Title (no spaces)
accountSecretKey string Account Secret Key
qrCodeWidth int QR Code Width
qrCodeHeight int QR Code Height
리턴 SetupCode

GenerateSetupCode() 공개 메소드

Generate a setup code for a Google Authenticator user to scan (with issuer ID).
public GenerateSetupCode ( string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight ) : SetupCode
issuer string Issuer ID (the name of the system, i.e. 'MyApp')
accountTitleNoSpaces string Account Title (no spaces)
accountSecretKey string Account Secret Key
qrCodeWidth int QR Code Width
qrCodeHeight int QR Code Height
리턴 SetupCode

GenerateSetupCode() 공개 메소드

Generate a setup code for a Google Authenticator user to scan (with issuer ID).
public GenerateSetupCode ( string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight, bool useHttps ) : SetupCode
issuer string Issuer ID (the name of the system, i.e. 'MyApp')
accountTitleNoSpaces string Account Title (no spaces)
accountSecretKey string Account Secret Key
qrCodeWidth int QR Code Width
qrCodeHeight int QR Code Height
useHttps bool Use HTTPS instead of HTTP
리턴 SetupCode

GetCurrentPIN() 공개 메소드

public GetCurrentPIN ( string accountSecretKey ) : string
accountSecretKey string
리턴 string

GetCurrentPIN() 공개 메소드

public GetCurrentPIN ( string accountSecretKey, System.DateTime now ) : string
accountSecretKey string
now System.DateTime
리턴 string

GetCurrentPINs() 공개 메소드

public GetCurrentPINs ( string accountSecretKey ) : string[]
accountSecretKey string
리턴 string[]

GetCurrentPINs() 공개 메소드

public GetCurrentPINs ( string accountSecretKey, System.TimeSpan timeTolerance ) : string[]
accountSecretKey string
timeTolerance System.TimeSpan
리턴 string[]

TwoFactorAuthenticator() 공개 메소드

public TwoFactorAuthenticator ( ) : System
리턴 System

TwoFactorAuthenticator() 공개 메소드

public TwoFactorAuthenticator ( bool useManagedSha1, bool useUnmanagedOnFail ) : System
useManagedSha1 bool
useUnmanagedOnFail bool
리턴 System

ValidateTwoFactorPIN() 공개 메소드

public ValidateTwoFactorPIN ( string accountSecretKey, string twoFactorCodeFromClient ) : bool
accountSecretKey string
twoFactorCodeFromClient string
리턴 bool

ValidateTwoFactorPIN() 공개 메소드

public ValidateTwoFactorPIN ( string accountSecretKey, string twoFactorCodeFromClient, TimeSpan timeTolerance ) : bool
accountSecretKey string
twoFactorCodeFromClient string
timeTolerance TimeSpan
리턴 bool

프로퍼티 상세

_epoch 공개적으로 정적으로 프로퍼티

public static DateTime _epoch
리턴 DateTime