マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。

目次

概要

  • Web Authentication API (WebAuthn?) は
    • FIDO2 の Web Application用 JavaScript Library。
    • 公開鍵暗号を用た認証を行う Credential Management API の拡張機能
    • パスワードを用いない認証に加え、SMS を用いない二要素認証を実現する。

詳細

  • セキュアコンテキスト (https or localhost)であることを必要とし、
    ブラウザがセキュアコンテキストで動作していない場合は利用できない。

登録(RegistrationでAttestation)

認証(AuthenticationでAssertion)

仕様

登場人物

ユーザ

依拠当事者(Relying Party)

  • Relying Party Identifier(RP ID):
    • WebAuthn? Relying Partyを識別する有効なドメイン文字列
    • スキームにはhttpsが必要(ポート番号に制限はない)。
    • FQDN名か、ドメイン接尾辞の何れかになる。
      https://login.example.com:1337なら、
      • FQDN名: [login.example.com]
      • ドメイン接尾辞: [example.com]

認証器(Authenticator)

  • 認証器アテステーション(Authenticator Attestation)
    • 認証器のデータを検証する作業。
    • アテステーション証明書: アテステーションするために使用する秘密鍵を含むX.509証明書。
  • 式(Ceremony)
  • レート制限
    • ブルートフォース攻撃に対する制御を実装するプロセス。
    • 限度に達すると、
      • 指数関数的に増加する遅延を課すか、
      • または現在の認証方式を無効にし、
      • 利用可能であれば異なる認証係数を提供する。

クライアント

  • ブラウザ実装など。
  • ユーザエージェントに(全体的にまたは部分的に)実装された中間的なエンティティ

仕組み

儀式であり、

この儀式では、

が共同した、

ユーザの存在またはユーザ確認のテスト(式典)

が必要になる。

各種鍵(Credential)

ユーザの存在またはユーザ確認のテスト(式典)

登録(RegistrationでAttestation)と、
認証(AuthenticationでAssertion)では、
以下のような、存在 vs 認証を行う。

  • ユーザ存在テスト
    • ユーザが認証器と簡単に接触することによってブール結果が生成される。
    • ユーザ存在テストが正常に完了すると、ユーザは「UP: User Present」と言われる。
  • ユーザ検証
    • authenticatorMakeCredential? + authenticatorGetAssertion?で行われる。
    • ユーザ検証プロセスが正常に完了すると、ユーザは「UV: User Verified」と言われる。

登録(RegistrationでAttestation)

認証(AuthenticationでAssertion)

依存

データ

その他

  • HTML
  • DOM
  • ECMAScript
  • Web IDL: Webブラウザーで実装するためのAPIを記述するためのIDL
  • FIDO AppID:
    呼び出し元アプリケーションのFacetIDを決定し、呼び出し元のFacetIDが
    AppIDに対して許可されているかどうかを判断するアルゴリズムを定義する。

Credential Management API

登録(Attestation): navigator.credentials.create()メソッド

内部で、authenticatorMakeCredential?を呼び出す。

引数:PublicKeyCredentialCreationOptions?

  • 主要な引数
    • rp
  • 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から移行する場合、
    認証器の信頼性をattestation statement から確認する必要がある。
    クライアントがattestation statement を取得する方法を決定できる。
  • "direct"
    スマートカードまたはUAFから移行する場合、
    認証器の信頼性を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?

厳密には、PublicKeyCredential?.responseに、
AuthenticatorResponse? <- AuthenticatorAttestationResponse? を含む、
PublicKeyCredential? に解決する Promiseを返す。

  • id(rawId): GlobalにUniqueなPublicKeyCredential?のID(credentialId)
  • type: public-key(このUseCase?では固定)
  • AuthenticatorAttestationResponse?のプロパティ
  • clientDataJSON: ArrayBuffer?型、読み取り専用
    • AuthenticatorResponse?から継承
    • 認証器のauthenticatorMakeCredential?()メソッドの戻り値
  • attestationObject: ArrayBuffer?型、読み取り専用
    id(rawId) = PublicKeyCredential?のID(credentialId)に対応した、公開鍵と他の認証データ
  • fmt:アテステーションステートメントの形式を示すテキスト文字列
    ("packed"、 "tpm"、 "android-key"、 "android-safetynet"、 "fido-u2f"、"none")
  • attStmt:"fmt"で定義された形式のアテステーションステートメント

認証(Assertion): navigator.credentials.get()メソッド

内部で、authenticatorGetAssertion?を呼び出す。

引数:PublicKeyCredentialRequestOptions?

  • 主要な引数
  • challenge
    • ランダムな情報の大きなバッファー(例えば100バイト以上)が絶対に重要。
    • 登録過程のセキュリティを確保するためにサーバ上で生成する必要がある。
  • timeout
  • rpId
  • allowCredentials
    • type:"public-key"
    • id:id(rawId) = PublicKeyCredential?のID(credentialId)
    • transports: [] (通信のヒントらしいが、空の配列が指定されている)
  • userVerification
    ユーザー検証要件の列挙型
    • "required"
    • "preferred"
    • "discouraged"

戻り値:AuthenticatorAssertionResponse?

厳密には、PublicKeyCredential?.responseに、
AuthenticatorResponse? <- AuthenticatorAssertionResponse? を含む、
PublicKeyCredential? に解決する Promiseを返す。

  • id(rawId): GlobalにUniqueなPublicKeyCredential?のID(credentialId)
  • type: public-key(このUseCase?では固定)
  • AuthenticatorAssertionResponse?のプロパティ
  • clientDataJSON: ArrayBuffer?型、読み取り専用
    • AuthenticatorResponse?から継承
    • 認証器のauthenticatorGetAssertion?()メソッドの戻り値
  • authenticatorData: ArrayBuffer?型、読み取り専用
  • signature: ArrayBuffer?型、読み取り専用
  • userHandle: ArrayBuffer?型、読み取り専用、nullable

参考

w3c

MDN - Web APIs

Credential Management API

Web Authentication API

Credential Management API中のPublicKeyCredential?を拡張したもの。

webauthn.org

OAuth0

仕組みをアニメーションで解り易く説明している。

Yubico

blog.jxck.io

enjoy struggling

(株)ソフト技研

ritou

Speaker Deck

r-weblife

Qiita

enjoy struggling

  • WebAuthn? もくもく会を開催しました

ライブラリ

fido2-net-lib

.NET standard の Web Authentication API対応ライブラリ。

WebAuthn4J

Java の Web Authentication API対応ライブラリ。
(日本のコミュニティが開発をしている)

内部リンク

Web Authentication API(旧)

WebAuthnを実装する。


Tags: :IT国際標準, :認証基盤


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019-05-18 (土) 15:05:01 (1795d)