I am in a situation where my application has to read an XML file that another application will drop onto a specific location on the file system (on multiple platforms). I control the contents of this document. The other application is simply providing transport.
I'd like to ensure that the document hasn't been modified in transit or forged in any way. Currently, we're simply writing a salted hash of the document string to the start of the file before the XML document itself. When we parse the document, we simply strip out the hash, compare it to a hash of the remainder of the document, and then send it to the parser.
Does anyone have any experience with this kind of scenario that they'd like to share? Are there any flaws or easier ways I'm missing?