I was wondering if people have been successful in creating/mounting encrypted OBB (Opaque Binary Blob) files in Android? This is a follow up to this question 1: What is OBB(Opaque Binary Blob) in Android develop site? , Following the direction in that post I executed the following (from ICS 4.01 baseline, Tried both on Ubuntu 10.10-32bit and Ubuntu 12.4-64bit):
sudo modprobe cryptoloop
sudo modprobe twofish
sudo modprobe vfat
./mkobb.sh -d /tmp/obb/ -kblahblah -o /tmp/out.obb -v
obbtool a -n com.test.blah -v 1 -s 997ff9b1516a6788 /tmp/out.obb # 997ff... is the salt from the mkobb step
obbtool i /temp/out.obb # verify the obb file
adb push /temp/out.obb /sdcard/
From here I copy the out.obb file to the /sdcard/ on my phone. And mount with the following code:
String obbFile = Environment.getExternalStorageDirectory() + "/out.obb";
mgr = (StorageManager) getSystemService(Context.STORAGE_SERVICE); // mgr is a member varible of my main activity
Log.i("OBB", "trying to mount : " + obbFile + " does it exist? " + new File(obbFile).exists());
if (mgr.mountObb(obbFile, "blahblah", new OnObbStateChangeListener(){
@Override
public void onObbStateChange(String path, int state) {
Log.i("OBB", String.format("onObbStateChange:Path [%s] State=%d", path, state));
if (state == OnObbStateChangeListener.ERROR_COULD_NOT_MOUNT){
Log.i("OBB", "THIS IS THE ERROR I GET");
}
}}))
{
Log.i("OBB", "Attempting to mount");
} else {
Log.i("OBB", "Mount failed"); // this isn't happening
}
The end result of this is:
E/MountService( 2004): Couldn't mount OBB file: -1
I/OBB (21219): onObbStateChange:Path [/mnt/sdcard/out.obb] State=21
I/OBB (21219): THIS IS THE ERROR I GET
Anyone see any problems with this? Seems like it should work!
Note: I do have android.permission.WRITE_EXTERNAL_STORAGE and also I get expected info from:
ObbInfo info = ObbScanner.getObbInfo("/sdcard/out.obb"); // this returns expected info, so the file is there and able to be read.
Edit: Link to Android-Developer group question here