- 追加された行はこの色です。
- 削除された行はこの色です。
「[[マイクロソフト系技術情報 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(旧)#e44e4639]]だったが、~
最近のサンプルは、[[navigator.credentials.create & get()メソッド>#m60489ae]]に、変わっている。
-昔のサンプルは、[[makeCredential & getAssertion()メソッド>Web Authentication API(旧)]]だったが、~
最近のサンプルは、[[navigator.credentials.create & get()メソッド>#k5ae1509]]に、変わっている。
-ややこしい
--RegistrationでAttestationされる。
--AuthenticationでAssertionされる。
*詳細 [#m60489ae]
-W3C で定義されている使用する (主な) API の名前は、
--navigator.credentials.create()メソッド
--navigator.credentials.get()メソッド
--[[navigator.credentials.create()メソッド>#d6d0bcf7]]
--[[navigator.credentials.get()メソッド>#d385464d]]
-セキュアコンテキスト (https or localhost)であることを必要とし、~
ブラウザがセキュアコンテキストで動作していない場合は利用できない。
-[[冒頭のユースケース>https://www.w3.org/TR/webauthn/#use-cases]]では、デスクトップのブラウザで操作して、~
[[登録(Attestation)>FIDO2#e7f048cc]]と[[認証(Assertion)>FIDO2#dacdf419]]だけを~
スマホに転送するというユースケースが紹介されている。
[[登録(RegistrationでAttestation)>#z6957f0b]]と[[認証(AuthenticationでAssertion)>#ca76964e]]~
だけをスマホに転送するというユースケースが紹介されている。
-[[登録(Attestation)>FIDO2#e7f048cc]]と[[認証(Assertion)>FIDO2#dacdf419]]は儀式であり、~
この儀式では、[[認証ジェスチャ>FIDO認証器#g701954e]]が必要になる。
**[[登録(RegistrationでAttestation)>#z6957f0b]] [#n2d59363]
-[[navigator.credentials.create()メソッド>#d6d0bcf7]]を呼び出す。
**navigator.credentials.create()メソッド [#n2d59363]
-[[登録(Attestation)>FIDO2#e7f048cc]]
-publicKeyオプションと併用する。
--PublicKeyCredentialCreationOptions: 登録リクエスト作成のオプションを記述する。
--PublicKeyCredential: 作成された登録リクエストを格納する。
**navigator.credentials.get()メソッド [#vaec9d63]
-[[認証(Assertion)>FIDO2#dacdf419]]
**[[認証(AuthenticationでAssertion)>#ca76964e]] [#vaec9d63]
-[[navigator.credentials.get()メソッド>#d385464d]]を呼び出す。
-publicKeyオプションと併用する。
--
--[[引数:>#j169c489]]:
--[[戻り値:>#v1038525]]:
*[[仕様を読む>#wfcfd0f0]] [#gbc53e73]
*[[仕様>#wfcfd0f0]] [#gbc53e73]
**用語 [#o046d504]
**登場人物 [#k64e5e3d]
***アテステーション(Attestation) [#j082ecd2]
-[[認証器>FIDO#lf855e22]]とそれが発行するデータの出所を証明する。
-資格ID、資格鍵ペア、署名カウンタなどを含む。
***ユーザ [#b7693434]
-ユーザ同意~
ユーザが求めている内容に同意すること
-アテステーション証明書
--[[認証器>FIDO#lf855e22]]が製造と機能を証明するために使用する秘密鍵を含むX.509証明書。
-ユーザ・ハンドル
--[[依拠当事者(Relying Party)>#q93a608f]]によって識別されるユーザID
--64バイトの最大サイズを持つ不透明バイトシーケンス
--信用証明書の数を制御するために依拠当事者によって使用される。~
(ユーザ・ハンドル + [[RP ID>#q93a608f]]で信用証明書が一意に決まる)
***認証(Authentication) [#ca76964e]
***依拠当事者(Relying Party) [#q93a608f]
-Web Authentication API (別名 WebAuthn) を使用する~
Webアプリケーションで、[[RP Client>FIDO2#ad1c979d]]側と、[[RP Server>FIDO2#nff1b46f]]側がある。
-[[ユーザ>#b7693434]]の[[登録(RegistrationでAttestation)>#z6957f0b]]と[[認証(AuthenticationでAssertion)>#ca76964e]]をする。
-認証式(Authentication Ceremony)~
ユーザの存在またはユーザ確認のテスト(式典)
-Relying Party Identifier(RP ID):
--WebAuthn Relying Partyを識別する有効なドメイン文字列
--スキームにはhttpsが必要(ポート番号に制限はない)。
--FQDN名か、ドメイン接尾辞の何れかになる。~
https://login.example.com:1337なら、
---FQDN名: [login.example.com]
---ドメイン接尾辞: [example.com]
-認証アサーション(Authentication Assertion)~
authenticatorGetAssertion操作の結果として認証者によって返された、~
暗号で署名されたAuthenticatorAssertionResponseオブジェクト。
***[[認証器>FIDO#lf855e22]](Authenticator) [#ze70bbe2]
[[認証式>#ca76964e]]に従い、
-[[登録(Attestation)>FIDO2#e7f048cc]]を行うと、・・・が発行される。
-[[認証(Assertion)>FIDO2#dacdf419]]を行うと、[[認証アサーション>#ca76964e]]が発行される。
-アテステーション(Attestation)~
--[[認証器>#ze70bbe2]]製造と機能と、[[認証器>#ze70bbe2]]が発行する資格ID、資格鍵ペア、署名カウンタなどのデータを検証する作業。
--アテステーション証明書: アテステーションするために使用する秘密鍵を含むX.509証明書。
-式(Ceremony)
--[[登録式(Registration Ceremony)>#z6957f0b]]に従い、[[登録(RegistrationでAttestation)>#z6957f0b]]を行うと、・・・が発行される。
--[[認証式(Authentication Ceremony)>#ca76964e]]に従い、[[認証(AuthenticationでAssertion)>#ca76964e]]を行うと、[[認証アサーション>#ca76964e]]が発行される。
-レート制限
--ブルートフォース攻撃に対する制御を実装するプロセス。
--限度に達すると、
---指数関数的に増加する遅延を課すか、
---または現在の認証方式を無効にし、
---利用可能であれば異なる認証係数を提供する。
***クライアント [#l4e269d3]
-クライアント側~
以下を接着するすべての組み合わせ。
--クライアント・プラットフォーム
--認証プロバイダ
--およびすべて
-クライアント・プラットフォーム
--クライアント・デバイス+クライアントの組み合わせ
--単一のクライアント・デバイスが、異なるクライアントを~
実行すると異なるクライアント・プラットフォームとなる。
-(WebAuthn)クライアント
--ブラウザ実装など。
--ユーザエージェントに(全体的にまたは部分的に)実装された中間的なエンティティ
-クライアント・デバイス
--クライアントが実行されるハードウェア・デバイス
--[[認証器>FIDO#lf855e22]]は、クライアント・デバイスにバインドされる。
--[[認証器>#ze70bbe2]]は、クライアント・デバイスにバインドされる。
-WebAuthn Reelying Party~
WebアプリケーションがWeb認証APIを使用してユーザを登録および認証するエンティティ。
**用語 [#o046d504]
-[[登録(RegistrationでAttestation)>#z6957f0b]]と
-[[認証(AuthenticationでAssertion)>#ca76964e]]は
儀式であり、
この儀式では、
-[[ユーザ>#b7693434]]
-[[依拠当事者(Relying Party)>#q93a608f]]
-[[認証器(Authenticator)>#ze70bbe2]]
-[[クライアント>#l4e269d3]]
が共同した、
>[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]]
が必要になる。
***仕組み [#w66e2b42]
-Resident Credential
--秘密鍵を格納するは、[[認証器>#ze70bbe2]]に格納されている。
--[[ユーザ・ハンドル>#b7693434]] + [[RP ID>#q93a608f]]で信任秘密鍵を選択できるという特性を有する。
-Credential ID
--確率的にユニークなバイトシーケンス。
--Resident Credentialと、[[認証アサーション>#ca76964e]]を紐付ける。
***ユーザの存在またはユーザ確認のテスト(式典) [#pe519ad7]
[[登録(RegistrationでAttestation)>#z6957f0b]]と、~
[[認証(AuthenticationでAssertion)>#ca76964e]]では、~
以下のような、[[認証ジェスチャ>FIDO認証器#g701954e]]を行う。
-ユーザ存在テスト
--ユーザが[[認証器>#ze70bbe2]]と簡単に接触することによってブール結果が生成される。
--ユーザ存在テストが正常に完了すると、ユーザは「UP : User Present」と言われる。
-ユーザ検証
--authenticatorMakeCredential+authenticatorGetAssertionで行われる。
--ユーザ検証プロセスが正常に完了すると、ユーザは「UV : User Verified」と言われる。
***[[登録(RegistrationでAttestation)>FIDO2#e7f048cc]] [#z6957f0b]
-登録式(Registration Ceremony)~
--[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]]
--公開キー資格を作成し、[[ユーザ>#b7693434]]の[[依拠当事者(Relying Party)>#q93a608f]]上のアカウントに関連付ける。
***[[認証(AuthenticationでAssertion)>FIDO2#dacdf419]] [#ca76964e]
-認証式(Authentication Ceremony)~
--[[ユーザの存在またはユーザ確認のテスト(式典)>#pe519ad7]]
--[[ユーザ>#b7693434]]の[[依拠当事者(Relying Party)>#q93a608f]]上の公開キー資格で、認証アサーションの署名を検証する。
-認証アサーション(Authentication Assertion)~
authenticatorGetAssertion操作の結果として[[認証器>#ze70bbe2]]から返された、~
署名されたAuthenticatorAssertionResponseオブジェクト。
**依存 [#t0d61404]
***データ [#s8d69a88]
-Base64url encoding
--Base64ではなくBase64url
--ということは、Base64urlを使用する?
-CBOR
--オブジェクトをバイナリ・シリアライズする使用
--基礎となるデータモデルは、JSONデータモデル[RFC4627]
--参考
---The application/json Media Type for JavaScript Object Notation (JSON)~
https://www.ietf.org/rfc/rfc4627.txt
---RFC 7049 - Concise Binary Object Representation (CBOR)~
https://tools.ietf.org/html/rfc7049
-CDDL
--CBOR表記規則(CBOR [RFC7049]を表現する表記法)
--JSONデータ構造の記述にも使用できる。
--CDDLの目標
---(G1)CBORデータ構造の全体的な構造の明瞭な記述を提供する。
---(G2)自由度をCBORデータ形式で表現する柔軟性。
---(G3)必要に応じてフォーマットの選択を制限する可能性がある[_形式]。
---(G4)共通のCBORデータ型および構造を表現できること。
---(G5)人と機械が読み書き可能であること。
---(G6)データフォーマット準拠の自動チェック。
---(G7)さらなる処理のためにCBORデータから特定の要素を抽出する。
--参考
---ietf-cbor-cddl - Concise data definition language (CDDL):~
a notational convention to express CBOR and JSON data structures~
https://tools.ietf.org/html/draft-ietf-cbor-cddl
-COSE
--CBORオブジェクト署名と暗号化(COSE)[RFC8152]。
--参考
---RFC 8152 - CBOR Object Signing and Encryption (COSE)~
https://tools.ietf.org/html/rfc8152
-ArrayBuffer
--ECMAScriptによって定義されている。
--JavaScriptでバイナリを扱うために生まれた。
--画像・音声処理などで利用されている。
--参考
---JSのArrayBufferがよくわからなかったのでほんの少しだけ調べた - はらへり日記~
https://sota1235.hatenablog.com/entry/2016/05/30/145137
const buf = new ArrayBuffer(100); // メモリ空間の確保
const view = new Uint8Array(buf); // 1行めで確保されたメモリ空間へアクセスするための型付き配列
view[0] = 0x12; // bufの0番めに書き込んでいるのと同義
***その他 [#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]
-主要な引数
--Challenge
---ランダムな情報の大きなバッファー(例えば100バイト以上)が絶対に重要。
---登録過程のセキュリティを確保するためにサーバ上で生成する必要がある。
-色々なオプションが指定できる。
--Attestation Conveyance Preference enumeration~
基本的に、登録(Attestation)プロセスは、クライアントによって使用される[[認証器>FIDO#lf855e22]]が、~
基本的に、登録(Attestation)プロセスは、クライアントによって使用される[[認証器>#ze70bbe2]]が、~
FIDO2 Server([[RP Server>FIDO#ra24f089]])で信頼可能か検証するための多くのステップを費やす。
---"none"(既定値)~
ユーザ名/パスワードをFIDO2に切り替える場合。~
(FIDO2はパスワードよりも優れていると考える場合)
---"indirect"~
スマートカードまたはUAFから移行する場合、~
[[認証器>FIDO#lf855e22]]の信頼性をattestation statement から確認する必要がある。~
クライアントがattestation statement を取得する方法を決定できる。
---"direct"~
スマートカードまたはUAFから移行する場合、~
[[認証器>FIDO#lf855e22]]の信頼性をattestation statement から確認する必要がある。~
[[認証器>#ze70bbe2]]の信頼性をattestation statement から確認する必要がある。~
サーバーがattestation statement を必要とすることを示す。
-参考
--PublicKeyCredentialCreationOptions~
https://www.w3.org/TR/webauthn/#dictionary-makecredentialoptions
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;
};
***戻り値:PublicKeyCredential [#z3e54d7d]
厳密には、AuthenticatorAttestationResponse を含む PublicKeyCredential に解決する Promiseを返す。
-id(rawId) : GlobalにUniqueなPublicKeyCredentialのID
-type : public-key(このUseCaseでは固定)
-AuthenticatorAttestationResponseのプロパティ
--clientDataJSON~
[[認証器>FIDO#lf855e22]]のauthenticatorMakeCredential()メソッドの戻り値
[[認証器>#ze70bbe2]]のauthenticatorMakeCredential()メソッドの戻り値
---type
---challenge
---origin
---tokenBindingId
---clientExtensions
---authenticatorExtensions
--attestationObject~
id(rawId)に対応した、公開鍵と他の認証データ
---authenticatorData
---fmt:アテステーションステートメントの形式を示すテキスト文字列~
("packed"、 "tpm"、 "android-key"、 "android-safetynet"、 "fido-u2f"、"none")
---attStmt:"fmt"で定義された形式のアテステーションステートメント
**[[認証(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
***引数:・・・ [#j169c489]
***戻り値:・・・ [#v1038525]
*参考 [#b22f8c0c]
-[[Web Authentication API(旧)]]
-fido2-net-lib https://github.com/abergs/fido2-net-lib を分析している。~
https://gist.github.com/daisukenishino2/d50bfcfa415902abfdee0e27ed48a715
**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/
**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/
***fido2-net-lib [#re8fa185]
-abergs/fido2-net-lib: A proof of Concept implementation library~
https://github.com/abergs/fido2-net-lib
--+ demo for fido2 and WebAuthn using .NET (Work in progress)~
https://github.com/abergs/fido2-net-lib/tree/master/Fido2Demo
-WebAuthn.io~
https://fido2.azurewebsites.net/
-FIDO2 - Things I learned by building a FIDO2 server – Ideas Of Anders Åberg~
http://ideasof.andersaberg.com/development/fido2-net-library
**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
-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
-CredentialsContainer~
https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer
-PublicKeyCredential~
https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential
--PublicKeyCredentialCreationOptions~
https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredentialCreationOptions
--AuthenticatorAttestationResponse~
https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorAttestationResponse
---clientDataJSON~
-AuthenticatorResponse~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorResponse/
--clientDataJSON~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorResponse/clientDataJSON
---attestationObject~
-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
--AuthenticatorAssertionResponse.clientDataJSON
--AuthenticatorAssertionResponse.authenticatorData~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/authenticatorData
--AuthenticatorAssertionResponse.signature~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/signature
--AuthenticatorAssertionResponse.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/
***fido2-net-lib [#re8fa185]
-abergs/fido2-net-lib: A proof of Concept implementation library~
https://github.com/abergs/fido2-net-lib
--+ demo for fido2 and WebAuthn using .NET (Work in progress)~
https://github.com/abergs/fido2-net-lib/tree/master/Fido2Demo
-WebAuthn.io~
https://fido2.azurewebsites.net/
-FIDO2 - Things I learned by building a FIDO2 server – Ideas Of Anders Åberg~
http://ideasof.andersaberg.com/development/fido2-net-library
**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
**Qiita [#rff64274]
-もうすぐ来る? Web Authentication APIについて調べてみた~
https://qiita.com/syoichi/items/62e6aa66938692a3c0b6
----
Tags: [[:認証基盤]]