Arsitektur Atribut

Antarmuka berikut digunakan untuk menambahkan atribut ke permintaan sertifikat:

Arsitektur berikut yang didefinisikan dalam modul ASN.1 dari sintaks permintaan sertifikasi PKCS #10.

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

Attributes ::= SET OF Attribute

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

Koleksi ICryptAttributes sesuai dengan bidang atribut , dan setiap objek ICryptAttribute dalam koleksi sesuai dengan struktur Atribut ASN.1.

Setiap Atribut terdiri dari pengidentifikasi objek (OID) dan nol atau lebih nilai yang terkait dengan OID. Pasangan nilai OID tunggal diwakili oleh antarmuka IX509Attribute . Anda dapat menggunakan koleksi IX509Attributes untuk menginisialisasi objek ICryptAttribute , tetapi setiap atribut dalam koleksi harus dikaitkan dengan OID yang sama. Biasanya, atribut hanya memiliki satu nilai.

Anda dapat menggunakan salah satu antarmuka berikut, yang berasal dari IX509Attribute, untuk membuat satu pasangan atribut OID/nilai:

Misalnya, prosedur berikut menunjukkan cara membuat atribut ClientId .

Untuk membuat atribut ClientId

  1. Ambil objek ICryptAttributes dari objek IX509CertificateRequestPkcs10 atau IX509CertificateRequestCmc .
  2. Membuat dan menginisialisasi objek IX509AttributeClientId .
  3. Buat koleksi IX509Attributes dan tambahkan objek IX509AttributeClientId .
  4. Gunakan koleksi IX509Attributes untuk menginisialisasi objek ICryptAttribute .
  5. Tambahkan objek ICryptAttribute ke koleksi yang diambil di langkah 1.

Contoh berikut menunjukkan output ASN.1 dari atribut ClientId . Atribut berisi nama DNS komputer tempat permintaan dibuat (test3d.jdomcsc.nttest.microsoft.com), nama SAM pengguna (JDOMCSC\administrator), dan nama aplikasi yang menghasilkan permintaan (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