Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrypt isn't working for new version #6

Open
hmarrao opened this issue Oct 29, 2019 · 7 comments
Open

Decrypt isn't working for new version #6

hmarrao opened this issue Oct 29, 2019 · 7 comments

Comments

@hmarrao
Copy link

hmarrao commented Oct 29, 2019

I'm currently unable to decrypt my db file.

the AES part is complaining about length not being in a 16*X block.

I don't know if db as some extra metadata or the decrypt options changed.

Can you help me decrypting my db file¿?

@CooperRS
Copy link
Owner

CooperRS commented Nov 9, 2019

Hey there!

I just updated the crypto library used by this tool. Can you try again with the current master HEAD (Commit 2b71b60)? I hope my update fixed this issue :)

Best regards,
Roland

@hmarrao
Copy link
Author

hmarrao commented Nov 10, 2019

Hi Roland, thx for the reply.

Im still getting the same problem:

Traceback (most recent call last):
  File "decrypt_otpauth.py", line 324, in <module>
    cli()
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "decrypt_otpauth.py", line 278, in decrypt_backup
    data = AES.new(key, AES.MODE_CBC, iv).decrypt(encrypted_otpauth_backup.read())
  File "/home/sp82254/.local/share/virtualenvs/decrypt-otpauth-files-JiRYvIvc/lib/python3.7/site-packages/Crypto/Cipher/_mode_cbc.py", line 246, in decrypt
    raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode

Im currently using OTP Auth 2.13.5 (504)

@hmarrao
Copy link
Author

hmarrao commented Nov 10, 2019

Updated to OTP Auth 2.16.1 (701) but got the same result.

@CooperRS
Copy link
Owner

Hmm, to me it seems like either the backup is not properly formatted or the Python Crypto library is broken.

Did you already try to recreate the virtual environment 8containing the dependencies) using piping --rm followed by a pipenv install?

Updated to OTP Auth 2.16.1 (701) but got the same result.

Updated to OTP Auth 2.16.1 means you installed that version of OTP Auth and re-created the backup with it?

@hmarrao
Copy link
Author

hmarrao commented Dec 12, 2019

same error:

    raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode

my otpauthdb doesn't have the proper block size ... it doesn't match a multiple of 16 as the one in your examples ...

@todd-a-jacobs
Copy link

todd-a-jacobs commented Jan 21, 2021

I'm also having problems with v2.17.4 (937) on macOS when using 2b71b60. The traceback says:

$ pipenv run python decrypt_otpauth.py decrypt_account --encrypted-otpauth-account ./accounts.otpauthdb 
Password for export file ./accounts.otpauthdb: 
Traceback (most recent call last):
  File "decrypt_otpauth.py", line 324, in <module>
    cli()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "decrypt_otpauth.py", line 223, in decrypt_account
    archive = archiver.Unarchive(data).top_object()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/bpylist/archiver.py", line 255, in top_object
    self.unpack_archive_header()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/bpylist/archiver.py", line 174, in unpack_archive_header
    plist = bplist.parse(self.input)
RuntimeError: invalid header for bplist

Because it's so easy to accidentally delete items in the app (because the edit function is overloaded, and is used for both deletion and inspection activities), backups and exports are really important and are currently not recoverable outside of the app itself.

@rc0j
Copy link

rc0j commented Feb 10, 2021

I'm also having problems with v2.17.4 (937) on macOS when using 2b71b60. The traceback says:

$ pipenv run python decrypt_otpauth.py decrypt_account --encrypted-otpauth-account ./accounts.otpauthdb 
Password for export file ./accounts.otpauthdb: 
Traceback (most recent call last):
  File "decrypt_otpauth.py", line 324, in <module>
    cli()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "decrypt_otpauth.py", line 223, in decrypt_account
    archive = archiver.Unarchive(data).top_object()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/bpylist/archiver.py", line 255, in top_object
    self.unpack_archive_header()
  File "/Users/foo/.local/share/virtualenvs/decrypt-otpauth-files-FMj1ZqW9/lib/python3.7/site-packages/bpylist/archiver.py", line 174, in unpack_archive_header
    plist = bplist.parse(self.input)
RuntimeError: invalid header for bplist

Because it's so easy to accidentally delete items in the app (because the edit function is overloaded, and is used for both deletion and inspection activities), backups and exports are really important and are currently not recoverable outside of the app itself.

I've been able to fix this issue (kinda), I changed the password from 40+ characters to 19 and it seems to be working completely fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants