DEV Community

HarmonyOS
HarmonyOS

Posted on

Wear Engine setFingerprint() 206 Error

Read the original article:Wear Engine setFingerprint() 206 Error

Problem Description

When calling setFingerprint() in Huawei Wear Engine, a 206 error is encountered. The root cause lies in incorrect fingerprint value formatting, particularly with the public key used in the certificate.

Background Knowledge

The fingerprint must be the public key (in base64 format) derived from a valid certificate file (.cer). The correct method involves extracting the last certificate block and encoding the public key.

Troubleshooting Process

  1. Open the .cer file, and copy the last paragraph (from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----) into a new .cer file.

  2. Open this new .cer file, click Details, and select Public Key to obtain the pubKey.

  3. Convert the pubKey into Base64 format. You may use a third-party tool such as tomeko.net.

  4. Example Base64 encoded string: BC5Z9/29Yn93xSa9XkQ2HN5GikugmXjor9se0VwnOENK9t4uFK4VlRpOHv4B3lphjIa7P6Sh61CFRsT0MZNhuV8=

  5. Construct the fingerprint using the format: <App Package Name>_<Base64EncodedPubKey>

  6. Example: com.huawei.wearengine_BC5Z9/29Yn93xSa9XkQ2HN5GikugmXjor9se0VwnOENK9t4uFK4VlRpOHv4B3lphjIa7P6Sh61CFRsT0MZNhuV8=

Analysis Conclusion

The 206 error is caused by an improperly formed fingerprint string. The fingerprint must follow the structure defined above, ensuring it matches the base64-encoded public key of the .cer certificate used.

Solution

·Extract the correct certificate section

·Obtain the public key

·Encode it properly in Base64

·Concatenate with the app package name to form the correct fingerprint

Verification Result

After correcting the fingerprint format using the described method, the setFingerprint() function executes successfully without error 206.

Related Documents or Links

Huawei Signature Guide (EN)

Written by Mehmet Algul

Top comments (0)