[Sony Cross-Device General] mysticall:
I have similar problem.

Where is the keystore and how can I restore it?

F:\GSM\Sony\rom\I3312_Vodafone LC Net Locked_54.0.A.6.66-R12A\boot>newflasher.exe set_active:b

--------------------------------------------------------

newflasher.exe v55 by Munjeni @ 2017/2020

--------------------------------------------------------

Determining available free space by GetDiskFreeSpaceEx:

Available space to caller = 57197 MB

Total space on current drive = 364087 MB

Free space on drive = 57197 MB

Device path: \\?\usb#vid_0fce&pid_b00b#5&c4d4596&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

Class Description: SOMC Flash Device

Device Instance Id: USB\VID_0FCE&PID_B00B\5&C4D4596&0&1

update.xml not exist in current folder!

Writing command: set_active:b

got first reply[0x4]:

00000000 4F 4B 41 59 OKAY

Closing device.

Press any key to continue . . .

F:\GSM\Sony\rom\I3312_Vodafone LC Net Locked_54.0.A.6.66-R12A\boot>newflasher.exe

--------------------------------------------------------

newflasher.exe v55 by Munjeni @ 2017/2020

--------------------------------------------------------

Determining available free space by GetDiskFreeSpaceEx:

Available space to caller = 57197 MB

Total space on current drive = 364087 MB

Free space on drive = 57197 MB

Optional step! Type 'y' and press ENTER if you need GordonGate flash driver, or type 'n' to skip.

This creates GordonGate driver installer in the same dir with newflasher.exe!

n

Device path: \\?\usb#vid_0fce&pid_b00b#5&c4d4596&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

Class Description: SOMC Flash Device

Device Instance Id: USB\VID_0FCE&PID_B00B\5&C4D4596&0&1

update.xml not exist in current folder!

Reboot mode at the end of flashing:

type 'a' for reboot to android, type 'f' for reboot to fastboot, type 's' for reboot to same mode, type 'p' for poweroff, and press ENTER.

a

Optional step! Type 'y' and press ENTER if you want dump trim area, or type 'n' and press ENTER to skip.

Do in mind this doesn't dump drm key since sake authentifiction is need for that! But it is recommend to have dump in case hard brick!

n

Product: I3312

Version: 0.4

Bootloader version: 1315-2605_X_Boot_MT6762_O1.MP7_30

Baseband version: 1318-6115_54.0.A.6.66

Serialno: HQ69AXXXXX

Secure: yes

Loader version: XFL-MT6762-13

Phone ID: 0000:352526101XXXXX

Device ID: 445CE76ABDDB0F6EB8E91C71BF7XXXXX

Platform ID: 0000CA00

Max download size: 104857600

Sector size: 512

Rooting status: ROOTABLE

Ufs info: FAILUfs-info not supported

Emmc info: SAMSUNG,0x0100,0x0

Default security: ON

Keystore counter: 4

Security state: FAILSecurity-state not supported

Sake root: 9093

S1 root: OKAY

Root key hash: 489660FCBF0DF8E4227E7CE7648E1D3286D9A08719D515D2ED55BB4A7C11D3D6

Slot count: 2

Current slot: b

Battery level: 83

Device is put now in flash mode.

No .sin files in partition dir...

You must extract partition.zip into 'partition' folder if you want flash partition image!

On 2018 and UP models you must move partition sin files to 'partition' folder if you need flash partition images!

Processing .sin files...

Created ouput folder flash_session

Processing bootloader_V30_X-FLASH-ALL-6F56.sin

- setting up inflate...

- infflating, please wait...

.........

- inflate returned: 0

- gzpipe: ok.

- gunziped ok.

- Extracting from bootloader_V30_X-FLASH-ALL-6F56.sin

- Extracting signature bootloader.cms

- Uploading signature F:\GSM\Sony\rom\I3312_Vodafone LC Net Locked_54.0.A.6.66-R12A\boot\flash_session\bootloader.cms

signature:00000598

Error, didn't got signature OKAY reply! Got reply: FAILFailed to init keystore

=========== FIRMWARES HISTORY LOG =============

NEW_VERSION: erased_user_data:true, variant:userdebug, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_28, cdf_version:Unknown: Apr 3 2019/10:31:13, fs_version:Unknown: Apr 3 2019/10:31:13, sw_version:Unknown: Apr 3 2019/10:31:13

NEW_VERSION: erased_user_data:true, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R8A, fs_version:GENERIC_54.0.A.6.23, sw_version:1318-6115_54.0.A.6.23

NEW_VERSION: erased_user_data:true, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R8A, fs_version:GENERIC_54.0.A.6.35, sw_version:1318-6115_54.0.A.6.35

NEW_VERSION: erased_user_data:true, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R8A, fs_version:GENERIC_54.0.A.6.41, sw_version:1318-6115_54.0.A.6.41

NEW_VERSION: erased_user_data:false, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R8A, fs_version:GENERIC_54.0.A.6.46, sw_version:1318-6115_54.0.A.6.46

NEW_VERSION: erased_user_data:false, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R10A, fs_version:GENERIC_54.0.A.6.50, sw_version:1318-6115_54.0.A.6.50

NEW_VERSION: erased_user_data:true, variant:user, s1boot_version:1315-2605_X_Boot_MT6762_O1.MP7_30, cdf_version:1318-2711_R12A, fs_version:GENERIC_54.0.A.6.66, sw_version:1318-6115_54.0.A.6.66

=================================================

Set slot 'a' active.

Device is put now out of flash mode.

Sent command: continue.

ERROR: GetOverlapped_in_Result: failed with error code 433 as follows:

A device which does not exist was specified.

Error, no continue response!

Closing device.

Press any key to continue . . .

L3312 phone while working just stopped.

I ordered another broken one. I took his emmc chip and soldered it to mine.

Unfortunately for me, the phone wouldn't boot and was stuck in the SOMC Flash Device.

I have access to the EMMC, created a dump and saved it to the new flash but still no effect.

KMGD6001BM-B421 GD6BMB
Firmware Version: 54.0.A.6.66-R12A

BACKUP BOOTLOADER
#################

mmc extcsd read /dev/mmcblk0 > /media/multimedia/GSM/Sony/dump/ext_csd_0x976e68eb.txt
cat /sys/block/mmcblk0/device/cid >> /media/multimedia/GSM/Sony/dump/ext_csd_0x976e68eb.txt
cat /sys/block/mmcblk0/device/csd >> /media/multimedia/GSM/Sony/dump/ext_csd_0x976e68eb.txt
cat /sys/block/mmcblk0/device/serial >> /media/multimedia/GSM/Sony/dump/ext_csd_0x976e68eb.txt
cat /sys/block/mmcblk0/device/name

dd if=/dev/mmcblk0boot0 of=/media/multimedia/GSM/Sony/dump/mmcblk0boot0.bin conv=sync,excl
dd if=/dev/mmcblk0boot1 of=/media/multimedia/GSM/Sony/dump/mmcblk0boot1.bin conv=sync,excl

dd if=/dev/mmcblk0boot0 of=/media/multimedia/GSM/Sony/dump/mmcblk0boot0_preloader.bin skip=4 count=405

dd if=/dev/mmcblk0p18 of=/media/multimedia/GSM/Sony/dump/partitions/sspm_a.bin conv=sync,excl
dd if=/dev/mmcblk0p23 of=/media/multimedia/GSM/Sony/dump/partitions/odmdtbo_a.bin conv=sync,excl
dd if=/dev/mmcblk0p30 of=/media/multimedia/GSM/Sony/dump/partitions/xfl_a.bin conv=sync,excl
dd if=/dev/mmcblk0p32 of=/media/multimedia/GSM/Sony/dump/partitions/tzxflattest_a.bin conv=sync,excl
dd if=/dev/mmcblk0p34 of=/media/multimedia/GSM/Sony/dump/partitions/lk_a.bin conv=sync,excl
dd if=/dev/mmcblk0p39 of=/media/multimedia/GSM/Sony/dump/partitions/tee_a.bin conv=sync,excl

dd if=/dev/mmcblk0p5 of=/media/multimedia/GSM/Sony/dump/partitions/xflkeystore.bin conv=sync,excl
dd if=/dev/mmcblk0p6 of=/media/multimedia/GSM/Sony/dump/partitions/xflkeystorebak.bin conv=sync,excl

TEST BOOTLOADER
#################

vbindiff mmcblk0boot0_preloader.bin bootloader/preloader_V30.bin
vbindiff mmcblk0boot0.bin mmcblk0boot0_0xd6066805.bin
vbindiff mmcblk0boot1.bin mmcblk0boot1_0xd6066805.bin

vbindiff bootloader/sspm_V30.img partitions/sspm_a.bin

vbindiff bootloader/sspm_V30.img partitions/sspm_a.bin
vbindiff bootloader/odmdtbo_V30.img partitions/odmdtbo_a.bin
vbindiff bootloader/xfl_V30.mbn partitions/xfl_a.bin
vbindiff bootloader/tzxflattest_V30.mbn partitions/tzxflattest_a.bin
vbindiff bootloader/lk_V30.img partitions/lk_a.bin
vbindiff bootloader/tee_V30.img partitions/tee_b.bin

vbindiff partitions/xflkeystore.bin partitions/xflkeystorebak.bin

BACKUP User area
################

sfdisk --dump /dev/mmcblk0 > /media/multimedia/GSM/Sony/dump/mmcblk0.dump

dd if=/dev/mmcblk0 of=/media/multimedia/GSM/Sony/dump/GPT.bin count=34 conv=sync,excl
dd if=/dev/mmcblk0 of=/media/multimedia/GSM/Sony/dump/GPT-backup.bin skip=61071326 conv=sync,excl

root@debian:~# dd if=/dev/mmcblk0 of=/media/multimedia/GSM/Sony/dump/full-dump_l3312.bin count=11317247 conv=sync,excl
11317247+0 records in
11317247+0 records out
5794430464 bytes (5.8 GB, 5.4 GiB) copied, 440.054 s, 13.2 MB/s

dd if=/dev/mmcblk0p46 of=/media/multimedia/GSM/Sony/dump/partitions/keystore.bin conv=sync,excl
dd if=/dev/mmcblk0p55 of=/media/multimedia/GSM/Sony/dump/partitions/flashinfo.bin conv=sync,excl

Recovery User area
################

root@debian:/media/multimedia/GSM/Sony/dump# dd if=full-dump_l3312.bin of=/dev/mmcblk0 conv=sync,excl
11317247+0 records in
11317247+0 records out
5794430464 bytes (5.8 GB, 5.4 GiB) copied, 902.061 s, 6.4 MB/s

mkfs.ext4 /dev/mmcblk0p53
mkfs.ext4 /dev/mmcblk0p54

root@debian:/media/multimedia/GSM/Sony/dump# dd if=partitions/flashinfo.bin of=/dev/mmcblk0p55 conv=sync,excl
32768+0 records in
32768+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 1.97937 s, 8.5 MB/s

oot@debian:/media/multimedia/GSM/Sony/dump# gdisk /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.3

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Caution! After loading partitions, the CRC doesn't check out!
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help): r

Recovery/transformation command (? for help): v

Problem: The CRC for the main partition table is invalid. This table may be
corrupt. Consider loading the backup partition table ('c' on the recovery &
transformation menu). This report may be a false alarm if you've already
corrected other problems.

Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.

Problem: The secondary header's self-pointer indicates that it doesn't reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.

Identified 3 problems!

Recovery/transformation command (? for help): w
Warning! Secondary header is placed too early on the disk! Do you want to
correct this problem? (Y/N): n
Have not corrected the problem. Strange problems may occur in the future!

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mmcblk0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.

root@debian:/media/multimedia/GSM/Sony/dump# gdisk /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/mmcblk0: 61071360 sectors, 29.1 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 126083A0-123D-344E-AFF1-4E654E995905
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 61071294
Partitions will be aligned on 128-sector boundaries
Total free space is 5277 sectors (2.6 MiB)

Number Start (sector) End (sector) Size Code Name
1 1024 5119 2.0 MiB FFFF ta
2 5120 25599 10.0 MiB FFFF protect1
3 25600 46079 10.0 MiB FFFF protect2
4 46080 78847 16.0 MiB 8300 ltalabel
5 78848 78975 64.0 KiB FFFF xflkeystore
6 78976 79103 64.0 KiB 0700 xflkeystorebak
7 79104 80127 512.0 KiB FFFF efuse
8 80128 82175 1024.0 KiB 0700 boot_para
9 82176 83199 512.0 KiB FFFF para
10 83200 124159 20.0 MiB FFFF expdb
11 124160 126207 1024.0 KiB FFFF frp
12 126208 126719 256.0 KiB FFFF ppl
13 126720 257791 64.0 MiB FFFF nvdata
14 257792 323327 32.0 MiB FFFF metadata
15 323328 421631 48.0 MiB 8300 persist
16 421632 438015 8.0 MiB FFFF oemkeystore
17 438016 444159 3.0 MiB FFFF proinfo
18 444160 446207 1024.0 KiB 0700 sspm_a
19 446208 448255 1024.0 KiB FFFF sspm_b
20 448256 450303 1024.0 KiB 0700 spmfw_a
21 450304 452351 1024.0 KiB FFFF spmfw_b
22 452352 517887 32.0 MiB 8300 diag
23 517888 550655 16.0 MiB 0700 odmdtbo_a
24 550656 583423 16.0 MiB FFFF odmdtbo_b
25 583424 788223 100.0 MiB FFFF md1img_a
26 788224 993023 100.0 MiB FFFF md1img_b
27 993024 1025791 16.0 MiB FFFF vbmeta_a
28 1025792 1058559 16.0 MiB FFFF vbmeta_b
29 1058560 1189631 64.0 MiB FFFF nvram
30 1189632 1320703 64.0 MiB FFFF xfl_a
31 1320704 1451775 64.0 MiB FFFF xfl_b
32 1451776 1452287 256.0 KiB FFFF tzxflattest_a
33 1452288 1452799 256.0 KiB FFFF tzxflattest_b
34 1452800 1456895 2.0 MiB FFFF lk_a
35 1456896 1460991 2.0 MiB FFFF lk_b
36 1460992 1592063 64.0 MiB FFFF boot_a
37 1592064 1723135 64.0 MiB FFFF boot_b
38 1723136 1739519 8.0 MiB FFFF logo
39 1739520 1749759 5.0 MiB FFFF tee_a
40 1749760 1759999 5.0 MiB FFFF tee_b
41 1760000 1772287 6.0 MiB FFFF scp_a
42 1772288 1784575 6.0 MiB FFFF scp_b
43 1784576 1785599 512.0 KiB FFFF seccfg
44 1785600 1851135 32.0 MiB 8300 nvcfg
45 1851136 1855231 2.0 MiB FFFF sec1
46 1855232 1871615 8.0 MiB FFFF keystore
47 1871616 1904383 16.0 MiB 8300 appslog
48 1904640 2826239 450.0 MiB FFFF oem_a
49 2826240 3747839 450.0 MiB FFFF oem_b
50 3747840 4976639 600.0 MiB FFFF vendor_a
51 4976640 6205439 600.0 MiB FFFF vendor_b
52 6205440 11317247 2.4 GiB FFFF system_a
53 11317248 16429055 2.4 GiB FFFF system_b
54 16429056 61034495 21.3 GiB FFFF userdata
55 61034496 61067263 16.0 MiB FFFF flashinfo

Command (? for help): q