Matter 기기 테스트 인증서 만들기

OTA 테스트와 같은 특정 개발 시나리오에서는 비프로덕션 Matter 인증서를 만들어야 합니다.

기기 OTA 소프트웨어 업데이트를 포함한 Google 생태계의 일부 기능은 테스트 VID/PID로는 실행할 수 없습니다.

이 가이드에서는 테스트에 사용할 비프로덕션 Matter 인증서를 만들고 확인하는 방법을 설명합니다. 인증서 유형은 다음과 같습니다.

  1. 인증 선언 (CD)
  2. 제품 증명 중개 인증서 (PAI)
  3. 기기 증명 인증서 (DAC)

커미셔닝 프로세스 중에 Matter 인증 기기는 자체 증명, 즉 정품 Matter 인증 제품임을 증명해야 합니다. Matter 기기에서 증명에 사용하는 사용자 인증 정보는 다음으로 구성됩니다.

  1. 증명 키 쌍
  2. 인증서 체인

기기 증명 인증서 (DAC)는 인증서 체인의 첫 번째 링크이며 제품 증명 중간 인증서(PAI)에 의해 검증됩니다. PAI는 제품 증명 기관(PAA)에 의해 검증됩니다.

인증서는 증명 키 쌍이 생성되는 동시에 서명되며, 한 수준 위에 있는 인증 기관의 비공개 키를 사용하여 서명되어 신뢰 체인을 형성합니다. 따라서 DAC 인증서는 PAI 키로 서명되고 PAI 인증서는 PAA 키로 서명됩니다. 체인의 최상위에 있는 PAA 인증서는 자체 서명됩니다. 이 신뢰 체인은 분산 규정 준수 원장 (DCL)에 의해 동기화되는 제휴 PAA 구조를 형성합니다.

증명 프로세스 및 인증 선언 (CD)에 관한 자세한 내용은 추가 증명 문서 및 메시지와 법적 사안 사양에서 확인할 수 있습니다.

Matter SDK 설치하기

이 안내에서는 Matter SDK가 정상적으로 설치되어 있다고 가정합니다. 자세한 내용은 GitHub의 문서 또는 Matter 시작하기를 참고하세요.

헥스덤프 유틸리티(xxd)가 없는 경우 이를 설치합니다. 이 도구는 사용자 인증 정보를 C 스타일 형식으로 출력하는 데 유용합니다.

sudo apt-get install xxd

빌드 chip-cert

  1. 최신 버전의 SDK를 사용하고 있는지 확인하세요. 이 절차는 GitHub SHA 0b17bce8v1.0-branch 브랜치에서 테스트되었습니다.

    $ cd connectedhomeip
    $ git checkout v1.0-branch
    $ git pull
    
  2. Matter 기기의 사용자 인증 정보에 관한 여러 작업에 사용되는 도구인 chip-cert를 빌드합니다.

    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

CD 생성

  1. chip-cert를 사용하여 CD를 생성합니다. 현재 감독관은 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. CD를 확인합니다. VID/PID (10진수 형식)가 포함되어야 합니다.

    $ 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 생성

이 예시에서는 Matter의 자체 테스트 제품 증명 기관 (PAA) 인증서와 서명 키 Chip-Test-PAA-NoVID를 루트 인증서로 사용합니다. 이를 루트 CA로 사용하여 자체 PAI 및 DAC를 생성하겠습니다.

  1. PAA를 사용하여 PAI를 생성합니다. 선택사항으로 PAI에 PID 정보를 포함할 수 있지만 이를 생략하면 더 유연하게 테스트할 수 있습니다. 추가 PID에 DAC가 필요한 경우 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. PAI를 사용하여 DAC를 생성합니다.

    $ 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
    

결제 AA

자체 서명 PAA를 생성하는 데 유사한 프로세스를 사용할 수 있지만 반드시 그럴 필요는 없습니다.

대신 VID 정보를 포함하지 않는 기존의 자체 서명 개발 PAA를 사용합니다.

CD를 생성하는 더 많은 예는 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는 공장 출고 시 데이터에 있는 반면 CD는 펌웨어 자체에 삽입되어 있습니다.

    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 제공업체에 문의하시기 바랍니다.

CD 교체

  1. xxd를 사용하여 CD 파일 콘텐츠의 텍스트 표현을 추출합니다.

      $ 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의 경우와 같이 이 작업을 실행하는 방법은 개발 중인 플랫폼에 따라 다릅니다.

사용자 인증 정보 예시를 사용하는 경우 src/credentials/examples/DeviceAttestationCredsExample.cppExampleDACProvider::GetCertificationDeclaration에서 kCdForAllExamples의 내용을 바꿀 수 있습니다.

    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 기기 페어링에서 설명한 단계에 따라 Google Home platform에서 Matter 기기를 커밋할 수 있습니다.

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를 실행할 때마다 --trace_decode 1 플래그를 전달해야 합니다. 또한 --paa-trust-store-path 플래그를 사용하여 PA 파일의 경로를 전달하는 것이 좋습니다.

따라서 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