I'd like to extract a plain dump of the UEFI firmware of my laptop (1:1 copy of the flash content, often called .bin or .rom files) from the .cap file, so that I can modify it slightly with me_cleaner. (The .cap file is a raw image compressed and wrapped with the flash tool as part of a capsule.) Then I suppose one has to reconstruct the capsule so it's valid, and it has a chance of passing signature check when updating firmware with fwupd.
My machine is a Thinkpad T460s, which is supported by fwupd/LVFS https://fwupd.org/lvfs/device/com.lenovo.ThinkPadN1CHT.firmware and the me_cleaner tool is described at https://github.com/corna/me_cleaner/wiki/Internal-flashing-with-OEM-firmware
In particular, I'd be happy with just
me_cleaner.py -s <firmware image>, where -s is setting the HAP bit, and not modifying the actual image, so it may still pass signature check.
Any hint where to start?
Possibly related question: Reverse engineering UEFI CAP files