176 reputation
4
bio website nelenkov.blogspot.com
location Tokyo, Japan
age
visits member for 1 year, 10 months
seen Apr 11 at 8:27

Jan
17
comment Hardware backed Credentials Storage on Galaxy Nexus
Reference: nelenkov.blogspot.com/2012/07/…. And, yes, TZ is not a TPM.
Jan
17
comment Hardware backed Credentials Storage on Galaxy Nexus
Actually the Galaxy Nexus has had a hardware-backed credential storage since 4.1. It just isn't enabled in production builds. Also, TrustZone is a software thing, it does not require anything but a TZ-enabled ARM chip, which pretty much all recent ones are. TPM requires an actual secure chips. In order to take advantage of TZ, a secure OS needs to be installed, along with the relevant drivers and a way to link it to Android. This requires the manufacturer to integrate it, of course.
Oct
1
comment Is there a way to look inside and modify an adb backup created file?
That's just an example. Optimize accordingly for larger files. Also GUI editors and 2GB files don't mix well :)
Jun
25
comment Is there a way to look inside and modify an adb backup created file?
You can also try the Perl scripts linked in the entry. One of them attempts to fix broken archive.
Jun
20
comment Is there a way to look inside and modify an adb backup created file?
So, if you used a binary editor, and deleted the shared storage part (easily recognizable because you can see the file paths as strings), you should get a (somewhat) valid backup and maybe even manage to unpack it.
Jun
20
comment Is there a way to look inside and modify an adb backup created file?
As silly as it may sound, you need to specify -noshared, to get the shared storage backed up correctly. If you specify -shared, it won't be properly encrypted/compressed and you will get the ZipException.
Jun
20
comment Is there a way to look inside and modify an adb backup created file?
Now I am seeing the 'ZipException: invalid stored block lengths.' too. It seems that under some conditions the shared storage backup part is not compressed/encrypted, although the other part of the backup is (data and apks). Still not sure when exactly this happens. I somehow managed to produce working backups in my initial tests.
Jun
15
comment Is there a way to look inside and modify an adb backup created file?
You could modify the extract program to output the deccrypted, but still compressed file and then try to find some tool or library that would decompress ignoring errors. Java's Deflater doesn't have such an option. Or you could try to use zlib directly. You could try 7Zip or use the zlib/jzlib.
Jun
14
comment Is there a way to look inside and modify an adb backup created file?
I've tested the tool with Galaxy Nexus and Nexus S, both running 4.0.4, so it should be compatible. If you are getting the same error when doing an 'adb restore', maybe the file is somehow corrupt?
Jun
11
comment Is there a way to look inside and modify an adb backup created file?
What Android version was your backup created with? Maybe there are some differences between versions. There are new bugs in 4.0.4, so there definitely have been some changes.
Jun
8
comment Is there a way to look inside and modify an adb backup created file?
Done. See wiki entry for some details and link to the unpack utility.
Jun
5
comment Is there a way to look inside and modify an adb backup created file?
Cool, glad you got it working. If the decryption finished without an error, a simple tar xvf decrypted.bkp should do it. I put together a simple extractor class that does not require patching Bouncy Castle, will post it somewhere later.
Jun
5
comment Is there a way to look inside and modify an adb backup created file?
Update: Android's PBKDF2WithHmacSHA1 implementation treats password characters as ASCII, while Java SE (Sun/Oracle) apparently treats them as UTF-8(16?). This causes the checksum error. You can get around this if you use BouncyCastle on the desktop.
Jun
4
comment Is there a way to look inside and modify an adb backup created file?
It seems it fails due some incompatibility of the Java SE and Android crypto providers. You can decrypt the master key however, so if you uncomment the checksum check (if (Arrays.equals(calculatedCk, mkChecksum)) you can decrypt the file. What you get is a regular tar file, with directories for the apk (a/), files (f/), db (db/), and shared preferences (sp/).
May
30
comment Is there a way to look inside and modify an adb backup created file?
Sorry, the key is actually derived based on the password you specify when starting the backup.
May
30
comment Is there a way to look inside and modify an adb backup created file?
As for the encryption part, I have to look it up for the details, but the key is derived using PBKDF2 by the salt and device unlock PIN, password or pattern (converted to string). The master key is generated randomly, and encrypted with the password-derived key. Get it to work for unencrypted archives first. I can implement the decryption part if you are having trouble with it.
May
30
comment Is there a way to look inside and modify an adb backup created file?
If you put the code somewhere, I might able to join. The OP (@ngorichter) probably has some working code by now too :) A utility that decompresses and extracts the actual files might be useful, so that you can restore only parts (if you have root of course).