Andotp: Cannot restore encrypted backup

Created on 28 Aug 2019  路  19Comments  路  Source: andOTP/andOTP

Unfortunately it seems that I cannot restore my encrypted file backup.
I've also tried with a second smartphone, and cannot succeed either.

Just tried a fresh install of the lastest andOTP from FDroid, used pin for authentication and database encryption.
Added a simple password but with a special char for the backup password.
Added a new OTP,
Proceed to take an backup (encrypted), and try to restore it again, and it fails. The file is stored on my Google Drive and it seems that it gets corrupted somehow.

bug

Most helpful comment

@luger19 The new encryption method is currently only available in the beta, which is not yet on F-Droid. You will need the beta again if you want to restore the backup.

All 19 comments

Do you export it directly to Google drive from andOTP? If yes that could be the problem, try saving it locally on you phone first and then uploading it.

Do you export it directly to Google drive from andOTP? If yes that could be the problem, try saving it locally on you phone first and then uploading it.

Yes, I did it directly. If done locally first, the file can be restored. But my problem is that I've got a backup saved directly and cannot restore it now. So I guess I've lost it, or is there a possibility to recover from this?

Sadly it is probably lost for good, what is the size of the file you are trying to restore?
The strange thing is that in most cases it is not zero, so something is written to the file, just not the correct stuff.

Sadly it is probably lost for good, what is the size of the file you are trying to restore?
The strange thing is that in most cases it is not zero, so something is written to the file, just not the correct stuff.

my file saved on drive is "otp_accounts_2019-07-17_16-21-48.json.aes" and its 4107 bytes.
I've even tried with the script from asmw/andOTP-decrypt but it wont decrypt either.

I'm currently on vacation, so I can't really look into it. Could you try saving the same backup locally and to the drive and compare the sizes? Maybe you could take a logcat, if you know how to, of you trying to save to drive directly and post it here.

Well, that's the problem, that was my backup. I've reformatted the phone and tried to restore it, so I've lost my OTP's

I have a new debug build where I changed some stuff regarding the export of the backups.
In that new build exporting and importing directly to and from Google Drive and other cloud providers should work (I tested it on my phone with Nextcloud and Google Drive).
If you want you can download and try it here. It will install as a new app (called "andOTP (dev)") so it does not interfere with your existing installation.

I have the same problem: I exported a backup to the cloud. AndOTP told me to use a new encryption method which I did. Under "Backup" and "Restore" was also "Restore old backup" (where you could use the deprecated method again for old backups). So I uninstalled andOTP and reinstalled it to see if I could import the backup again, which didn't work (although I saved the file locally). By the way, the third option in the settings with the old encryption method was no longer visible, although it was the latest andOTP version (according to F-Droid).

@luger19 The new encryption method is currently only available in the beta, which is not yet on F-Droid. You will need the beta again if you want to restore the backup.

@flocke thanks, now with the Google Play beta version again, it works

Having the same issue: tried to backup my andOTP on one phone and restore on another, black screen on file choice, no opts imported. Even with the beta version. Funny thing, I've chosen andOTP becuase of this feature specifically. :D

Thankfully, no data lost, the app on the old phone works fine so far.

Strange, please make sure you are using the correct import option and password on your second phone. If you use a version lower than 0.6.3 on the old phone you need to use the legacy import on the new one.

Also, did you set the backup password globaly in the settings before importing? If yes try removing it (simply setting it to an empty value) and importing again, in that case you should get asked for the password after the file selection.

And, what do you mean with "black screen on file choice"? Do you mean you select a file and afterwards it goes black or does it go black instead of letting you select a file?

Never mind, apparently my old phone decided it doesn't want to let me get the damn file via mtp, I ended up trying to load a very old backup, probably made a year ago. EDIT: judging by the size, the phone only gave me a part of the file, so no wonder it didn't work.

Yeah, I select a file and then after a short wait app's part of the screen goes black (standard android panels aside, that is). A few seconds later app just crashes.

I've transferred the proper backup via other methods and everything imported fine.

The same password was set globally (on both old and new phones).

Yeah, if something happens during the file transfer it is going to fail. Because of that reason I am thinking about adding some kind of integrity check to the import and export. Maybe just creating a second file with the MD5 sum of the backup on export and, if both files are present during import, matching the MD5 sum to verify the file.

Maybe embed checksum into some kind of header withtin the file? (Although it would probably make the file harder to work with via external tools like openssl / text editors in case one would want to extract the data.)

Yeah, I'm probably gonna extend the backup format in the future to include some kind of header. Right now it is just a binary blob that is encrypted with AES256. Maybe I will use some kind of JSON wrapper in the future that just includes the encrypted database as Base32 or Base64 encoded data.

Closing since the original issue is most likely a problem with the Documents Provider (Google Drive, Nextcloud, ...) and not with andOTP itself. If something like this still occurs after the 0.8.0 release (which reworks a lot of the storage code) please just reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbiebl picture mbiebl  路  4Comments

D0mm4S picture D0mm4S  路  4Comments

SkyWheel picture SkyWheel  路  7Comments

SkewedZeppelin picture SkewedZeppelin  路  4Comments

RichyHBM picture RichyHBM  路  3Comments