-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
CipherError #23
Comments
To make sure I understand, all of the notes that were encrypted threw a CipherError consistently? That would most likely be the password being incorrect. You might want to check for any additional whitespace on the line, remove any quotes if you have it quoted, etc. It should just be the bare password on a line. For example, this is my test:
The images would likely be a separate issue, were you running this just from a |
unfortunately, yes, I've made sure this is the correct password and there is no whitespace. I can copy/paste this into the icloud site and unlock the notes, but it fails still.
As for the images, I've both from just NoteStore.sqlite and the full backup with the same results. |
What I find interesting is that the log appears to indicate that you did successfully open at least one locked object. Are you able to see anything in the
I'd also be interested to make sure that note was not deleted. I see there are only 16 at you're up at number 251, which makes me think there is some turnover and I have observed odd behaviors with notes after they have passed the time period wherein garbage collection should occur. These two SQLite queries might be interesting, especially if you look at the difference between whatever did open up and note 251. The first of which I would be making sure the result isn't
Finally, if you wanted to check on what this code is doing, I have code in this blog entry that explains each step of the process and you could plug in the results of the above two SQLite queries to make sure something isn't just broken in this program without having to give me any of that information. |
so for the images, I think my issue has something to do with this from the debug_log:
The note was definitely not deleted, actually there are 3 locked notes in the db and none of them are recovered.
|
Thanks, those are interesting observations. So the note clearly has data, clearly is not being decrypted, but (based on the first log) something was or the password should not have been listed at the end. Because you are seeing the If you go to the folder you are pointing to, can you try to find one of the files that this is claiming can't be found? From your snippet, I would suggest:
This won't work directly if you're looking at an iTunes backup, wherein the filenames are hashed. In that case you would open the Manifest.db file in the folder you pointed to (
|
It is an itunes backup (should be full), here is the query result on Manifest.db
|
Thanks, so the files should be there. What happens when you try to look at one, such as:
Also, it would be worth looking for the original filename in Manifest.db, and doing the same sort of Thanks for helping to troubleshoot this! |
I can search for and find all of these ids in the files and can even view the images by pulling them into VLC player.
I searched for these files and was able to view them as well. |
Thanks for working through this, it is really helpful and I'm getting a much better idea of what the problem is. If you look at the source for AppleNotesEmbeddedPublicJpeg, this is the function that gets the filepath we search for the media: apple_cloud_notes_parser/lib/AppleNotesEmbeddedPublicJpeg.rb Lines 110 to 113 in e983c6a
You'll notice it is expecting
However, in your data, the Account's UUID is not present and the path is starting down at the Media folder, so when apple_cloud_notes_parser/lib/AppleBackup.rb Lines 74 to 80 in e983c6a
So I think I understand what is happening, but I don't understand why. Can you tell me which version of iOS you are running and the type of device? Also, you mentioned iCloud, are these notes created on the iDevice, on your Mac, or in a browser? I hope those details will let me zero in on being able to recreate it myself. Edit: One other thing to make sure, include the |
No, thanks for working with me on this. I'll happily see if we can iron this out. The device is an iphone 11 running 14.6 iOS. The notes were all created on this iphone. I mentioned iCloud because it was the easiest way to copy/paste the password to ensure it was correct. |
I haven't yet reproduced this, but I have seen at least one oddity when running this on my Mac. Could you try running this on the actual Mac version of Notes and see if it gives you the same errors as you get from the iTunes backup?
What I'm finding is I have one note that I can unlock on my phone with the right password as all the other notes which does not unlock when I run the Mac version. When I run the iTunes backup, it opens just fine. As yet undecided about exactly why, but I'm curious to see how reliably reproducible yours is in your environment. Just rmember the Note IDs will change, my problem child (117) became 84 on the Mac. |
I don't have a mac to run this on, I'm running on a linux box. |
Oh, sorry, I made an assumption based on the iTunes backup. How are you getting the iTunes rip? My test device is an "older" iPhone on iOS 14.6 and I'm ripping it down to a Mac running Big Sur. Then I check the results on my Linux test environment and the Mac, both the iPhones version and Mac version. As I said, on Mac I see a potential discrepancy, but not sure it is your issue or not. |
well the rip is being done on windows, but I'm doing the work with your script on my linux box |
I have a theory that this might be related to how and when the iCloud changes sync. I have been able to find a case on my Mac backup that seems to be the same as yours and believe it is tied to this code: apple_cloud_notes_parser/lib/AppleNoteStore.rb Lines 610 to 637 in e983c6a
Ignoring the obvious bug of Would you please confirm there is a value in
In my case, I have the note I'm having issues with (117), as well as two others that I don't have issues with, likely because what is in the ZUNAPPLIEDENCRYPTEDRECORD is properly synced on notes 11 and 22. All three of these same notes are just fine on my iTunes backup.
I need to think about the best way to catch this case, but would appreciate your confirmation that this is likely the right direction by running the above SQLite query. |
Yeah there is definitely data there:
The contents without the length parameter included is massive. |
What's interesting about that output is I don't see Note 251 (just 66, 108, and 109), the one you have with the CipherError listed in the original report, included. That would make me think it is not actually the right track. As a bit of a long shot, could you check out branch |
ran that version, and the result looks identical |
Ok, well let's see if this works. I just pushed branch |
some success!... no longer get the encryption issue, but still no love on the images due to the |
Ok, in that case this is a bug that I can reproduce and I'll work on a solution. I have broken the images off into a separate issue because it is unrelated to the CipherError that spawned this ticket and I'd prefer to clearly track the distinct problems. Otherwise things get lost. |
understood, appreciate the help! |
This isn't as quick of a change because the case I think I have to catch means that there are two sets of "valid" settings, as far as the database is concerned. Those in This is a pure stopgap for you, not intended as production code and it may work for you, or this may continue to not work. If it does not work, I'd suggest looking at the files changed in the listed commit and try changing back to |
Excellent. You're a saint for patiently delving into this niche case for me that will probably never happen to anyone else. I was able to recover everything. |
That's great to hear! I will probably take a bit to figure out the best method to actually solve this. My hope is I can compare the timestamps on the |
Sorry for the delay in a real solution to this issue. I just pushed d4a0d86 which will now check if a given set of cryptographic settings is correct when multiple are available. |
I'm getting an error while parsing the notes from my backup. The password is correct in the file, and all unencrypted notes can be displayed (tho any with images do not). The error for the cipher is:
Apple Decrypter: Apple Note: 251 Attempting decryption.
Apple Decrypter: Apple Note: 251 caught a CipherError while trying final decrypt, likely the unwrapped key is not correct.
Could be user error, but I'm not sure what I'm doing incorrectly.
The text was updated successfully, but these errors were encountered: