Google身分驗證器

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
Google身分驗證器
開發者Google
首次發布2010年9月20日,​13年前​(2010-09-20[1]
目前版本
  • 5.10 (2020年4月23日;Android)[2]
  • 3.4.0 (2022年3月1日;iOS)[3]
編輯維基數據鏈結
原始碼庫github.com/google/google-authenticator
程式語言
作業系統Android, iOS, BlackBerry OS
系統平台行動裝置
許可協定私有許可協定(早期版本為Apache License 2.0
網站play.google.com/store/apps/details?id=com.google.android.apps.authenticator2 編輯維基數據

Google身分驗證器是一款TOTPHOTP兩步驗證軟體權杖,此軟體用於Google的認證服務。此項服務所使用的演算法已列於 RFC 6238RFC 4226 中。[4]

Google身分驗證器給予使用者一個六位到八位的一次性密碼用於進行登入Google或其他站點時的附加驗證。其同樣可以給第三方應用生成口令,例如密碼管理員網路硬碟。先前版本的Google身分驗證器開放原始碼,但之後的版本以專有軟體的形式公開。[5]

典型使用情況[編輯]

舊標誌

通常,使用者安裝身分驗證程式在智慧型手機上。為了登入到使用兩步驗證的網站或服務上,使用者提供使用者名稱和密碼後執行身分驗證器進行額外驗證。 該應用程式會生成六位數的一次性密碼,而不同網站可能會生成同一密碼。

為了使身分驗證器正常工作,安裝執行之前網站必須向使用者提供一組共享金鑰。這組金鑰將會用於未來的所有登陸請求。

在兩步驗證的保護之下,僅僅擁有使用者名稱密碼已不足以駭入帳戶。攻擊者需要這組共享金鑰或者拿到進行兩步驗證的行動裝置。另一種方法是進行中間人攻擊;若使用者的電腦被木馬侵入,則使用者名稱、密碼及一次性密碼都將被木馬所擷取,隨後攻擊者即可利用木馬進行登入、監聽或修改使用者與網站的通訊。

實現[編輯]

Google提供安卓[6]黑莓iOS[7]版本的身分驗證器。同時也存在有第三方版本。

  • Windows Phone 7.5/8/8.1/10: Microsoft Authenticator[8] Virtual TokenFactor[9]
  • Windows Mobile: Google Authenticator for Windows Mobile[10]
  • Java CLI: Authenticator.jar[11]
  • Java GUI: JAuth[12] FXAuth[13]
  • J2ME: gauthj2me[14] lwuitgauthj2me[15] Mobile-OTP (僅支援中文)[16] totp-me[17]
  • Palm OS: gauthj2me[18]
  • Python: onetimepass[19], pyotp[20]
  • PHP: GoogleAuthenticator.php[21]
  • Ruby: rotp,[22] twofu[23]
  • Rails: active_model_otp[24] (第三方實現)
  • webOS: GAuth[25]
  • Windows: gauth4win[26] MOS Authenticator[27] WinAuth[28]
  • .NET: TwoStepsAuthenticator[29]
  • HTML5: html5-google-authenticator[30]
  • MeeGo/Harmattan (Nokia N9): GAuth[31]
  • Sailfish OS: SGAuth,[32] SailOTP[33]
  • Apache: Google Authenticator Apache Module[34]
  • PAM: Google Pluggable Authentication Module[35] oauth-pam[36]
  • Backend: LinOTP (後端管理使用Python實現)
  • Chrome/Chrome OS: Authenticator[37]
  • iOS: OTP Auth[38]
  • privacyIDEA 認證系統。

技術說明[編輯]

服務提供商為每個使用者生成80位元的金鑰(然而RFC 4226 §4要求使用128位元並建議使用160位元金鑰)。[39] 它以16位元、26位或者32位元base32的字串亦或是二維條碼的方式提供出來。用戶端使用此金鑰生成HMAC-SHA1。經過HMAC處理過的資訊可能為:

  • UNIX時間TOTP)起始之後所經過的30秒周期數
  • 隨著每個新密碼所增加的計數(HOTP

一段雜湊值被提取出來並轉換為6位數密碼。

生成一次性密碼的虛擬碼[編輯]

  function GoogleAuthenticatorCode(string secret)
      key := base32decode(secret)
      message := floor(current Unix time / 30)
      hash := HMAC-SHA1(key, message)
      offset := last nibble of hash
      truncatedHash := hash[offset..offset+3]  //4 bytes starting at the offset
      Set the first bit of truncatedHash to zero  //remove the most significant bit
      code := truncatedHash mod 1000000
      pad code with 0 until length of code is 6
      return code

生成事件性或計數性的一次性密碼虛擬碼[編輯]

  function GoogleAuthenticatorCode(string secret)
      key := base32decode(secret)
      message := counter encoded on 8 bytes
      hash := HMAC-SHA1(key, message)
      offset := last nibble of hash
      truncatedHash := hash[offset..offset+3]  //4 bytes starting at the offset
      Set the first bit of truncatedHash to zero  //remove the most significant bit
      code := truncatedHash mod 1000000
      pad code with 0 until length of code is 6
      return code

Android上的開源情況[編輯]

Google身分驗證器在Google Play商店上目前(2017年9月16日)以私有著作權協定發布。Google在GitHub上開放了其身分驗證器原始碼,並陳述如下:

「此開源計劃包含了2.21版本的原始碼。隨後的版本中包含了Google特有的工作流程,與此專案無關。」

Android版本的獨立分支之一為FreeOTP[40],其基於Google在GitHub上所開源的最新版本。另外一個並非很火的分支OTP Authenticator[41]也在Google Play上可供下載。

參考文獻[編輯]

  1. ^ Google Is Making Your Account Vastly More Secure With Two-Step Authentication - TechCrunch. TechCrunch. 2010-09-20 [2016-03-12]. (原始內容存檔於2020-12-02). 
  2. ^ https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2; 檢索日期: 2021年9月10日.
  3. ^ https://apps.apple.com/app/google-authenticator/id388497605; 檢索日期: 2022年5月9日.
  4. ^ GitHub - google/google-authenticator: Open source version of Google Authenticator (except the Android app). GitHub. Google. [2017-10-15]. (原始內容存檔於2021-01-26) (英語). These implementations support the HMAC-Based One-time Password (HOTP) algorithm specified in RFC 4226 and the Time-based One-time Password (TOTP) algorithm specified in RFC 6238. 
  5. ^ Willis, Nathan (22 January 2014)."FreeOTP multi-factor authentication頁面存檔備份,存於網際網路檔案館". LWN.net. Retrieved 10 August 2015.
  6. ^ https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2頁面存檔備份,存於網際網路檔案館) A
  7. ^ Google Authenticator. App Store. [2017-10-15]. (原始內容存檔於2015-12-22). 
  8. ^ Authenticator. 4 April 2013 [2017-10-15]. (原始內容存檔於2019-10-17). 
  9. ^ Virtual TokenFactor. 26 February 2012 [2017-10-15]. (原始內容存檔於2013-09-08). 
  10. ^ [APP]Google Authenticator for Windows Mobile. XDA Developers. [2017-10-15]. (原始內容存檔於2019-04-19). 
  11. ^ http://blog dot jamesdotcuff dot net. [2017-10-15]. (原始內容存檔於2014-08-01). 
  12. ^ mclamp/JAuth. GitHub. [2017-10-15]. (原始內容存檔於2015-08-04). 
  13. ^ kamenitxan/FXAuth. GitHub. [2017-10-15]. (原始內容存檔於2020-09-05). 
  14. ^ gauthj2me - Google Authentification in Java Mobile, j2me - Google Project Hosting. [2017-10-15]. (原始內容存檔於2016-01-06). 
  15. ^ lwuitgauthj2me - Google Authenticator for J2ME phones - Google Project Hosting. [2017-10-15]. (原始內容存檔於2016-03-16). 
  16. ^ chunlinyao / mobile-otp — Bitbucket. [2017-10-15]. (原始內容存檔於2017-10-15). 
  17. ^ totp-me - TOTP for Java ME - Google authenticator. [2017-10-15]. (原始內容存檔於2018-01-05). 
  18. ^ gauth.prc - gauthj2me - Google Authenticator for Palm OS (converted from java) - Google Authentification in Java Mobile, j2me - Google Project Hosting. [2017-10-15]. (原始內容存檔於2016-01-06). 
  19. ^ tadeck/onetimepass. GitHub. [2017-10-15]. (原始內容存檔於2020-10-27). 
  20. ^ pyotp/pyotp. GitHub. [2017-10-15]. (原始內容存檔於2018-06-11). 
  21. ^ chregu/GoogleAuthenticator.php. GitHub. [2017-10-15]. (原始內容存檔於2020-09-29). 
  22. ^ rotp - RubyGems.org - your community gem host. [2017-10-15]. (原始內容存檔於2019-07-11). 
  23. ^ ukazap/twofu. GitHub. [2017-10-15]. (原始內容存檔於2020-09-12). 
  24. ^ heapsource/active_model_otp. GitHub. [2017-10-15]. (原始內容存檔於2020-12-05). 
  25. ^ GAuth. [2017-10-15]. (原始內容存檔於2020-10-20). 
  26. ^ gauth4win - Google Authenticator for windows - Google Project Hosting. [2017-10-15]. (原始內容存檔於2016-01-11). 
  27. ^ MOS Authenticator Home. [2017-10-15]. (原始內容存檔於2020-02-17). 
  28. ^ winauth - Windows Authenticator for Battle.net / World of Warcraft / Guild Wars 2 / Glyph / WildStar / Google / Bitcoin - Google Project Hosting. [2017-10-15]. (原始內容存檔於2015-05-17). 
  29. ^ glacasa/TwoStepsAuthenticator. GitHub. [2017-10-15]. (原始內容存檔於2020-12-05). 
  30. ^ gbraad/html5-google-authenticator. GitHub. [2017-10-15]. (原始內容存檔於2014-07-05). 
  31. ^ Techtransit. Nokia Store: Download GAuth and many other games, wallpaper, ringtones and mobile apps on your Nokia phone. [2017-10-15]. (原始內容存檔於2014-07-12). 
  32. ^ SGAuth. [2017-10-15]. (原始內容存檔於2019-07-11). 
  33. ^ SailOTP. [2017-10-15]. (原始內容存檔於2021-01-10). 
  34. ^ google-authenticator-apache-module - Apache Module for Two-Factor Authentication via Google Authenticator - Google Project Hosting. [2017-10-15]. (原始內容存檔於2015-11-19). 
  35. ^ google-authenticator - Two-step verification - Google Project Hosting. [2017-10-15]. (原始內容存檔於2015-02-10). 
  36. ^ oauth-pam - PAM for use with OAuth Websites - Google Project Hosting. [2017-10-15]. (原始內容存檔於2016-08-08). 
  37. ^ Authenticator. [2017-10-15]. (原始內容存檔於2019-10-17). 
  38. ^ OTP Auth. App Store. [2017-10-15]. (原始內容存檔於2019-04-12). 
  39. ^ https://tools.ietf.org/html/c#section-4[永久失效連結]
  40. ^ FreeOTP. [2017-10-15]. (原始內容存檔於2020-11-12). 
  41. ^ kaie/otp-authenticator-android. GitHub. [2017-10-15]. (原始內容存檔於2020-11-22). 

外部連結[編輯]