Jong-Shian Wu
Programming. Cryptography. System Security. Web. Embedded System. JavaScript. Python. C. Hacking.
Fast Identity Online
Universal 2nd Factor
U2F RP (Server-Side)
U2F RP (Client-Side)
HTTPS
A Web Server
A Web Page
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
HTTPS
A Web Server
A Web Page
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
HTTPS
A Web Server
A Web Page
JavaScript function call
and event callback
(提供 MessagePort API 讓 RP 可以用 JavaScript 程序性地存取 U2F 功能)
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
HTTPS
A Web Server
A Web Page
JavaScript function call
and event callback
U2F Authenticator
實體 Dongle
USB (or NFC/BLE in the future)
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
RegisterRequest
A Web Server
A Web Page
U2F Authenticator
實體 Dongle
RegisterRequest
RegisterRequest
RegisterRequest = (Challenge, AppID)
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
RegisterResponse
A Web Server
A Web Page
U2F Authenticator
實體 Dongle
RegisterResponse
RegisterResponse
RegisterRequest = (Challenge, AppID)
RegisterResponse = (Challenge, AppID,
KeyHandle, PublicKey, AttestCert, AttestSig)
為這個 AppID 產生一個新的公鑰密鑰配對,
以 KeyHandle 為索引儲存在安全晶片上。
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
SignRequest
A Web Server
A Web Page
U2F Authenticator
實體 Dongle
SignRequest
SignRequest
SignRequest = (Challenge, AppID, KeyHandle)
U2F Client
Chrome 內建
U2F RP (Server-Side)
U2F RP (Client-Side)
SignResponse
A Web Server
A Web Page
U2F Authenticator
實體 Dongle
SignResponse
SignResponse
SignRequest = (Challenge, AppID, KeyHandle)
SignResponse = (Challenge, AppID, KeyHandle
AuthCounter, AuthSig)
使用 KeyHandle 對應到的密鑰做數位簽章。
AuthCounter 是隨著操作而不斷遞增的計數器。
Username => ScrambledPassphrase
SessionID => Username, SignInTime
(原本 DB 儲存了這 2 個對應關係)
Username => ScrambledPassphrase
SessionID => Username, SignInTime
KeyID => Username, KeyHandle, PublicKey
RegChallengeID => RegChallenge
AuthChallengeID => AuthChallenge, Username
(為了 U2F 需要再增加幾個 tables...
當然,規劃方式有很多種,例如 RegChallenge 和 AuthChallenge
也可以選擇和一個 Session 綁在一起,而不是額外獨立出來看。)
標準文件下載:
https://fidoalliance.org/specifications/download/
建議先看標準文件的「 Overview 」和「 JavaScript API 」。
看完這兩份以後,行有餘力可以再看「 Raw Message Formats 」,
如此一來,應該就可以看懂大部份的實作發生了什麼事情了。
在 Yubico 的開發者網頁上有個各式各樣實作的列表,
其中「 U2F Server Libraries 」列出來的幾個項目可以參考與學習:
https://developers.yubico.com/U2F/Libraries/List_of_libraries.html
By Jong-Shian Wu
Programming. Cryptography. System Security. Web. Embedded System. JavaScript. Python. C. Hacking.