# Equipment certification

When using some of the hardware capabilities provided by the mini program, the device needs to be registered in WeChat in advance, so that WeChat can verify the authenticity of the device.

For example: Mini Program audio and video calls (for Hardware)

# 1. Equipment requirements

WeChat needs hardware capabilities to verify device identities. Equipment manufacturers need to ensure that the equipment meets certain conditions.

# 1.1 Android devices

Equipment needs to meet one of the following conditions:

  • equipment EMMC/UFS Stored on RPMB(Replay Protected Memory Block) Partition not used
  • Equipment support TEE, and can follow theEquipment certification TEE NormsDevelopment TA And submit for acceptance.

In addition, device manufacturers need to build a RPMB Partition read-write and communication RPMBD Services (provided by WeChat, refer to Section 3 Section) and ensure that the service can boot up properly.

# 1.2 Linux equipment

Equipment needs to meet the following conditions:

  • equipment EMMC/UFS Stored on RPMB(Replay Protected Memory Block) Partition not used

# 2. Security policy

For the same ModelId, each physical device should be assigned a unique and invariant SN。 If detected, including, but not limited to, the following conditions, may result in device capability being blocked:

  • Multiple devices share the same SN
  • The same device alternately using a number of different SN
  • Use of False Equipment to Register Equipment
  • Other forgery or misuse of equipment.

# 3. Device Certification (Android)

# 3.1 deploy RPMBD service

Equipment certification requires the use of EMMC/UFS Stored on RPMB Partition to guarantee the identity of the device, the device manufacturer needs to build a RPMB Partition reading and writing and communication services, and ensure that the service can be booted up normally.

# 3.1.1 Download Services

Please contact us at this place Download the corresponding platform, version rpmbd Binary file.

Note: ARM 64 Bit version (TEE) requires equipment vendors to develop in accordance with the specification TEE Corresponding TA Module, detailed specification and process referenceEquipment certification TEE specification

# 3.1.2 Running Services

Will be downloaded rpmbd Binary (the following assumes that the file name RPMBD (which can be renamed after downloading) is integrated into the system and run as a service.

Be careful

  • RPMBD Services are used not only for the registration of devices, but also for subsequent use of related hardware capabilities.ensure RPMBD The service is running
  • Each one. EMMC/UFS Memory chip RPMB KEY It can only be written once and cannot be changed. If the wrong value is written (Non-Registration model_id and sn)The chip can no longer be used.
  • Higher version android Security is strong, you may also need to configure SELinux, and only supported in the system Partition started. May refer to [SELinux Reference configuration ](https://git.weixin.qq.com /wxa_iot/voipsdk/tree/master/android/system/sepolicy)

The operating mode is:

rpmbd /dev/mmcblk1rpmb # /dev/mmcblk1rpmb Partition path for rpmb, Developers need to fill in specific to their device (Qualcomm platform does not need to specify)

Refer to the following rc How to start:

  • /system/etc/Init, put system Partition startup (recommended)

    service rpmbd /system/bin/rpmbd /dev/mmcblk1rpmb
      class Main
      user root
      group root system
    
  • /vendor/etc/Init, put vendor Partition Boot (Only Android < 8 Support)

    service rpmbd /vendor/bin/rpmbd
      class Main
      user root
      group root system
    

# 3.2 Registration device

In completing the RPMBD After the service is deployed, it is necessary touse WMPF Certified Equipment

# 4. Device Certification (Linux)

  • useMini Program audio and video call SDK (Direct Connection Linux Equipment)Of the equipment, please use thewx_device_registerRegister the device.

# 5. Common problem

(1) Registered Device Error emmc write fail00

inspect rpmbd In the service startup parameter. rpmb The partition path is correct. If the path is correct, verify that the path corresponds to the rpmb Partition in the Android OS Down can be visited.


(2) Misrepresent cert fail

The application cache is cleaned, or Android think APK Changes lead to keystone The digital certificate is invalid.

Need to clean up Apk The data cache then uses the same appid, model _ID, SN call registerDevice/registerVoipDevice Refresh the key.


(3) Interface error ticket 1 invalid rpmb_buffer

current rpmbd and SDK aar The two versions are incompatible and should be kept using the same version. Example: rpmbd The service uses 1.3 The following version, while SDK Used the 1.3 Or version above.


(4) Registration Device Return -7, or call the interface error failed to get native service Or other acquisition rpmbd Service failure error

  • Confirmed deployment rpmbd Service, and the service is operating normally. (This can be done by ps View)
  • Android >= 8 Version, please confirm rpmbd Was in the system Partition startup
  • If enabled SELinux, to be confirmed SELinux The relevant rules are configured correctly

(5) Registered Device Error register: null

High version android Network requests are not allowed in the main thread, and need to be called in a separate open thread SDK interface


(6) When using IoT cards, network requests keep failing

Please use the Internet of Things card WMPF Registered equipment, or equipment certification SDK >= 1.3.1 Version, and make sure that servicewechat.com The domain name can be accessed normally.


(7) Registered Device Error 9800004,device XXX is not confirmed

The vast majority of cases are because the device was registered using the 1.3 The following versions of the Equipment certification SDK, and launched several times at the same time registerVoipDevice At this time, there is a probability that the key used by the device side is not synchronized with the background, resulting in the device can no longer be successfully registered, and the process is irreversible.

Developers are advised to use WMPF Register a device, or upgrade to device certification SDK 1.3 And above, when using the low version, be sure to ensure that the previous registerVoipDevice Do not repeat the call before returning.


(8) Registered Device Error 9800004,device XXX not registered

The vast majority of cases are the current device before using a different modelId/sn Registered. Such as the use of WMPF Register the device, you can use the [getMiniProgramDeviceInfo ](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/cli/miniprogramdevices /getMiniProgramDeviceInfo .html) Check the current device. sn and ModelId, and whether it is consistent with the incoming.


(9) Acquisition of Notes getCallerTicket/getDeviceToken Misrepresent 9800004

Generally because of incoming mode_id Inconsistent with when the device was originally registered.


(10) Misrepresent ticket 0 digital sign check fail

Mostly because the current device is already in the device's other App Currently, device validation is only available for a single application. Need to re-use the same appid, model _ID, SN Re-call registerDevice/registerVoipDevice Refresh the key.

For example, at the same time mixinguse WMPF Certified EquipmentandEquipment certification SDK, may lead to WMPF and Developer apps preempt each other's keys, causing this error.


(11) Registered Device Error 40234 hmac check fail

There may be the following reasons

  • The device is already using other model_id/sn Registered, this registration passed to a different model_id
  • The device has been registered, and the device was registered with the 1.3 Device certification for the following versions SDK, and launched several times at the same time registerVoipDevice At this time, there is a probability that the key used by the device side is not synchronized with the background, resulting in the device can no longer be successfully registered, and the process is irreversible.

(12) Obtain deviceToken Times wrong. register Info invalid

When fromEquipment certification SDKSwitch touse WMPF Certified EquipmentAfter, you need to call WMPF registerMiniProgramDevice To reregister the device, or if the call is not made or the call is unsuccessful, before you need to get the deviceToken The scene will report this error.