加密物件格式

身分憑證

Android 裝置會使用身分憑證 安全地管理裝置上的憑證身分憑證 程式庫提供許多由發卡機構應使用的安全防護功能 盡可能以安全的方式與 Google 整合。

已簽署的 Nonce

身分憑證庫的一面是「挑戰」(在本 API 中稱為 Nonce)。 在 RegisterDeviceRequest 中設定。 這個 Nonce 會經過簽署,並嵌入裝置的認證擴充功能中 識別身分憑證讓核發機構能對回訪率建立信心 且並未由伺服器重播憑證和認證 一般而言,這個領域

存取控制設定檔

發卡機構可以明確指定存取控制設定檔 希望保護身分憑證中儲存的資料。 核發者可以指定是否需要驗證使用者才能存取資料 元素,以及使用者執行驗證的時間長短。Future (非 這項功能的用途包括限制 才能存取資料元素關於如何設定存取權控管格式的詳細資訊 可以使用 Credential 物件格式找到設定檔。

佈建證明

提供物件的佈建證明可讓核發機構瞭解 已成功在身分憑證中儲存憑證。核發機構 必須在 MSO 收到並驗證 佈建工作如要進一步瞭解這個物件,請參閱身分憑證說明文件

物件格式

這些物件會在裝置與 核發者。因此 Google 伺服器無法將 這些物件,部分物件的格式可能會與 其他 API 物件舉例來說,憑證的格式是「CBOR」 ,因為這是 Android 層級的預期內容

憑證

憑證包含資料元素以及存取方式。這項服務 包含兩個主要物件:provisionedDataaccessControlProfilesprovisionedData 包含與 憑證類型以手機駕照為例, org.iso.18013.5.1org.aamva.18013.5.1。資料項目和值 則指定相關的存取權控管設定檔。這是 形成 ID 清單,其中 ID 會對應至 accessControlProfiles 清單。在以下範例中,每個資料中的 [0] 項目參照 ID 為 0 而非索引 0 的存取控制設定檔。

以下是未編碼的 CBOR 對應資料項目範例。

{
  "provisionedData": {
      "org.iso.18013.5.1": [
          {
              "name": "family_name",
              "value": "Smith",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "given_name",
              "value": "Stewart",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "birth_date",
              "value": {
                  "tag": 1004,
                  "value": "1965-09-01"
              },
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "issue_date",
              "value": {
                  "tag": 1004,
                  "value": "2022-08-01"
              },
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "expiry_date",
              "value": {
                  "tag": 1004,
                  "value": "2027-08-01"
              },
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "issuing_authority",
              "value": "IA",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "issuing_country",
              "value": "US",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "document_number",
              "value": "D04320785",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "portrait",
              "value": {
                  "type": "Buffer",
                  "data": [
                      167,
                      30,
                      148,
                      218,
                      204,
                      75,
                      112,
                      162,
                      138,
                      40,
                      52,
                      63,
                      255
                  ]
              },
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "un_distinguishing_sign",
              "value": "USA",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "driving_privileges",
              "value": [
                  {
                      "expiry_date": {
                          "tag": 1004,
                          "value": "2027-08-01"
                      },
                      "issue_date": {
                          "tag": 1004,
                          "value": "2022-08-01"
                      },
                      "vehicle_category_code": "B"
                  }
              ],
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "sex",
              "value": 1,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "height",
              "value": 170,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "weight",
              "value": 79,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "eye_colour",
              "value": "Blue",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "hair_colour",
              "value": "Gray",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "age_in_years",
              "value": 57,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "age_over_18",
              "value": true,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "age_over_21",
              "value": true,
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "resident_address",
              "value": "1600 Amphitheatre Pkwy ",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "issuing_jurisdiction",
              "value": "US-CA",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "resident_city",
              "value": "Mountain View",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "resident_state",
              "value": "CA",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "resident_postal_code",
              "value": "94043",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "resident_country",
              "value": "US",
              "accessControlProfiles": [
                  1
              ]
          }
      ],
      "org.iso.18013.5.1.aamva": [
          {
              "name": "DHS_compliance",
              "value": "F",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "domestic_driving_privileges",
              "value": [
                  {
                      "domestic_vehicle_class": {
                          "domestic_vehicle_class_code": "D",
                          "domestic_vehicle_class_description": "Operator",
                          "expiry_date": {
                              "tag": 1004,
                              "value": "2027-08-01"
                          },
                          "issue_date": {
                              "tag": 1004,
                              "value": "2022-08-01"
                          }
                      },
                      "domestic_vehicle_restrictions": [
                          {
                              "domestic_vehicle_restriction_code": "B",
                              "domestic_vehicle_restriction_description": "Corrective lenses (also automated - vision screening)"
                          }
                      ]
                  }
              ],
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "aamva_version",
              "value": "1",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "family_name_truncation",
              "value": "N",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "given_name_truncation",
              "value": "N",
              "accessControlProfiles": [
                  1
              ]
          },
          {
              "name": "organ_donor",
              "value": true,
              "accessControlProfiles": [
                  1
              ]
          }
      ]
  },
  "accessControlProfiles": [
      {
          "id": 1,
          "userAuthenticationRequired": true,
          "timeoutMillis": 10000
      }
  ]
}

接著,這個物件應以 CBOR 格式編碼、加密, Base64 編碼。如果是在測試環境中,且資料未加密, 請使用 CBOR 格式編碼,接著採用 Base64 編碼。

請注意,上述範例是未編碼的 CBOR 對應,而非 JSON。如果 JSON 字串 已編碼為 CBOR,Android 裝置便無法正確剖析此值。

行動裝置安全物件

ISO/IEC 18013-5 定義了行動安全物件 (MSO),確保 mDL 資料不會遭到竄改,且是由可信任的授權所核發。

MSO 內含下列項目:

  • 摘要值:系統為每個資料產生的不重複值 元素中。物件 ID 可用於確認資料並未 已於簽署 MSO 後變更。
  • 裝置金鑰:每個行動裝置都會產生一個專屬金鑰 儲存憑證。用途是將 MSO 繫結至裝置,以及 以防止他人用於其他裝置
  • 有效性資訊:包括開始日期和結束日期。 MSO 有效。
  • IA 簽名:這是系統所建立的數位簽章 授權。 用於驗證 MSO 是否由可信任的主管機關核發。

MSO 的 CCDL 結構如下:

   MobileSecurityObjectBytes = #6.24(bstr .cbor MobileSecurityObject)
   MobileSecurityObject = {
      "digestAlgorithm" : tstr,        ; Message digest algorithm used
      "valueDigests" : ValueDigests,   ; Array of digests of all data elements
      "deviceKeyInfo" : DeviceKeyInfo,
      "docType" : tstr,                ; DocType as used in Documents
      "validityInfo" : ValidityInfo
   }
   DeviceKeyInfo = {
      "deviceKey" : DeviceKey
      ? "keyAuthorizations" : KeyAuthorizations,
      ? "keyInfo" : KeyInfo
   }
   DeviceKey = COSE_Key                ; Device key in COSE_Key as defined in RFC 8152
   KeyAuthorizations = {
      ? "nameSpaces" : AuthorizedNameSpaces
      ? "dataElements" : AuthorizedDataElements
   }
   AuthorizedNameSpaces = [+ NameSpace]
   AuthorizedDataElements = {+ NameSpace => DataElementsArray}
   DataElementsArray = [+ DataElementIdentifier]
   KeyInfo = { * int => any}           ; Positive integers are RFU, negative integers may be used for proprietary use
   ValueDigests = {
      "nameSpaces" : NameSpacesDigests
   }
   NameSpacesDigests = {
      + NameSpace => DigestIDs
   }
   DigestIDs = {
      + DigestID => Digest
   }
   ValidityInfo = {
      "signed" : tdate,
      "validFrom" : tdate,
      "validUntil" : tdate,
      ? "expectedUpdate" : tdate
   }
   NameSpace = tstr                    ; NameSpace as used in IssuerSigned
   DigestID = uint                     ; DigestID as used in IssuerSig

靜態驗證資料

靜態驗證資料,其中包含 digestIdMappingissuerAuth,應由發卡機構建構。

特定命名空間的 digestIdMappingIssuerSignedItem 例項,每個 elementValue 屬性各有空值。 此外,如要產生 issuerAuth,請簽署 MobileSecurityObjectBytes使用 COSE_Sign1

   StaticAuthDataBytes = (bstr .cbor StaticAuthData)
   StaticAuthData = {
      "digestIdMapping" : DigestIdMapping,
      "issuerAuth" : IssuerAuth
   }
   DigestIdMapping = {
      NameSpace => [ + IssuerSignedItemBytes ]
   }
   ; Defined in ISO 18013-5
   ;
   NameSpace = String
   DataElementIdentifier = String
   DigestID = uint
   IssuerAuth = COSE_Sign1 ; The payload is MobileSecurityObjectBytes
   IssuerSignedItemBytes = #6.24(bstr .cbor IssuerSignedItem)
   IssuerSignedItem = {
      "digestID" : uint,                           ; Digest ID for issuer data auth
      "random" : bstr,                             ; Random value for issuer data auth
      "elementIdentifier" : DataElementIdentifier, ; Data element identifier
      "elementValue" : DataElementValue            ; Data element value
   }

叫用 /provisionMobileSecurityObjects 時 且 StaticAuthDataBytes 會使用 HPKE 加密 做為回應的一部分

請參考 程式碼範例 來建構 MSO 和靜態驗證資料