Share via


属性アーキテクチャ

証明書要求に属性を追加するには、次のインターフェイスを使用します。

このアーキテクチャは、PKCS #10 認定要求構文の ASN.1 モジュールで定義されています。

CertificationRequestInfo ::= SEQUENCE 
{
   version                 CertificationRequestInfoVersion,
   subject                 ANY,
   subjectPublicKeyInfo    SubjectPublicKeyInfo,
   attributes              [0] IMPLICIT Attributes
}

Attributes ::= SET OF Attribute

Attribute ::= SEQUENCE 
{
   type       EncodedObjectID,
   values     AttributeSetValue
}

ICryptAttributes コレクションは属性フィールドに対応し、コレクション内の各 ICryptAttribute オブジェクトは ASN.1 Attribute 構造体に対応します。

属性 は、オブジェクト識別子 (OID) と OID に関連付けられている 0 個以上の値で構成されます。 1 つの OID と値のペアは、 IX509Attribute インターフェイスによって表されます。 IX509Attributes コレクションを使用して ICryptAttribute オブジェクトを初期化できますが、コレクション内の各属性は同じ OID に関連付ける必要があります。 通常、属性の値は 1 つだけです。

IX509Attribute から派生した次のいずれかのインターフェイスを使用して、1 つの OID/値属性ペアを作成できます。

たとえば、次の手順は ClientId 属性を作成する方法を示しています。

ClientId 属性を作成するには

  1. IX509CertificateRequestPkcs10 または IX509CertificateRequestCmc オブジェクトから ICryptAttributes オブジェクトを取得します。
  2. IX509AttributeClientId オブジェクトを作成して初期化します。
  3. IX509Attributes コレクションを作成し、IX509AttributeClientId オブジェクトを追加します。
  4. ICryptAttribute オブジェクトを初期化するには、IX509Attributes コレクションを使用します。
  5. 手順 1 で取得したコレクションに ICryptAttribute オブジェクトを追加します。

次の例は、 ClientId 属性の ASN.1 出力を示しています。 属性には、要求が生成されたコンピューターの DNS 名 (test3d.jdomcsc.nttest.microsoft.com)、ユーザーの SAM 名 (JDOMCSC\administrator)、および要求を生成したアプリケーションの名前 (certreq) が含まれます。

0136: 30 57; SEQUENCE (57 Bytes)
0138: |  06 09                            ; OBJECT_ID (9 Bytes)
013a: |  |  2b 06 01 04 01 82 37 15  14
      |  |     ; 1.3.6.1.4.1.311.21.20 Client Information
0143: |  |  31 4a                         ; SET (4a Bytes)
0145: |  |     30 48                      ; SEQUENCE (48 Bytes)
0147: |  |        02 01                   ; INTEGER (1 Bytes)
0149: |  |        |  09
014a: |  |        0c 23                   ; UTF8_STRING (23 Bytes)
014c: |  |        |  74 65 73 74 33 64 2e 6a  64 6f 6d 63 73 63 2e 6e 
015c: |  |        |  74 74 65 73 74 2e 6d 69  63 72 6f 73 6f 66 74 2e 
016c: |  |        |  63 6f 6d                                         
      |  |        |     ; "test3d.jdomcsc.nttest.microsoft.com"
016f: |  |        0c 15                   ; UTF8_STRING (15 Bytes)
0171: |  |        |  4a 44 4f 4d 43 53 43 5c  61 64 6d 69 6e 69 73 74 
0181: |  |        |  72 61 74 6f 72                                   
      |  |        |     ; "JDOMCSC\administrator"
0186: |  |        0c 07                   ; UTF8_STRING (7 Bytes)
0188: |  |           63 65 72 74 72 65 71                             
      |  |              ; "certreq"

ICryptAttribute

ICryptAttributes

IX509Attribute

IX509Attributes