Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating a Tamper Proof Signature of some data?

Tags:

c#

.net

I have a piece of data. At the moment, it's an XML file, but the architecture may change. So let's assume for the moment it's a C# Class.

When I store the data on disk or in the database, I need to add some sort of signature or fingerprint or checksum or whatever to ensure that no one can modify the data. The caveat: even an administrator or developer with access to all source code should not be able to modify it.

I assume that since someone with full code access can create a new signature easily (the signing needs to be done programatically, so no manual passphrase entry), the signature somehow needs to contain some additional data. Ideally I should be able to extract this data back from the signature, for example the date of signing and some strings.

My general approach is to use symmetric encryption. I generate a Hash, i.e. SHA-512 from all the fields and then encrypt that hash and my additional data with to get my signature, using the hash as password. To decrypt, my function would generate the hash from the actual data in the file, and try to decrypt the signature. That would not be tamper-proof though as it's easy to generate a signature where the signing date and additional information is still intact.

As I am not an expert on the field, I believe that I am trying to re-invent the wheel, and that it's not a very good wheel. I just wonder if there is some standard approach? I believe that part of my request is impossible (after all, if someone controls the entire environment, that person also controls the system time), but I still wonder how this is generally tackled?

like image 703
Michael Stum Avatar asked Mar 04 '09 03:03

Michael Stum


People also ask

What is meant by tamper proof?

(also tamper-resistant) (also anti-tamper) made so that you are able to see if anything has been changed, opened, removed, or damaged: tamper-proof containers/locks/packaging Drug makers are encouraged to use tamper-proof packaging for their products.

Can digital signature fix the tampering?

A digital signature is intended to solve the problem of tampering and impersonation in digital communications. Digital signatures can provide evidence of origin, identity and status of electronic documents, transactions or digital messages. Signers can also use them to acknowledge informed consent.

What is used to create a digital signature?

The most common way of creating a digital signature is to use Public Key Cryptography (PKC). The systems used to deliver PKC are, as mentioned before, Public Key Infrastructures (PKI). At a basic level, digital signature solutions require each user to have a public and private key pair which are mathematically linked.

What is the purpose of digital signature?

Digital signatures create a virtual fingerprint that is unique to a person or entity and are used to identify users and protect information in digital messages or documents. In emails, the email content itself becomes part of the digital signature.

How digital signatures are used for security explain?

In the form of a coded message, the digital signature securely associates a signer with a document in a recorded transaction. Digital signatures use a standard, accepted format, called Public Key Infrastructure (PKI), to provide the highest levels of security and universal acceptance.


2 Answers

It sounds to me like you want a combination of a digital signature with a secure digital timestamp.

In brief, after signing your data, you call a third party web service to provide an official timestamp and their own digital signature linking that timestamp to your signature value, thus providing evidence that the original signature (and thus the original data) was created on or before that date. With this scheme, even if the original signing key is later compromised, revoked or otherwise invalidated, any signatures that were made before the invalidation are still valid thanks to the timestamp.

A tamper-resistant hardware signature device may help. If the target hardware is fairly recent it may have some support already on the motherboard in the form of a TPM, but there are plenty of vendors out there willing to charge an arm and a leg for their own hardware security modules, or somewhat less for a smart card.

Sufficient security may not be achievable by technology alone. You may need independent validation of the system. You may need remote CCTV monitoring and recording of the machine's location or other physical security measures to detect or stop tampering. You may need third-party code escrow, review and signing to ensure that the code loaded on the machine is what was intended, and to deter and/or detect the insertion of backdoor logic into the code.

The bottom line is that how much money, time and effort you need to spend on this depends very much on what you stand to lose if records are forged.

like image 184
Jeffrey Hantin Avatar answered Oct 25 '22 23:10

Jeffrey Hantin


You need both a digital signature and a trusted timestamp. The trusted timestamp gets a third-party involved to validate the message. Then any attacker doesn't have 'full control' of the whole system.

like image 26
Leonard Avatar answered Oct 26 '22 00:10

Leonard