-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fix broken file padding logic #66
base: master
Are you sure you want to change the base?
Conversation
…s to be detected to be invalid by iTunes and other software
I also have a follow-up change to this one prepared which completely eliminates the size-attribute based truncation logic https://github.com/accwebs/iTunes-Backup-Explorer/tree/feature/remove-size-attribute-truncation See the commit message for reasoning... Let me know if you want both these commits lumped together on the same PR. |
Ah, this is great. Thank you! I didn't know the padding size is embedded at the end of the files. |
I just wonder now how this could affect file deletion. As I decrypt the backup database without the size argument, maybe iTunes doesn't like that the padding isn't removed correctly there even though I haven't had a problem with SQLite clients not being able to read it. |
I think it's mainly just that any "correct" decryption logic will check the padding and reject the ciphertext if the padding is corrupt/invalid post decrypt. So likely any edit that re-encrypts the metadata sqlite database would 'corrupt' the database in the eyes of other tools (due to the 'old' encryption logic not padding the sqlite file properly). |
One realization I had late yesterday about this PR: probably I could completely eliminate much of the spaghetti padding logic I wrote by just changing the Cipher algorithm to I considered this approach originally but at the time I was 'maintaining' the Size attribute truncation logic which required me to NOT change it (since the rewritten padding logic was conditional based on whether LMK if you have any opinions/preferences on this. |
Still waiting for feedback. LMK if you think I should just rework to use the built-in Java padding mode or stick with how I did things here for now. |
Bad padding logic for file encryption/decryption was causing updated manifest files to be detected to be invalid by iTunes and other software.