「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。 -戻る --[[FIDO2]] --[[Microsoft Passport]] * 目次 [#t997f2c6] #contents *概要 [#oe736650] -Web Authentication API (WebAuthn) は --[[FIDO2]] の Web Application用 JavaScript Library。 --公開鍵暗号を用た認証を行う [[Credential Management API>#r3e74bd1]] の拡張機能 --パスワードを用いない認証に加え、SMS を用いない二要素認証を実現する。 -昔のサンプルは、[[makeCredential & getAssertion()メソッド>Web Authentication API(旧)]]だったが、~ 最近のサンプルは、[[navigator.credentials.create & get()メソッド>#k5ae1509]]に、変わっている。 *詳細 [#m60489ae] -W3C で定義されている使用する (主な) API の名前は、 --[[navigator.credentials.create()メソッド>#d6d0bcf7]] --[[navigator.credentials.get()メソッド>#d385464d]] -セキュアコンテキスト (https or localhost)であることを必要とし、~ ブラウザがセキュアコンテキストで動作していない場合は利用できない。 -[[冒頭のユースケース>https://www.w3.org/TR/webauthn/#use-cases]]では、デスクトップのブラウザで操作して、~ [[登録(RegistrationでAttestation)>#z6957f0b]]と[[認証(AuthenticationでAssertion)>#ca76964e]]~ だけをスマホに転送するというユースケースが紹介されている。 **[[登録(RegistrationでAttestation)>#z6957f0b]] [#n2d59363] -[[navigator.credentials.create()メソッド>#d6d0bcf7]]を呼び出す。 -publicKeyオプションと併用する。 --[[引数:PublicKeyCredentialCreationOptions>#k26de1bf]] --[[戻り値:AuthenticatorAttestationResponse>#z3e54d7d]] **[[認証(AuthenticationでAssertion)>#ca76964e]] [#vaec9d63] -[[navigator.credentials.get()メソッド>#d385464d]]を呼び出す。 -publicKeyオプションと併用する。 --[[引数:PublicKeyCredentialRequestOptions>#j169c489]]: --[[戻り値:AuthenticatorAssertionResponse>#v1038525]]: *[[仕様>#wfcfd0f0]] [#gbc53e73] **登場人物 [#k64e5e3d] ***[[ユーザ>FIDO2#eb9c3311]] [#b7693434] ***[[依拠当事者(Relying Party)>FIDO2#s47c72a3]] [#q93a608f] -[[ユーザ>#b7693434]]の[[登録(RegistrationでAttestation)>#z6957f0b]]と[[認証(AuthenticationでAssertion)>#ca76964e]]をする。 -Relying Party Identifier(RP ID): --WebAuthn Relying Partyを識別する有効なドメイン文字列 --スキームにはhttpsが必要(ポート番号に制限はない)。 --FQDN名か、ドメイン接尾辞の何れかになる。~ https://login.example.com:1337なら、 ---FQDN名: [login.example.com] ---ドメイン接尾辞: [example.com] -[[RPの実装パターン>WebAuthnを実装する。#c959ed41]] ***[[認証器>FIDO2#l38a4cce]](Authenticator) [#ze70bbe2] -認証器アテステーション(Authenticator Attestation)~ --認証器のデータを検証する作業。 ---製造と機能 ---認証器が発行する[[Credential Public Key、Credential ID>#w66e2b42]]、署名カウンタ --アテステーション証明書: アテステーションするために使用する秘密鍵を含むX.509証明書。 -式(Ceremony) --[[登録式(Registration Ceremony)>#z6957f0b]]に従い、~ [[登録(RegistrationでAttestation)>#z6957f0b]]を行うと、~ アテステーション(Attestation)が発行される。 --[[認証式(Authentication Ceremony)>#ca76964e]]に従い、~ [[認証(AuthenticationでAssertion)>#ca76964e]]を行うと、~ [[認証器アサーション>#ca76964e]]が発行される。 -レート制限 --ブルートフォース攻撃に対する制御を実装するプロセス。 --限度に達すると、 ---指数関数的に増加する遅延を課すか、 ---または現在の認証方式を無効にし、 ---利用可能であれば異なる認証係数を提供する。 ***クライアント [#l4e269d3] -ブラウザ実装など。 -ユーザエージェントに(全体的にまたは部分的に)実装された中間的なエンティティ **仕組み [#o046d504] -[[登録(RegistrationでAttestation)>#z6957f0b]]と -[[認証(AuthenticationでAssertion)>#ca76964e]]は 儀式であり、 この儀式では、 -[[ユーザ>#b7693434]] -[[依拠当事者>#q93a608f]] -[[認証器>#ze70bbe2]] -[[クライアント>#l4e269d3]] が共同した、 >[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]] が必要になる。 ***各種鍵(Credential) [#kb3dc512] -Credential ID --確率的にユニークなバイトシーケンス。 --Resident Credentialと、[[認証器アサーション>#ca76964e]]を紐付けるために指定する必要がある。~ https://github.com/OpenTouryoProject/MultiPurposeAuthSite/issues/50#issuecomment-337115270 -Credential Public Key --[[登録(RegistrationでAttestation)>#z6957f0b]]時に[[認証器>#ze70bbe2]]によって生成され、[[依拠当事者(Relying Party)>#q93a608f]]に返された信用証明書の公開鍵部分 --信用証明書の公開鍵は、FIDO UAF、FIDO U2F、それに関連する本仕様書の一部において、User Public Keyと呼ばれる。 -Resident Credential (Client-side-resident Public Key Credential Source)~ FIDO2.0 から新しく追加された、キーの中にユーザ情報を保存する機能。 --[[navigator.credentials.create()メソッド>#d6d0bcf7]]の引数の[[PublicKeyCredentialCreationOptions>#k26de1bf]]の、~ authenticatorSelection に requiredResidentKey true をセットすると[[認証器>#ze70bbe2]]に格納される。 --ユーザ情報(Credential ID、PublicKeyCredentialUserEntity、Challengeへの署名に必要な情報)が保存される。 --[[navigator.credentials.get()メソッド>#d385464d]]でChallengeだけで(ユーザ情報を入力しないで)ログインができる。 --Resident Credentialを登録する[[認証器>#ze70bbe2]]の容量制限がある。 --[[ユーザ・ハンドル>#b7693434]] + [[RP ID>#q93a608f]]で信用証明書を選択できる。 --参考:~ https://blog.haniyama.com/2018/06/17/edge-support-webauthn/#resident-key-toha ***ユーザの存在またはユーザ確認のテスト(式典) [#pe519ad7] [[登録(RegistrationでAttestation)>#z6957f0b]]と、~ [[認証(AuthenticationでAssertion)>#ca76964e]]では、~ 以下のような、[[存在 vs 認証>FIDO認証器#z4607634]]を行う。 -[[ユーザ存在テスト>FIDO認証器#s34337d3]] --ユーザが[[認証器>#ze70bbe2]]と簡単に接触することによってブール結果が生成される。 --ユーザ存在テストが正常に完了すると、ユーザは「UP: User Present」と言われる。 -[[ユーザ検証>FIDO認証器#g701954e]] --authenticatorMakeCredential + authenticatorGetAssertionで行われる。 --ユーザ検証プロセスが正常に完了すると、ユーザは「UV: User Verified」と言われる。 ***[[登録(RegistrationでAttestation)>FIDO2#e7f048cc]] [#z6957f0b] -登録式(Registration Ceremony)~ --[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]] --Credential Public Keyを作成し、~ [[ユーザ>#b7693434]]の[[依拠当事者(Relying Party)>#q93a608f]]上のアカウントに関連付ける。 -[[認証器>#ze70bbe2]]アテステーション(Authenticator Attestation)~ authenticatorMakeCredential操作の結果として[[認証器>#ze70bbe2]]から返された、~ 署名された[[AuthenticatorAttestationResponse>#z3e54d7d]]オブジェクト。 ***[[認証(AuthenticationでAssertion)>FIDO2#dacdf419]] [#ca76964e] -認証式(Authentication Ceremony)~ --[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]] --[[ユーザ>#b7693434]]の[[依拠当事者(Relying Party)>#q93a608f]]上の~ Credential Public Keyで、[[認証器>#ze70bbe2]]アサーションの署名を検証する。 -[[認証器>#ze70bbe2]]アサーション(Authenticator Assertion)~ authenticatorGetAssertion操作の結果として[[認証器>#ze70bbe2]]から返された、~ 署名された[[AuthenticatorAssertionResponse>#v1038525]]オブジェクト。 **依存 [#t0d61404] ***データ [#s8d69a88] -[[CBOR]] -[[CDDL>CBOR#u619feca]] -[[COSE]] -[[ArrayBuffer>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?ECMAScript#kf5afb64]] ***その他 [#f329c892] -HTML -DOM -ECMAScript -Web IDL: Webブラウザーで実装するためのAPIを記述するためのIDL -FIDO AppID:~ 呼び出し元アプリケーションのFacetIDを決定し、呼び出し元のFacetIDが~ AppIDに対して許可されているかどうかを判断するアルゴリズムを定義する。 *API [#k5ae1509] **[[登録(Attestation)>FIDO2#e7f048cc]]: navigator.credentials.create()メソッド [#d6d0bcf7] 内部で、authenticatorMakeCredentialを呼び出す。 -https://www.w3.org/TR/webauthn/#op-make-cred -https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html#authenticatorMakeCredential ***引数:PublicKeyCredentialCreationOptions [#k26de1bf] -主要な引数 --rp ---id:[[RP ID>#q93a608f]] ---name:文字列 --user ---id: ---name: ---displayName: --challenge ---ランダムな情報の大きなバッファー(例えば100バイト以上)が絶対に重要。 ---登録過程のセキュリティを確保するためにサーバ上で生成する必要がある。 --timeout --pubKeyCredParams // このRPはES256またはRS256の公開鍵を受け入れますが、ES256公開鍵を優先します。 pubKeyCredParams: [ { type: "public-key", alg: -7 // "ES256" as registered in the IANA COSE Algorithms registry }, { type: "public-key", alg: -257 // Value registered by this specification for "RS256" } ], -オプションの引数 --attestation ---"none"(既定値)~ ユーザ名/パスワードをFIDO2に切り替える場合。~ (FIDO2はパスワードよりも優れていると考える場合) ---"indirect"~ スマートカードまたはUAFから移行する場合、~ [[認証器>#ze70bbe2]]の信頼性をattestation statement から確認する必要がある。~ クライアントがattestation statement を取得する方法を決定できる。 ---"direct"~ スマートカードまたはUAFから移行する場合、~ [[認証器>#ze70bbe2]]の信頼性をattestation statement から確認する必要がある。~ サーバーがattestation statement を必要とすることを示す。 --authenticatorSelection~ 色々なオプションを指定、その一つにResident Key のサポートなどがある。 -参考 --PublicKeyCredentialCreationOptions~ https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialcreationoptions dictionary PublicKeyCredentialCreationOptions { required PublicKeyCredentialRpEntity rp; required PublicKeyCredentialUserEntity user; required BufferSource challenge; required sequence<PublicKeyCredentialParameters> pubKeyCredParams; unsigned long timeout; sequence<PublicKeyCredentialDescriptor> excludeCredentials = []; AuthenticatorSelectionCriteria authenticatorSelection; AttestationConveyancePreference attestation = "none"; AuthenticationExtensionsClientInputs extensions; }; ***戻り値:AuthenticatorAttestationResponse [#z3e54d7d] 厳密には、PublicKeyCredential.responseに、~ AuthenticatorResponse <- AuthenticatorAttestationResponse を含む、~ PublicKeyCredential に解決する Promiseを返す。 -id(rawId): GlobalにUniqueなPublicKeyCredentialのID(credentialId) -type: public-key(このUseCaseでは固定) -AuthenticatorAttestationResponseのプロパティ --clientDataJSON: ArrayBuffer型、読み取り専用 ---AuthenticatorResponseから継承 ---[[認証器>#ze70bbe2]]のauthenticatorMakeCredential()メソッドの戻り値 --attestationObject: ArrayBuffer型、読み取り専用~ id(rawId) = PublicKeyCredentialのID(credentialId)に対応した、公開鍵と他の認証データ ---authenticatorData~ https://www.w3.org/TR/webauthn/#sec-authenticator-data |#|Name|Length (in bytes)|Description|h |1|rpIdHash|32|PublicKeyCredentialに関連付けられた[[RP ID>#q93a608f]]のSHA-256ハッシュ| |2|flags|1|Flags (bit 0 is the least significant bit)| |3|signCount|4|署名カウンタ(32-bit unsigned big-endian integer)| |4|attestedCredentialData|可変(存在する場合)|検証された[[認証器アテステーション(Authenticator Attestation)>#ze70bbe2]](存在する場合)| |5|extensions|可変(存在する場合)|拡張の[[認証器>#ze70bbe2]]データ| ---fmt:アテステーションステートメントの形式を示すテキスト文字列~ ("packed"、 "tpm"、 "android-key"、 "android-safetynet"、 "fido-u2f"、"none") ---attStmt:"fmt"で定義された形式のアテステーションステートメント -参考 --PublicKeyCredential interface ---https://www.w3.org/TR/webauthn/#iface-pkcredential ---https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential --AuthenticatorResponse interface ---https://www.w3.org/TR/webauthn/#authenticatorresponse ---https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorResponse --AuthenticatorAttestationResponse interface ---https://www.w3.org/TR/webauthn/#authenticatorattestationresponse ---https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorAttestationResponse **[[認証(Assertion)>FIDO2#dacdf419]]: navigator.credentials.get()メソッド [#d385464d] 内部で、authenticatorGetAssertionを呼び出す。 -https://www.w3.org/TR/webauthn/#op-get-assertion -https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html#authenticatorGetAssertion ***引数:PublicKeyCredentialRequestOptions [#j169c489] -主要な引数 --challenge ---ランダムな情報の大きなバッファー(例えば100バイト以上)が絶対に重要。 ---登録過程のセキュリティを確保するためにサーバ上で生成する必要がある。 --timeout --rpId~ --allowCredentials ---type:"public-key" ---id:id(rawId) = PublicKeyCredentialのID(credentialId) ---transports: [] (通信のヒントらしいが、空の配列が指定されている) --userVerification~ ユーザー検証要件の列挙型 ---"required" ---"preferred" ---"discouraged" -参考 --PublicKeyCredentialRequestOptions ---https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrequestoptions ---https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredentialRequestOptions dictionary PublicKeyCredentialRequestOptions { required BufferSource challenge; unsigned long timeout; USVString rpId; sequence<PublicKeyCredentialDescriptor> allowCredentials = []; UserVerificationRequirement userVerification = "preferred"; AuthenticationExtensionsClientInputs extensions; }; ***戻り値:AuthenticatorAssertionResponse [#v1038525] 厳密には、PublicKeyCredential.responseに、~ AuthenticatorResponse <- AuthenticatorAssertionResponse を含む、~ PublicKeyCredential に解決する Promiseを返す。 -id(rawId): GlobalにUniqueなPublicKeyCredentialのID(credentialId) -type: public-key(このUseCaseでは固定) -AuthenticatorAssertionResponseのプロパティ --clientDataJSON: ArrayBuffer型、読み取り専用 ---AuthenticatorResponseから継承 ---[[認証器>#ze70bbe2]]のauthenticatorGetAssertion()メソッドの戻り値 --authenticatorData: ArrayBuffer型、読み取り専用 --signature: ArrayBuffer型、読み取り専用 --userHandle: ArrayBuffer型、読み取り専用、nullable -参考 --PublicKeyCredential interface ---https://www.w3.org/TR/webauthn/#iface-pkcredential ---https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential --AuthenticatorResponse interface ---https://www.w3.org/TR/webauthn/#authenticatorresponse ---https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorResponse --AuthenticatorAssertionResponse interface ---https://www.w3.org/TR/webauthn/#authenticatorassertionresponse ---https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorAssertionResponse *参考 [#b22f8c0c] -WebAuthnに関するn件の記事 - Qiita~ https://qiita.com/tags/webauthn -もうすぐ来る? Web Authentication APIについて調べてみた~ https://qiita.com/syoichi/items/62e6aa66938692a3c0b6 -パスワードレス認証WebAuthnの勘所と対応状況~ :新春特別企画|gihyo.jp … 技術評論社~ https://gihyo.jp/dev/column/newyear/2019/webauthn -WebAuthnでパスワードレスなサイトを作る。~ 安全なオンライン認証を導入するFIDOの基本~ エンジニアHub|若手Webエンジニアのキャリアを考える!~ https://employment.en-japan.com/engineerhub/entry/2019/02/13/103000 **w3c [#wfcfd0f0] -Web Authentication Working Group~ https://www.w3.org/Webauthn/ --Credential Management Level 1~ https://www.w3.org/TR/credential-management-1/ --Web Authentication: An API for accessing Public Key Credentials Level 1~ https://www.w3.org/TR/webauthn/ **MDN - Web APIs [#qcf1790f] ***Credential Management API [#r3e74bd1] -Credential Management API~ https://developer.mozilla.org/ja/docs/Web/API/Credential_Management_API -Credential~ https://developer.mozilla.org/ja/docs/Web/API/Credential --PublicKeyCredential~ https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential --PasswordCredential~ https://developer.mozilla.org/ja/docs/Web/API/PasswordCredential --FederatedCredential~ https://developer.mozilla.org/ja/docs/Web/API/FederatedCredential ***Web Authentication API [#wbffefc4] [[Credential Management API>#r3e74bd1]]中のPublicKeyCredentialを拡張したもの。 -Web Authentication API --https://developer.mozilla.org/ja/docs/Web/API/Web_Authentication_API --https://developer.mozilla.org/ja/docs/Web/API/Web_Authentication_API/Attestation_and_Assertion -AuthenticatorResponse~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorResponse/ --clientDataJSON~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorResponse/clientDataJSON -AuthenticatorAttestationResponse~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/ --attestationObject~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/attestationObject -AuthenticatorAssertionResponse~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse --authenticatorData~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/authenticatorData --signature~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/signature --userHandle~ https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/userHandle **webauthn.org [#ec6dcea6] -WebAuthn demo~ https://webauthn.org --apowers313/fido2-server-demo: A set of FIDO2 / WebAuthn demo servers~ https://github.com/apowers313/fido2-server-demo/ ***OAuth0 [#b060ac93] 仕組みをアニメーションで解り易く説明している。 -Web Authentication (WebAuthn) Credential and Login Demo~ https://webauthn.me/ ***[[fido2-net-lib]] [#re8fa185] .NET standard の Web Authentication API対応ライブラリ。 **Yubico [#m94f60dc] -Yubico WebAuthn demo~ https://demo.yubico.com/webauthn/ -Developer Program~ https://www.yubico.com/why-yubico/for-developers/developer-program/ -New NIST Authentication Guidelines for Public Safety and First Responders~ https://www.yubico.com/2018/05/new-nist-authentication-guidelines-for-public-safety-and-first-responders/ ***blog.jxck.io [#u5a7037b] -Web Authentication API で FIDO U2F(YubiKey) 認証 | ~ https://blog.jxck.io/entries/2018-05-15/webauthentication-api.html --Web Authentication API (FIDO-U2F) DEMO~ https://labs.jxck.io/webauthentication/fido-u2f/ ***enjoy struggling [#ne242fa6] -Edge が WebAuthN をサポートしたらしいので色々試してみた(Insider Preview)~ https://blog.haniyama.com/2018/06/17/edge-support-webauthn/ --HWataru/webauthn-demo: WebAuthn Demo~ https://github.com/HWataru/webauthn-demo --fido-alliance/webauthn-demo: WebAuthn Demo~ https://github.com/fido-alliance/webauthn-demo ***(株)ソフト技研 [#hdc805ce] -ワンタイムパスワードトークンYubiKey~ http://yubikey.yubion.com --ブログ~ http://yubikey.yubion.com/blog.html **ritou [#e6549dc4] ***Speaker Deck [#dcb8371c] -WebAuthn @ DroidKaigi 2019~ https://speakerdeck.com/ritou/webauthn-at-droidkaigi-2019 ***r-weblife [#o24b3d4a] -WebAuthn カテゴリーの記事一覧~ https://ritou.hatenablog.com/archive/category/WebAuthn -DroidKaigi 2019 にて WebAuthn のお話をしてきました~ https://ritou.hatenablog.com/entry/2019/02/11/212441 ***Qiita [#sd089730] -WebAuthnのデモサイト "webauthn.me" のアニメーションがちょっと親切~ https://qiita.com/ritou/items/5ace0d375d89953d5dff **enjoy struggling [#q189993b] -enjoy struggling - 技術メモとか料理ネタとか~ https://blog.haniyama.com/ --Microsoft Account FIDO2 対応キーでログイン可能に~ https://blog.haniyama.com/2018/11/21/msa-login-with-securitykey/ --WebAuthn もくもく会を開催しました~ ---Server Requirements and Transport Binding Profile なる文書について#~ https://blog.haniyama.com/2018/07/23/fido-webauthn-mokumoku/#server-requirements-and-transport-binding-profile-naruwen-shu-nituite >このドキュメントはFIDO2サーバのための非標準、提案されたREST APIを含んでいます。~ このインターフェイスは必須ではありませんが、FIDO2適合テストツールで使用される~ インターフェイスであり、適合性テストツールでメッセージを検証するための~ 標準的な方法でサーバーがメッセージを送受信できます。 --[[, etc.>WebAuthnを実装する。#j9dcdad6]] **内部リンク [#ya903c0d] ***[[Web Authentication API(旧)]] [#ddc48188] ***[[WebAuthnを実装する。]] [#u0941552] ---- Tags: [[:IT国際標準]], [[:認証基盤]]