สร้างใบรับรองการทดสอบอุปกรณ์ Matter

สถานการณ์การทดสอบบางกรณีจำเป็นต้องมีการสร้างใบรับรองที่ไม่ได้อยู่ในเวอร์ชันที่ใช้งานจริง แม้จะไม่ใช่ข้อกำหนดก็ตาม

ฟีเจอร์บางอย่างในระบบนิเวศของ Google ซึ่งรวมถึงการอัปเดตซอฟต์แวร์ OTA ของอุปกรณ์ดำเนินการโดยใช้ VID/PID การทดสอบไม่ได้

คู่มือนี้อธิบายวิธีสร้างและยืนยันใบรับรอง Matter ที่ไม่ใช่เวอร์ชันที่ใช้งานจริงเพื่อใช้ในการทดสอบ ประเภทของใบรับรองมีดังนี้

  1. ประกาศการรับรอง (CD)
  2. ใบรับรองกลางในเอกสารรับรองผลิตภัณฑ์ (PAI)
  3. ใบรับรองเอกสารรับรองอุปกรณ์ (DAC)

ในกระบวนการจัดเตรียม อุปกรณ์ที่ผ่านการรับรอง Matter จะต้องรับรองตนเอง กล่าวคือ พิสูจน์ว่าเป็นผลิตภัณฑ์ที่ผ่านการรับรองจาก Matter ของแท้ ข้อมูลเข้าสู่ระบบที่ใช้โดยอุปกรณ์ Matter ในเอกสารรับรองประกอบด้วยข้อมูลต่อไปนี้

  1. คู่คีย์เอกสารรับรอง
  2. ชุดใบรับรอง

ใบรับรองอุปกรณ์ (DAC) เป็นลิงก์แรกของเชนใบรับรองและมีการตรวจสอบโดยใบรับรองกลางของเอกสารรับรองผลิตภัณฑ์ (Product Attestation Intermediate Certificate หรือ PAI) ซึ่งก็คือการตรวจสอบโดยหน่วยงานเอกสารรับรองผลิตภัณฑ์ (PAA)

ใบรับรองจะลงชื่อพร้อมกับที่มีการสร้างคู่คีย์เอกสารรับรองและลงนามโดยใช้คีย์ส่วนตัวของผู้ออกใบรับรองข้างต้นที่ 1 ระดับ ซึ่งกลายเป็นห่วงโซ่ความน่าเชื่อถือ ดังนั้น ใบรับรอง DAC จะลงนามโดยคีย์ PAI และใบรับรอง PAI จะลงนามด้วยคีย์ PAA ใบรับรอง PAA ถือเป็นใบรับรองชั้นแนวหน้าของเชนธุรกิจ โดยใช้การลงนามด้วยตนเอง เชนความน่าเชื่อถือนี้สร้างโครงสร้าง PAA แบบรวมศูนย์ซึ่งซิงค์โดย Distributed Compliance Ledger (DCL)

ดูข้อมูลเพิ่มเติมเกี่ยวกับกระบวนการรับรองและประกาศการรับรอง (CD) ได้ในเอกสารและข้อความเอกสารรับรองเพิ่มเติม รวมถึงในข้อกำหนดของ Matter

ติดตั้ง Matter SDK

วิธีการเหล่านี้จะสมมติว่าคุณติดตั้ง SDK ของ Matter ที่ใช้งานอยู่ โปรดดูเอกสารประกอบใน GitHub หรือดูข้อมูลเพิ่มเติมได้ที่เริ่มต้นใช้งาน Matter

ติดตั้งยูทิลิตี Hexdump xxd หากคุณไม่มี เครื่องมือนี้มีประโยชน์ในการพิมพ์ข้อมูลเข้าสู่ระบบในรูปแบบรูป C ดังนี้

sudo apt-get install xxd

บิลด์ chip-cert

  1. ตรวจสอบว่าคุณใช้ SDK เวอร์ชันล่าสุดอยู่ ขั้นตอนเหล่านี้ได้รับการทดสอบใน SHA 0b17bce8 ของ GitHub ในสาขา v1.0-branch

    $ cd connectedhomeip
    $ git checkout v1.0-branch
    $ git pull
    
  2. บิลด์ chip-cert ซึ่งเป็นเครื่องมือที่ใช้สำหรับการดำเนินการหลายรายการเกี่ยวกับข้อมูลเข้าสู่ระบบสำหรับอุปกรณ์ Matter

    1. กำหนดค่าบิลด์ดังนี้

      $ cd src/credentials
      $ source ../../scripts/activate.sh
      $ gn gen out
      

      ตัวอย่างเอาต์พุต gn

      Done. Made 5774 targets from 289 files in 658ms
      
    2. เรียกใช้บิลด์:

      $ ninja -C out
      

      ตัวอย่างเอาต์พุต ninja

      ninja: Entering directory `out'
      [2000/2000] stamp obj/default.stamp
      

สร้างใบรับรอง

ส่งออก VID/PID ที่กำหนดเองเป็นตัวแปรสภาพแวดล้อมเพื่อลดความเสี่ยงที่จะเกิดข้อผิดพลาดทางเสมียนเมื่อแก้ไขอาร์กิวเมนต์คำสั่ง ดังนี้

$ cd ../..
$ export VID=hexVendorId
$ export PID=hexProductId

สร้างซีดี

  1. สร้างซีดีโดยใช้ chip-cert ขณะนี้คณะกรรมาธิการจะตรวจสอบเพียงว่า VID และ PID ตรงกับข้อมูลที่เปิดเผยที่อื่นของอุปกรณ์หรือไม่ ซึ่งได้แก่ คลัสเตอร์ข้อมูลพื้นฐาน, DAC และต้นทางของ DAC (เมื่อมี) คุณอาจปล่อยช่องอื่นๆ ไว้ตามเดิม

    $ src/credentials/out/chip-cert gen-cd \
      --key credentials/test/certification-declaration/Chip-Test-CD-Signing-Key.pem \
      --cert credentials/test/certification-declaration/Chip-Test-CD-Signing-Cert.pem \
      --out credentials/test/certification-declaration/Chip-Test-CD-${VID}-${PID}.der \
      --format-version "1" \
      --vendor-id "${VID}" \
      --product-id "${PID}" \
      --device-type-id "0x1234" \
      --certificate-id "ZIG20141ZB330001-24" \
      --security-level "0" \
      --security-info "0" \
      --version-number "9876" \
      --certification-type "0"
    
  2. ตรวจสอบซีดี ตรวจสอบว่าเอกสารมี VID/PID (ในรูปแบบทศนิยม) ดังนี้

    $ src/credentials/out/chip-cert print-cd credentials/test/certification-declaration/Chip-Test-CD-${VID}-${PID}.der
    

    ตัวอย่างเอาต์พุต:

    SignerKeyId value: hex:62FA823359ACFAA9963E1CFA140ADDF504F37160
    0x01, tag[Anonymous]: 0xffffffff, type: Structure (0x15), container:
    0x04,     tag[Context Specific]: 0x0, type: Unsigned Fixed Point (0x04), value: 1
    0x08,     tag[Context Specific]: 0x1, type: Unsigned Fixed Point (0x04), value: XXXXX // <- VID
    0x0A,     tag[Context Specific]: 0x2, type: Array (0x16), container:
    0x0D,         tag[Anonymous]: 0xffffffff, type: Unsigned Fixed Point (0x04), value: XXXXX // <- PID
    0x12,     tag[Context Specific]: 0x3, type: Unsigned Fixed Point (0x04), value: 4660
    0x15,     tag[Context Specific]: 0x4, type: UTF-8 String (0x0c), length: 19, value: "ZIG20141ZB330001-24"
    0x2B,     tag[Context Specific]: 0x5, type: Unsigned Fixed Point (0x04), value: 0
    0x2E,     tag[Context Specific]: 0x6,type: Unsigned Fixed Point (0x04), value: 0
    0x32,     tag[Context Specific]: 0x7, type: Unsigned Fixed Point (0x04), value: 39030
    0x35,     tag[Context Specific]: 0x8, type: Unsigned Fixed Point (0x04), value: 0
    

สร้าง PAI และ DAC

ในตัวอย่างนี้ เราจะใช้ใบรับรอง Product Attestation Authority (PAA) และคีย์การลงนาม Chip-Test-PAA-NoVID ของ Matter เป็นใบรับรองรูทของเรา เราจะใช้เป็น CA รากในการสร้าง PAI และ DAC ของเราเอง

  1. สร้าง PAI โดยใช้ PAA คุณอาจรวมข้อมูล PID ไว้ใน PAI ด้วยก็ได้ แต่การไม่ระบุข้อมูลดังกล่าวจะช่วยให้การทดสอบมีความยืดหยุ่นมากขึ้น หากคุณจำเป็นต้องใช้ DAC สำหรับ PID เพิ่มเติม ให้ทำตามขั้นตอนการสร้าง DAC เท่านั้น ดังนี้

    $ src/credentials/out/chip-cert gen-att-cert --type i \
      --subject-cn "Matter Test PAI" \
      --subject-vid "${VID}" \
      --valid-from "2021-06-28 14:23:43" \
      --lifetime "4294967295" \
      --ca-key credentials/test/attestation/Chip-Test-PAA-NoVID-Key.pem \
      --ca-cert credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.pem \
      --out-key credentials/test/attestation/"test-PAI-${VID}-key".pem \
      --out credentials/test/attestation/"test-PAI-${VID}-cert".pem
    
  2. สร้าง DAC โดยใช้ PAI:

    $ src/credentials/out/chip-cert gen-att-cert --type d \
      --subject-cn "Matter Test DAC 0" \
      --subject-vid "${VID}" \
      --subject-pid "${PID}" \
      --valid-from "2021-06-28 14:23:43" \
      --lifetime "4294967295" \
      --ca-key credentials/test/attestation/"test-PAI-${VID}-key".pem \
      --ca-cert credentials/test/attestation/"test-PAI-${VID}-cert".pem \
      --out-key credentials/test/attestation/"test-DAC-${VID}-${PID}-key".pem \
      --out credentials/test/attestation/"test-DAC-${VID}-${PID}-cert".pem
    
  3. ยืนยันเชน DAC, PAI และ PAA หากไม่มีข้อผิดพลาดปรากฏในเอาต์พุต หมายความว่าชุดเอกสารรับรองใบรับรองได้รับการยืนยันเรียบร้อยแล้ว

    $ src/credentials/out/chip-cert validate-att-cert \
    --dac credentials/test/attestation/"test-DAC-${VID}-${PID}-cert".pem \
    --pai credentials/test/attestation/"test-PAI-${VID}-cert".pem \
    --paa credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.pem
    
  4. คุณสามารถตรวจสอบคีย์ได้โดยใช้ openssl โดยทำดังนี้

    $ openssl ec -noout -text -in \
      credentials/test/attestation/test-DAC-${VID}-${PID}-key.pem
    

    ตัวอย่างเอาต์พุต:

    read EC key
    Private-Key: (256 bit)
    priv:
        c9:f2:b3:04:b2:db:0d:6f:cd:c6:be:f3:7b:76:8d:
        8c:01:4e:0b:9e:ce:3e:72:49:3c:0e:35:63:7c:6c:
        6c:d6
    pub:
        04:4f:93:ba:3b:bf:63:90:73:98:76:1e:af:87:79:
        11:e6:77:e8:e2:df:a7:49:f1:7c:ac:a8:a6:91:76:
        08:5b:39:ce:6c:72:db:6d:9a:92:b3:ba:05:b0:e8:
        31:a0:bf:36:50:2b:5c:72:55:7f:11:c8:01:ff:3a:
        46:b9:19:60:28
    ASN1 OID: prime256v1
    NIST CURVE: P-256
    
  5. คุณยังใช้ openssl เพื่อตรวจสอบใบรับรองที่สร้างขึ้นได้ด้วย โดยทำดังนี้

    $ openssl x509 -noout -text -in \
      credentials/test/attestation/test-DAC-${VID}-${PID}-cert.pem
    

    ตัวอย่างเอาต์พุต:

    Certificate:
        Data:
            Version: 3 (0x2)
            Serial Number: 2875998130766646679 (0x27e9990fef088d97)
            Signature Algorithm: ecdsa-with-SHA256
            Issuer: CN = Matter Test PAI, 1.3.6.1.4.1.37244.2.1 = hexVendorId
            Validity
                Not Before: Jun 28 14:23:43 2021 GMT
                Not After : Dec 31 23:59:59 9999 GMT
            Subject: CN = Matter Test DAC 0, 1.3.6.1.4.1.37244.2.1 = hexVendorId, 1.3.6.1.4.1.37244.2.2 = hexProductId
            Subject Public Key Info:
                Public Key Algorithm: id-ecPublicKey
                    Public-Key: (256 bit)
                    pub:
                        04:4f:93:ba:3b:bf:63:90:73:98:76:1e:af:87:79:
                        11:e6:77:e8:e2:df:a7:49:f1:7c:ac:a8:a6:91:76:
                        08:5b:39:ce:6c:72:db:6d:9a:92:b3:ba:05:b0:e8:
                        31:a0:bf:36:50:2b:5c:72:55:7f:11:c8:01:ff:3a:
                        46:b9:19:60:28
                    ASN1 OID: prime256v1
                    NIST CURVE: P-256
            X509v3 extensions:
                X509v3 Basic Constraints: critical
                    CA:FALSE
                X509v3 Key Usage: critical
                    Digital Signature
                X509v3 Subject Key Identifier:
                    21:0A:CA:B1:B6:5F:17:65:D8:61:19:73:84:1A:9D:52:81:19:C5:39
                X509v3 Authority Key Identifier:
                    37:7F:24:9A:73:41:4B:16:6E:6A:42:6E:F5:E8:89:FB:75:F8:77:BB
        Signature Algorithm: ecdsa-with-SHA256
        Signature Value:
            30:45:02:20:38:8f:c5:0d:3e:90:95:dd:7d:7c:e9:5a:05:19:
            1f:2d:14:08:a3:d7:0e:b5:15:6d:d3:b0:0b:f7:b8:28:4d:bf:
            02:21:00:d4:05:30:43:a6:05:00:0e:b9:99:0d:34:3d:75:fe:
            d3:c1:4e:73:ff:e7:05:64:7a:62:8d:2d:38:8f:fd:4d:ad
    

PAA

คุณอาจใช้กระบวนการที่คล้ายกันนี้เพื่อสร้าง PAA ที่ลงชื่อด้วยตนเอง แต่การดำเนินการดังกล่าวไม่จำเป็น

แต่สิ่งที่เราทำที่นี่คือการใช้ PAA สำหรับการพัฒนาแบบ Self-Signed ที่มีอยู่ ซึ่งไม่มีข้อมูล VID

ดูตัวอย่างเพิ่มเติมของการสร้างซีดีได้ที่ credentials/test/gen-test-cds.sh และดูตัวอย่างเพิ่มเติมเกี่ยวกับการสร้าง PAA, PAI และ DAC ได้ที่ credentials/test/gen-test-attestation-certs.sh

แทนที่ใบรับรอง

แทนที่ PAA และ PAI

  1. เรียกใช้สคริปต์ตัวช่วยต่อไปนี้ ซึ่งใช้เครื่องมือใบรับรอง CHIP (chip-cert) เพื่อสร้างอาร์เรย์รูปแบบ C ของใบรับรอง

ดาวน์โหลดสคริปต์ตัวช่วยของใบรับรองที่ฝังได้

#!/bin/bash

#
# generate-embeddable-certs.sh script
# —----------------------------------
#
# This script generates self-minted DAC and PAI.
# The output may easily be included in your C++ source code.
#

# Edit this information with your paths and certificates
folder="credentials/test/attestation"
chip_cert_tool="src/credentials/out/chip-cert"
cert_file_der="${folder}/test-PAI-${VID}-cert.der"
cert_file_pem="${folder}/test-PAI-${VID}-cert.pem"
key_file_pem="${folder}/test-PAI-${VID}-key.pem"

type="Pai"

printf "namespace chip {\n"
printf "namespace DevelopmentCerts {\n\n"
printf "#if CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID == ${PID}\n\n"

printcert() {
  # convert cert to DER
  if [ -f "${cert_file_der}" ]; then
      rm "${cert_file_der}"
  fi
  "${chip_cert_tool}" convert-cert "${cert_file_pem}" "${cert_file_der}" --x509-der

  printf "// ------------------------------------------------------------ \n"
  printf "// ${type} CERTIFICATE ${cert_file_der} \n\n"

  printf "constexpr uint8_t ${type}_Cert_Array[] = {\n"
  less -f "${cert_file_der}" | od -t x1 -An | sed 's/\/,/g' | sed 's/^/   /g'
  printf "};\n\n"
  printf "ByteSpan k${type}Cert = ByteSpan(${type}_Cert_Array);\n\n"

  printf "// ${type} PUBLIC KEY FROM ${key_file_pem} \n\n"

  printf "constexpr uint8_t ${type}_PublicKey_Array[] = {\n"
  openssl ec -text -noout -in "${key_file_pem}" 2>/dev/null | sed '/ASN1 OID/d' | sed '/NIST CURVE/d' | sed -n '/pub:/,$p' | sed '/pub:/d' | sed 's/\([0-9a-fA-F][0-9a-fA-F]\)/0x\1/g' | sed 's/:/, /g'
  printf "};\n\n"
  printf "ByteSpan k${type}PublicKey = ByteSpan(${type}_PublicKey_Array);\n\n"

  printf "// ${type} PRIVATE KEY FROM ${key_file_pem} \n\n"

  printf "constexpr uint8_t ${type}_PrivateKey_Array[] = {\n"
  openssl ec -text -noout -in "${key_file_pem}" 2>/dev/null | sed '/read EC key/d' | sed '/Private-Key/d' | sed '/priv:/d' | sed '/pub:/,$d' | sed 's/\([0-9a-fA-F][0-9a-fA-F]\)/0x\1/g' | sed 's/:/, /g'
  printf "};\n\n"
  printf "ByteSpan k${type}PrivateKey = ByteSpan(${type}_PrivateKey_Array);\n\n"
}

# generates PAI
printcert

type="Dac"
cert_file_der="${folder}/test-DAC-${VID}-${PID}-cert.der"
cert_file_pem="${folder}/test-DAC-${VID}-${PID}-cert.pem"
key_file_pem="${folder}/test-DAC-${VID}-${PID}-key.pem"

# generates DAC
printcert

printf "#endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID\n"
printf "} // namespace DevelopmentCerts\n"
printf "} // namespace chip\n"


  1. คัดลอกเนื้อหาของเอาต์พุต PAI และ DAC ไปยังการใช้งาน DeviceAttestationCredentialsProvider::GetProductAttestationIntermediateCert

    PAI และ DAC อยู่ในข้อมูลโรงงานในอุปกรณ์เวอร์ชันที่ใช้งานจริง ในขณะที่ซีดีฝังอยู่ในเฟิร์มแวร์

    1. หากยังไม่ได้ใช้ข้อมูลเริ่มต้น คุณอาจต้องวาง PAI ใน src/credentials/examples/ExampleDACs.cpp ในกรณีนี้ ให้ใส่โค้ดที่สร้างขึ้นต่อท้ายไฟล์ ExampleDACs.cpp

      ByteSpan kDacCert       = ByteSpan(kDevelopmentDAC_Cert_FFF1_801F);
      ByteSpan kDacPrivateKey = ByteSpan(kDevelopmentDAC_PrivateKey_FFF1_801F);
      ByteSpan kDacPublicKey  = ByteSpan(kDevelopmentDAC_PublicKey_FFF1_801F);
      #endif
      } // namespace DevelopmentCerts
      } // namespace chip
      
      /* ------------------------------------------ */
      /* current end-of-file                        */
      /* ------------------------------------------ */
      
      /* ------------------------------------------ */
      /* output of creds-codelab.sh script          */
      /* ------------------------------------------ */
      
      namespace chip {
      namespace DevelopmentCerts {
      
      #if CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID == hexProductId
      
      ...
      
      ByteSpan kDacPrivateKey = ByteSpan(Dac_PrivateKey_Array);
      
      #endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
      } // namespace DevelopmentCerts
      } // namespace chip
      
    2. หากคุณใช้ข้อมูลเริ่มต้นหรือผู้ให้บริการข้อมูลเข้าสู่ระบบที่กำหนดเอง โปรดตรวจสอบว่าได้แทรกข้อมูลเข้าสู่ระบบไว้ในตำแหน่งที่เหมาะสมแล้ว เราขอแนะนำให้คุณตรวจสอบกับผู้ให้บริการ SoC ของคุณเกี่ยวกับข้อมูลเฉพาะของแพลตฟอร์ม

เปลี่ยนซีดี

  1. ดึงการนำเสนอข้อความเนื้อหาของไฟล์ซีดีโดยใช้ xxd:

      $ xxd -i credentials/test/certification-declaration/Chip-Test-CD-${VID}-${PID}.der
    

    ตัวอย่างเอาต์พุต:

      unsigned char credentials_test_certification_declaration_Chip_Test_CD_hexVendorId_hexProductId_der[] = {
        0x30, 0x81, 0xe9, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
        0x07, 0x02, 0xa0, 0x81, 0xdb, 0x30, 0x81, 0xd8, 0x02, 0x01, 0x03, 0x31,
        0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04,
        0x02, 0x01, 0x30, 0x45, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
        0x01, 0x07, 0x01, 0xa0, 0x38, 0x04, 0x36, 0x15, 0x24, 0x00, 0x01, 0x25,
        0x01, 0xfe, 0xca, 0x36, 0x02, 0x05, 0xce, 0xfa, 0x18, 0x25, 0x03, 0x34,
        0x12, 0x2c, 0x04, 0x13, 0x5a, 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x31,
        0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x31, 0x2d, 0x32, 0x34, 0x24,
        0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x76, 0x98, 0x24, 0x08, 0x00,
        0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, 0x01, 0x03, 0x80, 0x14, 0x62, 0xfa,
        0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a,
        0xdd, 0xf5, 0x04, 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86,
        0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0a, 0x06, 0x08, 0x2a,
        0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02,
        0x20, 0x53, 0x25, 0x03, 0x2c, 0x96, 0x50, 0xb6, 0x64, 0xf4, 0x18, 0xbf,
        0x99, 0x47, 0xf8, 0x9d, 0xe6, 0xeb, 0x43, 0x94, 0xf1, 0xce, 0xb2, 0x61,
        0x00, 0xe0, 0xf9, 0x89, 0xa8, 0x71, 0x82, 0x02, 0x0a, 0x02, 0x21, 0x00,
        0xea, 0x0a, 0x40, 0xab, 0x87, 0xad, 0x7e, 0x25, 0xe1, 0xa1, 0x6c, 0xb1,
        0x12, 0xfa, 0x86, 0xfe, 0xea, 0x8a, 0xaf, 0x4b, 0xc1, 0xf3, 0x6f, 0x09,
        0x85, 0x46, 0x50, 0xb6, 0xd0, 0x55, 0x40, 0xe2
      };
      unsigned int credentials_test_certification_declaration_Chip_Test_CD_hexVendorId_hexProductId_der_len = 236;
      ```
    
  2. คัดลอกข้อความที่แยกออกมาในขั้นตอนก่อนหน้าไปยังไฟล์ที่ใช้กำหนด CD ลงในบิลด์ ในกรณีของ PAI และ DAC วิธีดำเนินการจะขึ้นอยู่กับแพลตฟอร์มที่คุณกำลังพัฒนา

หากใช้ตัวอย่างข้อมูลเข้าสู่ระบบ คุณอาจต้องแทนที่เนื้อหาของ kCdForAllExamples ใน ExampleDACProvider::GetCertificationDeclaration ใน src/credentials/examples/DeviceAttestationCredsExample.cpp

    const uint8_t kCdForAllExamples[] = {
            0x30, 0x81, 0xe9, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
            0x07, 0x02, 0xa0, 0x81, 0xdb, 0x30, 0x81, 0xd8, 0x02, 0x01, 0x03, 0x31,
            0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04,
            0x02, 0x01, 0x30, 0x45, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
            0x01, 0x07, 0x01, 0xa0, 0x38, 0x04, 0x36, 0x15, 0x24, 0x00, 0x01, 0x25,
            0x01, 0xfe, 0xca, 0x36, 0x02, 0x05, 0xce, 0xfa, 0x18, 0x25, 0x03, 0x34,
            0x12, 0x2c, 0x04, 0x13, 0x5a, 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x31,
            0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x31, 0x2d, 0x32, 0x34, 0x24,
            0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x76, 0x98, 0x24, 0x08, 0x00,
            0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, 0x01, 0x03, 0x80, 0x14, 0x62, 0xfa,
            0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a,
            0xdd, 0xf5, 0x04, 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86,
            0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0a, 0x06, 0x08, 0x2a,
            0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02,
            0x20, 0x53, 0x25, 0x03, 0x2c, 0x96, 0x50, 0xb6, 0x64, 0xf4, 0x18, 0xbf,
            0x99, 0x47, 0xf8, 0x9d, 0xe6, 0xeb, 0x43, 0x94, 0xf1, 0xce, 0xb2, 0x61,
            0x00, 0xe0, 0xf9, 0x89, 0xa8, 0x71, 0x82, 0x02, 0x0a, 0x02, 0x21, 0x00,
            0xea, 0x0a, 0x40, 0xab, 0x87, 0xad, 0x7e, 0x25, 0xe1, 0xa1, 0x6c, 0xb1,
            0x12, 0xfa, 0x86, 0xfe, 0xea, 0x8a, 0xaf, 0x4b, 0xc1, 0xf3, 0x6f, 0x09,
            0x85, 0x46, 0x50, 0xb6, 0xd0, 0x55, 0x40, 0xe2
        };

สร้างเป้าหมาย

สร้างและแฟลชเป้าหมายโดยใช้ข้อมูลเข้าสู่ระบบที่สร้างใหม่ ส่วนนี้ขึ้นอยู่กับแพลตฟอร์ม ดูข้อมูลเพิ่มเติมในเอกสารประกอบ SoC หรืออุปกรณ์ที่รองรับ

ค่าคอมมิชชันอุปกรณ์

ตอนนี้คุณสามารถทำตามขั้นตอนที่ระบุไว้ในหัวข้อจับคู่อุปกรณ์ Matter เพื่อค่าคอมมิชชันอุปกรณ์ Matter ใน Google Home platform ได้แล้ว

แก้ไขข้อบกพร่องโดยใช้ chip-tool

chip-tool เป็นเครื่องมือที่มีประโยชน์ในการตรวจสอบว่าอุปกรณ์ส่งใบรับรองที่ถูกต้องหรือไม่ วิธีสร้าง

$ cd examples/chip-tool
$ gn gen out/debug
Done. Made 114 targets from 112 files in 157ms
$ ninja -C out/debug
ninja: Entering directory `out/debug'
$ cd ../..

หากต้องการเปิดใช้บันทึกเพิ่มเติม เมื่อใดก็ตามที่เรียกใช้ chip-tool ให้ตรวจสอบว่าได้ส่ง Flag --trace_decode 1 แล้ว นอกจากนี้ คุณควรส่งเส้นทางของไฟล์ PAA ด้วย Flag --paa-trust-store-path

หากต้องการให้อุปกรณ์เทรดโดยใช้ BLE คุณสามารถเรียกใช้สิ่งต่อไปนี้ได้

```
$ examples/chip-tool/out/debug/chip-tool pairing ble-thread 1 \
  hex:Thread_credentials \
  pairing_code \
  discriminator \
  --paa-trust-store-path <path to PAA folder> \
  --trace_decode 1
```

ในกรณีของอุปกรณ์ทดสอบ <PAIRING CODE> คือ 20202021 และ <DISCRIMINATOR> คือ 3840

หากต้องการรับข้อมูลเข้าสู่ระบบเทรดจาก Google Nest Hub (2nd gen) คุณอาจเรียกใช้สิ่งต่อไปนี้

$ adb connect border_router_ip_address
$ adb -e shell ot-ctl dataset active -x
$ adb disconnect

และหากต้องการจัดเตรียมอุปกรณ์ Wi-Fi คุณก็ใช้ตัวเลือก ble-wifi ได้ ดังนี้

$ examples/chip-tool/out/debug/chip-tool pairing ble-wifi 1 "SSID" SSID_password pairing_code discriminator