-
Notifications
You must be signed in to change notification settings - Fork 86
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
Signed file support #30
base: master
Are you sure you want to change the base?
Conversation
This looks good to me as a start. One piece of feedback, and a question: It would be nice if the signature module were less dependent on side effects - that is, I/O like loading files and printing text. If the signature module took bytes and returned a class or enumerated values explaining the signing state, we would need one extra line of calling code instead of replacing the file input, yes - but then we'd have access to the signature capabilities in places where we already have read the file, and we'd be able to do what we want with the return value. An example would be displaying a checkbox or X mark in the GUI for example, rather than relying on side effects from the file's loading process to print to the log only. As for my one question - You've verified the behavior of "signed" files with older versions of VW_Flash? From a quick skim of the code, it should just ignore the extra bytes, but I want to be sure :) |
Recent commit:
It's not ready to merge, but is this kinda what you were thinking? I included the changes in the CLI + GUI, but I only tested |
Note - my commit timestamps are all FUBAR... WSL loses its clock when the machine goes to sleep.
Anyway:
Changes should be pretty straightforward.
Additional file
lib/signature_tools.py
that now handles read_bytes and write_bytes when necessary.signatures are only supported against full bins.
When a full bin is read in (via input_bin) if the last 350 bytes include METADATA:xxxx, they're pulled off and processed, otherwise the bin is read in directly.
When a write is planned (via output_bin), if theres args provided that trigger a signature, it's performed. Otherwise, it's just written directly.
The following is how you actually sign a full bin. Optionally including some notes about the file and a secondary_key to sign it with (if you have your own private key). If you don't provide a secondary key, only the private key in
data/VW_Flash.key
is usedvalidation is simple as well. The following command would read in the input_bin and check the signatures against the public key in data/VW_Flash.pub as well as the secondary_key (if the file contains a dual signature)