I looked into this on Windows and got me a signed current TWRP image that fastboot boots on my phone (yes, I’m surprised myself). Here goes … and you don’t have to bother with the whole key stuff, we’ll just download some …
- Install Java (if not already installed).
- Make (or look for) a directory to put stuff into.
- Download BootSignature.jar from @z3ntu’s place to the directory (URL found here).
- Download SignApk.zip (found here), from SignApk.zip extract the two files testkey.pk8 and testkey.x509.pem to the directory (or just extract the whole ZIP, doesn’t matter).
- Download the current TWRP image from here to the directory (or copy it there if you got it already).
- Open a command line (Start - Run - cmd) and cd your way into the directory.
- In the directory execute the following command (one line assuming twrp-3.1.1-1-fp2.img as the unsigned image filename):
java -jar BootSignature.jar /boot twrp-3.1.1-1-fp2.img testkey.pk8 testkey.x509.pem twrp-3.1.1-1-fp2-signed.img
- If you want, you can make sure only the signature was appended to the original image and nothing else was changed by comparing the two images e.g. with WinMerge.
Et voilà! Have fun fastboot booting your signed TWRP image on your phone.