Hovatek Forum DEVELOPMENT Android [Tutorial] How to extract public keys from a vbmeta image
Try our Online TWRP Builder..its free!
Can't login? Please, reset your password.


[Tutorial] How to extract public keys from a vbmeta image

[Tutorial] How to extract public keys from a vbmeta image

X3non
X3non
X3non
Recognized Contributor
22,062
12-03-2020, 11:16 PM
#1



This is a step by step guide showing how to extract public signing keys from a vbmeta image. This will come handy if you plan to make a vbmeta image and still retain the public keys for certain partitions

Requirements

  • Your VBmeta image (extract from the firmware of your device)
  • Download HxD Hex Editor @ https://mh-nexus.de/en/hxd/
  • Verify the partition names, partitions with public key and algorithm within your VBmeta image using this guide

If you verified the contents of your vbmeta and it matches with the contents of the one we used for this guide, then you can simply download the public keys @ https://mega.nz/#!uCwHyAYA!FLiwcSaSLpAl6...Gtgpe28kEA . It'll be the same as what you'll get if you manually extract the public keys yourself


Steps on how to extract public keys from a vbmeta image


Follow the steps below to extract public keys from a vbmeta image


See the video below or @ https://youtu.be/ICWBq-Bxsb4


  1. Launch HxD hex editor tool

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-20.jpg]

  2. Click File > Open

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-21.jpg]

  3. Navigate to the location of the vbmeta image, select it and click Open

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-22.jpg]

  4. Scroll down slowly using the scroll bar or arrow keys on your keyboard until you find the first partition name. Partition names within a vbmeta image will be gotten using the link to verify the contents of vbmeta in the requirements section

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-23.jpg]

  5. Start highlighting everything just after the partition name. When highlighting, ensure to use the middle section (hex view section)

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-1.jpg]

  6. Highlight downwards till you reach a section filled with mostly 00s, you're to stop highlighting just before the 00s

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-2.jpg]

  7. Right click on the highlighted item then click Copy

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-3.jpg]

  8. Click File > New

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-4.jpg]

  9. Right click on the middle section (hex view) then click on Paste insert

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-5.jpg]

  10. Click on File > Save

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-6.jpg]

  11. In the window that opens next, input the file name you wish to save the public key with then click Save

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-7.jpg]

  12. You can right click on the tab and click Close

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-8.jpg]

  13. Repeat the same procedure for all partitions on the list till you get to the last partition (in my case, DTB is the last partition)
  14. Place your cursor just in front of the partition name i.e DTB in my case. Take note of the

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-9.jpg]

  15. Click Search > Find

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-10.jpg]

  16. Click Hex-values tab

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-11.jpg]

  17. Input the search value below and click OK. (My vbmeta uses RSA4096 so i'm searching for 00 00 10 00)
    Code:

    search for : 00 00 10 00
    search direction : forward

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-12.jpg]

  18. If your vbmeta uses RSA2048 or you don't find anything after searching for the values in the last step, you can try searching for either
    Code:

    00 00 08 00
    or
    00 00

  19. It'll find the value just in front of the partition name

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-13.jpg]

  20. Click Search > Find again

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-14.jpg]

  21. It'll find the values a second time, you're to start highlighting just before the second found item but this time you'll highlight upwards.
    Note that if there's any 00s in front, you're to skip them (in my case, i have a single 00 just in front of 00 00 10 00, so i've skipped it)

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-15.jpg]

  22. Highlight upwards until you get to DTB which is the last partition name
  23. Right click on the highlighted item > Copy and paste into a new file then save (just like you did for the previous items)

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-16.jpg]

  24. The last partition could be a bit tricky so after saving, place your cursor at the end of the file and confirm the offset at the bottom left hand corner (in my case it's 408)

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-18.jpg]

  25. Open the other keys you saved and confirm that they all have the same final offset value (in my case it's 408). If yes then you're all good
  26. The files you saved are the public keys used by your device to verify the other partitions e.g boot, recovery e.t.c

    [Image: How-to-extract-public-keys-from-a-vbmeta-image-19.jpg]



Important Notice
  • You can also use the tool by ProKn1fe @ https://www.hovatek.com/forum/thread-326...#pid222094
  • New partitions tend to begin with HEX 00 00 10 00 so ensure to do a Search All for this hex to see all available partitions and know where each stops
  • Ensure to read through and understand before proceeding, you don't want to make a mistake while doing this
  • If you verified the contents of your vbmeta and it matches with the content of ours we used in writing this guide, then you can simply download the keys we've already generated to save your time.
  • Credits goes to Petercxy
This post was last modified: 19-10-2022, 06:15 AM by hovatek.

Messages In This Thread
How to extract public keys from a vbmeta image - by X3non - 12-03-2020, 11:16 PM
RE: How to extract public keys from a vbmeta image - by guest765 - 06-09-2020, 06:34 PM
RE: How to extract public keys from a vbmeta image - by X3non - 07-09-2020, 01:10 PM
RE: How to extract public keys from a vbmeta image - by ch3mn3y - 13-09-2020, 08:34 AM
RE: How to extract public keys from a vbmeta image - by mohamedfaky - 04-12-2020, 06:15 AM
RE: How to extract public keys from a vbmeta image - by hovatek - 05-12-2020, 07:58 AM
RE: How to extract public keys from a vbmeta image - by liOnux.fr - 03-05-2021, 04:44 PM
RE: How to extract public keys from a vbmeta image - by X3non - 04-05-2021, 11:13 AM
RE: How to extract public keys from a vbmeta image - by liOnux.fr - 04-05-2021, 08:28 PM
RE: How to extract public keys from a vbmeta image - by LoPaTkA_Boli - 11-05-2021, 09:22 AM
RE: How to extract public keys from a vbmeta image - by pindonga123 - 24-06-2021, 09:23 PM
RE: How to extract public keys from a vbmeta image - by X3non - 25-06-2021, 10:18 AM
RE: How to extract public keys from a vbmeta image - by lolvatveo - 22-09-2021, 12:58 PM
RE: How to extract public keys from a vbmeta image - by X3non - 23-09-2021, 09:24 AM
RE: How to extract public keys from a vbmeta image - by ProKn1fe - 30-11-2021, 10:12 PM
RE: How to extract public keys from a vbmeta image - by magixx - 15-12-2021, 12:56 AM
RE: How to extract public keys from a vbmeta image - by blaze2051 - 29-01-2022, 05:10 AM
RE: How to extract public keys from a vbmeta image - by Kelexine - 12-01-2023, 10:11 AM
RE: How to extract public keys from a vbmeta image - by Abatoir - 16-11-2022, 11:48 AM
RE: How to extract public keys from a vbmeta image - by hovatek - 18-11-2022, 07:39 AM
RE: How to extract public keys from a vbmeta image - by Marcos14 - 02-07-2023, 08:48 PM
RE: How to extract public keys from a vbmeta image - by Marcos14 - 02-07-2023, 08:50 PM
RE: How to extract public keys from a vbmeta image - by itapi - 09-07-2023, 01:30 PM
RE: How to extract public keys from a vbmeta image - by maxpayne - 13-07-2023, 11:58 AM
Users browsing this thread:
 1 Guest(s)
Users browsing this thread:
 1 Guest(s)
YtWhTl
live chat
whatsapp telegram instagram