We have a system of several applications that communicate with each other using gRPC/protocol buffers and, due to some new requirements, need to add a level of integrity verification to a subset of the messages.
Unfortunately, enabling SSL is not currently an option.
My problem is that, due to the fact the proto serialization is by necessity non-canonical, I can’t think of a way to calculate a crc/checksum of a message’s contents that could be reliably used to verify the contents by the receiver.
The closest thing I could think of would be dumping the message to a normalized JSON string using the facilities provided by the specific language (we have to work with a few) and calculating a checksum from that, but I expect that would be fraught with issues in the minutiae (differences in the printing of floats by different languages, etc.)
The only other thing I can think of would be, instead of sending a checksum, send the entire serialized message as a bytes
-type field tacked on to the end of the message, have the clients parse this, and then compare the received message (minus this new field) against the parsed one. I don’t love this; I think by definition this would effectively double the size of the message on the wire (not that we’re bottle-necked by network) and isn’t much cleaner than just sending every message twice and verify each received pair matches before handling it.
Has anyone else encountered and solved something like this with protocol buffers?