Hi,
I'm working with multiple versions of the nRF Connect SDK (v2.8.0, v3.0.0, v3.1.0) using the official VS Code integration on Windows and could verify this also on Ubuntu. I'm running into a strange issue when verifying signed firmware images using MCUboot's imgtool and the public key.
When I use the CLI version of imgtool (available in the PATH in some terminal profiles), verification works fine:
imgtool verify -k pub.pem app.signed.bin
But when I run the same verification using the Python script directly:
python C:\ncs\<toolchain-id>\bootloader\mcuboot\scripts\imgtool.py verify -k pub.pem app.signed.bin
I get the error:
Key type does not match TLV record
Using the private key for verificvation works in both instances.
The bootloader script requirements are installed. Both methods report the same version (2.1.0) for the imgtool and use the same Python interpreter from the toolchain (C:\ncs\toolchains\<toolchain-id>\opt\bin\python.exe). The cryptography package version is also the same (43.0.1). T
So far, this behavior is consistent across SDK versions and toolchains. The CLI version works, the direct script call fails. I suspect the CLI version might be wrapped or configured differently, but I can't find any documentation on this.
Also, I noticed that in the latest toolchain (SDK v3.1.0 with toolchain 3.1.0), the CLI version of imgtool is not available in the PATH by default, and I couldn't locate it in the toolchain folder either.
Can someone explain why the CLI and script behave differently, and whether the CLI version is intentionally excluded from newer toolchains? Is there a recommended way to enable it in VS Code terminal profiles?
Thanks in advance.
Best Regards
Marvin