paolostivanin / OTPClient

Highly secure and easy to use OTP client written in C/GTK3 that supports both TOTP and HOTP
GNU General Public License v3.0
472 stars 46 forks source link

Failure to import AndOTP encrypted backup #250

Closed 1bcb closed 2 years ago

1bcb commented 2 years ago

OTPClient version: 2.5.1, flatpak Distro: Linux Mint 20.3 64-bit Cinnamon Description: Attempting to import an encrypted backup from AndOTP produces the error message

An error occurred while importing, so nothing has been added to the database. The error is: Number of iterations is invalid. It's likely this is not an andOTP encrypted database.

This import feature worked correctly until recently.

I tried importing an old AndOTP backup file: one which I had previously imported successfully, and I got the same error. Therefore, I believe the error is caused by a change on OTPClient's side, not a change in AndOTP.

Steps to reproduce: 1)Install AndOTP on Android. 2)Add at least one authenticator code. 3)Select "create backup" 4)Export an encrypted backup. 5)Copy the file to a computer running OTPClient. 6)Launch OTPClient 7)Click the hamburger menu->import->andOTP (encrypted) 8)Select the andOTP backup file 9)Enter the encryption password

Importing a plain-text andOTP file works correctly.

paolostivanin commented 2 years ago

Hello, thank you for the well reported issue. I'll have a look at it today/tomorrow :smile:

paolostivanin commented 2 years ago

It's because the number of iterations changed with one of the last updates: https://github.com/andOTP/andOTP/blob/6c54b8811f950375c774b2eefebcf1f9fa13d433/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java#L124-L125