Trying to use Secure Boot with WP7608 and have a few questions going through the Secure Boot Application note from the source.
Section 6.2 step 4 mentions about packaging signed images into a CWE image. The script mentions mdm9x28-image-cwe.inc depends on cwetool-native wherein it is not mentioned on how to use it ?
Syntax of the script and whether it has to be put in the same folder as the signing server is not mentioned?
How to verify the image is signed properly with the key, before loading it into the device?
There is no build seen for cwetool-native does this need to be built in the SDK for use?
to Generate cwe files do we need to use the linux source and bitbake tool?
maybe we can provide the task using the command bitbake mdm9x28-image-minimal -c generate_cwe in this case how to specify the signed image components for cwe generation?
The android Signing tool provided in the attached document is pretty old and from 2021 to 2022 there has been new firmware released for WP76 ( from R16 to R16.1.1), can you please confirm if the attached tools in the document can still be used with R16.1.1?
Alternatively for user building WP76 yocto can he copy the tools from his own yocto workspace? This would be helpful as at every future firmware change the signing tool can be updated from the corresponding Yocto workspace?
Following the steps on Ubuntu 18.04 when running the step to sign the image android_signature_add_R16.sh getting the following error:
./android_signature_add_R16.sh /boot boot-yocto-mdm9x28.4k.unsigned.img boot-yocto-mdm9x28.4k.img verity
Password for the private key file:
Exception in thread “main” java.security.NoSuchAlgorithmException: 1.2.840.113549.1.5.13 SecretKeyFactory not available
at java.base/javax.crypto.SecretKeyFactory.(SecretKeyFactory.java:122)
at java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:168)
at com.android.verity.Utils.decryptPrivateKey(Utils.java:150)
at com.android.verity.Utils.loadDERPrivateKey(Utils.java:166)
at com.android.verity.Utils.loadDERPrivateKeyFromFile(Utils.java:189)
at com.android.verity.BootSignature.doSignature(BootSignature.java:264)
at com.android.verity.BootSignature.main(BootSignature.java:324)
Looking here Java 256-bit AES Password-Based Encryption - Stack Overflow seems to be Java bug
Is there any solution to this issue in ubuntu 18.04? Which Ubuntu version is recommended for signing the ubuntu image?
Using incorrect password should show the followings:
owner@CNHKG-EX-001367:~/Yocto/tools/signing_dir$ ./android_signature_add.sh /boot boot-yocto-mdm9x28.4k.unsigned.img boot-yocto-mdm9x28.4k.img
Password for the private key file:
Password may be bad.
Exception in thread "main" java.security.spec.InvalidKeySpecException: Cannot retrieve the PKCS8EncodedKeySpec
at javax.crypto.EncryptedPrivateKeyInfo.getKeySpec(EncryptedPrivateKeyInfo.java:255)
at com.android.verity.Utils.decryptPrivateKey(Utils.java:158)
at com.android.verity.Utils.loadDERPrivateKey(Utils.java:166)
at com.android.verity.Utils.loadDERPrivateKeyFromFile(Utils.java:189)
at com.android.verity.BootSignature.doSignature(BootSignature.java:264)
at com.android.verity.BootSignature.main(BootSignature.java:324)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
at com.sun.crypto.provider.CipherCore.unpad(CipherCore.java:975)
at com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1056)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853)
at com.sun.crypto.provider.PBES1Core.doFinal(PBES1Core.java:432)
at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineDoFinal(PBEWithMD5AndDESCipher.java:316)
at javax.crypto.Cipher.doFinal(Cipher.java:2168)
at javax.crypto.EncryptedPrivateKeyInfo.getKeySpec(EncryptedPrivateKeyInfo.java:250)
... 5 more
Using correct password should show the followings:
owner@CNHKG-EX-001367:~/Yocto/tools/signing_dir$ ./android_signature_add.sh /boot boot-yocto-mdm9x28.4k.unsigned.img boot-yocto-mdm9x28.4k.img
Password for the private key file:
owner@CNHKG-EX-001367:
You can try the same openjdk version “1.8.0_292” as mine
will make_wp76xx generate the rhash.bin for the default legato AF inside the leaf-data folder? In our case we have applications outside the leaf-data folder and we convert the .update file to .cwe.
Therefore do we have to move our applications into default .sdef so our applications are built with make_wp76xx and are included in rhash.bin?
Yes. i did it inside the leaf-data folder
I suggest you try on default one with “make wp76xx” first, this can make sure the signing procedure is working fine first.
After that you can add your application to your legato image.