tags:

views:

79

answers:

1

How to create tamper proof Excel document using java? Now i am using Apache POI package for generating Excel documents.

Help Me Bravos ....

+1  A: 

Setting a password on a sheet, would make your Excel document a little "tamper proof". I haven't tried it (only used POI to read non-protected Excel documents). The HSSFSheet object has a protectSheet() method, start with that:

http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#protectSheet%28java.lang.String%29

But I agree with the comment above, that says it is not possible to create a really tamper proof Excel document.

If you just needs to know whether the document has been tampererd with, you could embed a encrypted checksum (MD5).

slu
Recording a checksum in the document might be a bit tricky because a spreadsheet includes a "last saved" date. This would presumably be updated when Excel (or POI) writes the spreadsheet with the checksum ... rendering the stored checksum incorrect.
Stephen C
You could checksum just the cells/data...
slu
Ya ... i agree to slu. But creating hash for each cell is very tedious work and where i will keep tat hash ... any idea ?
Captain Crunch
Do you need to store it with the document? Just keep your own database - exact file name, time distributed, file size, hash. If you need this for someone else to check, send the hash separately as a validation (then you would need to provide whatever code that generates the hash).
Kevin Brock