keygen 要素
4.10.14 keygen 要素
- カテゴリー
- フロー・コンテンツ
- フレージング・コンテンツ
- インタラクティブ・コンテンツ
- リスト化要素で、ラベル付け可能で、サブミット可能でリセット可能なフォーム関連要素
- この要素を使うことができるコンテキスト:
- フレージング・コンテンツが期待される場所
- コンテンツ・モデル:
- 空
- コンテンツ属性:
- グローバル属性
autofocuschallengedisabledformkeytypename- DOM インタフェース:
-
interface HTMLKeygenElement : HTMLElement { attribute boolean autofocus; attribute DOMString challenge; attribute boolean disabled; readonly attribute HTMLFormElement form; attribute DOMString keytype; attribute DOMString name; readonly attribute DOMString type; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(in DOMString error); readonly attribute NodeList labels; };
keygen 要素は、鍵ペア生成コントロールを表します。コントロールのフォームがサブミットされるとき、その秘密鍵はローカルの鍵ストアに蓄積され、公開鍵はパッケージされてサーバーに送信されます。
challenge 属性を指定することができます。その値は、サブミットされる鍵でパッケージされます。
keytype 属性は列挙属性です。次表は、この属性のキーワードと状態を一覧にしたものです。左側のカラムにあるキーワードは、そのキーワードと同じ行の 2 番目のカラムのセルに挙げた状態に対応します。ユーザーエージェントは、これらの値をサポートする必要はありませんが、自身がサポートするアルゴリズムに対応する値のみは認識しなければいけません。
| キーワード | 状態 |
|---|---|
rsa |
RSA |
妥当でない値が指定された時のデフォルトの状態は、unknown 状態です。値が指定されなかった時のデフォルトの状態は、RSA 状態をサポートしていれば、それになります。そうでなければ unknown 状態となります。
本仕様では、どのキー・タイプをユーザーエージェントがサポートすべきかまでは指定しません。ユーザーエージェントは、どのキーも一切サポートしなくても構いません。
ユーザーエージェントは、それぞれの keygen 要素ごとに対して、ユーザー・インタフェースを表示して、ユーザーがこの要素の鍵ペア生成の設定を定義できるようにすることができます。例えば、鍵長などです。
keygen 要素のリセット・アルゴリズムは、これらの各種設定情報をデフォルトに戻すことです。
この要素の値は、次のアルゴリズムから得られる文字列となります:
-
Use the appropriate step from the following list:
- If the
keytypeattribute is in the RSA state -
Generate an RSA key pair using the settings given by the user, if appropriate, using the
md5WithRSAEncryptionRSA signature algorithm (the signature algorithm with MD5 and the RSA encryption algorithm) referenced in section 2.2.1 ("RSA Signature Algorithm") of RFC 3279, and defined in RFC 2313. [RFC3279] [RFC2313] - Otherwise, the
keytypeattribute is in the unknown state -
The given key type is not supported. Return the empty string and abort this algorithm.
Let private key be the generated private key.
Let public key be the generated public key.
Let signature algorithm be the selected signature algorithm.
- If the
-
If the element has a
challengeattribute, then let challenge be that attribute's value. Otherwise, let challenge be the empty string. -
Let algorithm be an ASN.1
AlgorithmIdentifierstructure as defined by RFC 5280, with thealgorithmfield giving the ASN.1 OID used to identify signature algorithm, using the OIDs defined in section 2.2 ("Signature Algorithms") of RFC 3279, and theparametersfield set up as required by RFC 3279 forAlgorithmIdentifierstructures for that algorithm. [X690] [RFC5280] [RFC3279] -
Let spki be an ASN.1
SubjectPublicKeyInfostructure as defined by RFC 5280, with thealgorithmfield set to the algorithm structure from the previous step, and thesubjectPublicKeyfield set to the BIT STRING value resulting from ASN.1 DER encoding the public key. [X690] [RFC5280] -
Let publicKeyAndChallenge be an ASN.1
PublicKeyAndChallengestructure as defined below, with thespkifield set to the spki structure from the previous step, and thechallengefield set to the string challenge obtained earlier. [X690] -
Let signature be the BIT STRING value resulting from ASN.1 DER encoding the signature generated by applying the signature algorithm to the byte string obtained by ASN.1 DER encoding the publicKeyAndChallenge structure, using private key as the signing key. [X690]
-
Let signedPublicKeyAndChallenge be an ASN.1
SignedPublicKeyAndChallengestructure as defined below, with thepublicKeyAndChallengefield set to the publicKeyAndChallenge structure, thesignatureAlgorithmfield set to the algorithm structure, and thesignaturefield set to the BIT STRING signature from the previous step. [X690] -
Return the result of base64 encoding the result of ASN.1 DER encoding the signedPublicKeyAndChallenge structure. [RFC4648] [X690]
前述のアルゴリズムで使われる data オブジェクトは次の通りに定義されます。これらの定義は、RFC 5280 で定義されているのと同じ "ASN.1-like" 構文を使います。[RFC5280]
PublicKeyAndChallenge ::= SEQUENCE {
spki SubjectPublicKeyInfo,
challenge IA5STRING
}
SignedPublicKeyAndChallenge ::= SEQUENCE {
publicKeyAndChallenge PublicKeyAndChallenge,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING
}
制約バリデーション: keygen 要素は制約バリデーションから除外されます。
form 属性は、keygen 要素を明示的にフォーム・オーナーと関連づけるために使います。name 属性は、この要素の名前を表します。disabled 属性は、このコントロールを非インタラクティブにして、その値がサブミットされないようにするために使います。autofocus 属性はフォーカスをコントロールします。
- keygen .
type -
文字列 "
keygen" を返します。
challenge IDL
属性は、同じ名前のコンテンツ属性を反映しなければいけません。
keytype IDL 属性は、同じ名前のコンテンツ属性を反映しなければいけません。ただし、既知の値に限定されます。
type IDL
属性は、"keygen" という値を返さなければいけません。
willValidate, validity, validationMessage 属性、そして、checkValidity() と setCustomValidity() メソッドは、制約バリデーション API の一部です。labels 属性は、この要素の label のリストを提供します。autofocus, disabled, form, name IDL 属性は、この要素の forms API の一部です。
本仕様は、採用すべき秘密鍵の生成方法までは指定しません。SignedPublicKeyAndChallenge (SPKAC) 構造の受信後に、サーバーはクライアント証明書を生成し、ユーザーにダウンロードさせることが期待されます。この証明書は、ダウンロードされ、秘密鍵に対応するキー・ストアに保存されたら、TSL と証明書認証を使うサービスの認証に使うことができます。
鍵ペアを生成し、秘密鍵をユーザーのキー・ストアに追加し、その公開鍵をサーバーにサブミットするためには、次のようなマークアップを使うことができます:
<form action="processkey.cgi" method="post" enctype="multipart/form-data"> <p><keygen name="key"></p> <p><input type=submit value="Submit key..."></p> </form>
サーバーは、"key" の値として RSA 公開鍵がパッケージされたフォーム・サブミッションを受信します。これは、前述の通り、クライアント証明書の生成など、さまざまな目的に使うことができます。
※ 原文:http://www.w3.org/TR/2011/WD-html5-20110525/the-button-element.html#the-keygen-element