开发者

Signing and verifying an automatically generated report

开发者 https://www.devze.com 2023-03-14 17:06 出处:网络
Last summer, I was working on an applicatio开发者_开发问答n that tested the suitability of a prospective customer\'s computer for integrating our hardware. One of the notions suggested was to use the

Last summer, I was working on an applicatio开发者_开发问答n that tested the suitability of a prospective customer's computer for integrating our hardware. One of the notions suggested was to use the HTML report generated by the tool as justification for a refund in certain situations.

My immediate reaction was, "well we have to sign these reports to verify their authenticity." The solution I envisioned involved creating a signature for the report, then embedding it in a meta tag. Unfortunately, this scenario would require the application to sign the report, which means it would need a private key. Once the application is storing the private key, we're back at square one with no guarantee of authenticity.

My next idea was to phone home and have a server sign the report, but then the user needs an internet connection just to test hardware compatibility. Plus, the application would need to authenticate with the server, and an interested party could figure out what credentials it was using to do that.

So my question is this. Is there any way, outside of obfuscation, to verify that the application did indeed generate a given report?


As Eugene has rightly pointed that my initial answer was to authenticate the receiver. Let me propose an alternative approach for authenticating the sender

authenticate the sender:

When your application is deployed at your client end, you generate and deploy a self signed PFX certificate which holds the private key.

The details of your client and passphrase for the PFX is set by your client and may be you can get it printed and signed by your client in paper to hold them accountable for the keys which they have just generated..

Now you have a private key which can sign and when exporting the HTML report, you can export the certificate along with the report.

This is a low cost solution and is not as secure as having your private keys in a cryptotoken, as indicated by Eugene, in the previous post.

authenticate the receiver:

Have a RSA 2048 key pair at your receiving end. Export your public key to your senders.

When the sender has generated the report, let the report be encrypted by a symmetric key say AES 256. Let the symmetric key itself be encrypted/wrapped by your public key.

When you receive the encrypted report,use your private key to unwrap/decrypt the symmetric key and in turn decrypt the encrypted report with the symmetric key.

This way, you make sure that only the intended receiver alone can view the report.


I'd say that you need to re-evaluate possible risks and most likely you will find them to be not as important as you could think. The reason is that the report has value for you but less likely for a customer. So it's more or less a business task, not a programming one.

To answer your concrete question, there's no simple way to protect the private key used for signing from being stolen (if one really wants to). For more complex solutions employing a cryptotoken with private key stored inside would work, but cryptotoken is itself a hardware and in your scenario it would unnecessarily complicate the scheme.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号