Skip to content

Check for encryption method and fail if unsupported in replay #448

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

Open
2 tasks
machawk1 opened this issue Jul 20, 2018 · 4 comments
Open
2 tasks

Check for encryption method and fail if unsupported in replay #448

machawk1 opened this issue Jul 20, 2018 · 4 comments

Comments

@machawk1
Copy link
Member

machawk1 commented Jul 20, 2018

In #445 @ibnesayeed said:

If in future we extend more encryption methods and someone tries to reply a newer index with an older replay, the server might crash due to incompatible key passed to a different encryption method. I think the safe way would be to put that check in place and return an error to the client while logging the issue as unsupported encryption method if the method is anything but aes. This will be forward-safe.

When we used XOR for encryption prior to this PR, we checked the CDXJ for the respective key and assigned the Cipher class to be instantiated. This check was removed with the move to AES.

We should have conditional checks for different encryption types supported, used, and expected in the CDXJ. A base case can be found in the sample CDXJ files that specify XOR. Despite this specification, the current version of ipwb will use AES, which will cause gibberish to be display.

We can no longer support what we originally expected from XOR-based records, as the assumptions from pycrypto (variable length key/value) are not maintained in pycryptodome.

  • Write a test case for ipwb to fail with old CDXJ files using XOR
  • Add conditions to report an error if an unsupported encryption method is used
@ibnesayeed
Copy link
Member

We can no longer support what we originally expected from XOR-based records, as the assumptions from pycrypto (variable length key/value) are not maintained in pycryptodome.

Does this part add anything in this context that I am unable to understand?

@machawk1
Copy link
Member Author

@ibnesayeed Pycrypto allowed us to specify variable length key and target string. The implementation in Pycryptodome requires equal length strings. I have yet to look into the (assumed) padding method that Pycrypto was using. This information is needed to ensure a consistent interpretation from Pycryptodome if records were previously created with the ipwb indexer using (XOR, the only method available then) encryption.

@ibnesayeed
Copy link
Member

The point of this ticket is to check for the method used for encryption and only attempt to decrypt if the method is known (which for now is AES). This ticket has nothing to do with providing a guarantee that previously supported XOR method continues to work.

@machawk1
Copy link
Member Author

machawk1 commented May 1, 2025

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

No branches or pull requests

2 participants