masaccio / numbers-parser

Python module for parsing Apple Numbers .numbers files
MIT License
208 stars 15 forks source link

.numbers with password #88

Closed guilhermeasena32 closed 4 months ago

guilhermeasena32 commented 5 months ago

I am working with some .numbers files and one of them is password-protected. How can I parse this file by providing the password? Is it possible?

masaccio commented 5 months ago

Documents are AES-128 encrypted if we believe the Internet, which means we need the private key. I can see that there is an entry in the Mac Keychain for the password, but export is greyed out. However it can be found on the command-line:

security find-generic-password -w -g -D "iWork Document Password (Encrypted)"

But this generates a 290 byte 'password' or key which I don't know what it is yet.

So if we can determine how the data is encrypted, it is pretty straightforward then to decrypt with a key from the Keychain.

guilhermeasena32 commented 5 months ago

I know the password, but libreoffice cannot open these files with password because it considers corrupted and I have not found any solution to provide the password to parse the file.

masaccio commented 5 months ago

The problem is that I am struggling to figure out how it's encrypted at the moment so unless I have a breakthrough, it's blocked.

guilhermeasena32 commented 5 months ago

no problem, thanks @masaccio

masaccio commented 4 months ago

Closing as won't fix as it seems very unlikely the encryption format will be discovered. Docs updated to reflect this.