I'm creating some software that essentially enforces a specific process for creating specific documents, which protects them from being challenged later. Afterwards, the file is signed with the user's key (USB token not related to the software). Recently there came a stakeholder suggestion to also sign it with the software's key to prove the process was followed.
But anyone could pull the key from the software and sign anything with it. So how could I include something in the file that confirms (or allows to disprove that) it was created with an authorized build of the software? Doesn't matter if the copy was obtained legitimately, just that it's not been modified.
To avoid the gory details, imagine the software calculates Pi, and we want to sign that Pi as calculated by a proper algorithm and not randomly generated past 3.1419.
I've narrowed down the threat model to two cases:
- A. Someone (average solo developer) alters the software, or creates a replacement, then blames the software when things go wrong. I need a way to show "It wasn't our build".
- B. Some lawyer claims the document is meaningless because anyone could have done A. The good guys need to show there were some protections against that.
The software needs to work offline, so online authentication on every signature is not acceptable. Online setup is acceptable if it can be done easily. The project's far too small for anything as monstrous as Denuvo, and security through obscurity is not normally accepted. But I still feel there's got to be a simple solution that I'm too blind to see.
I have considered using the user's token to encrypt/decrypt the signing certificate, but we need a way to ensure it's supplied to a proper build. Thought a bit about what code signing could do, but it doesn't seem to do anything for this case. What am I missing?