Hi Fabio,
> Is it correct to assume that the JSON string resulting from conversion
> is always the same (assuming to have the same input data) across
> different programming languages?
in theory ... probably, depends. I can think of cases where the
resulting data might be different, including the compatibility case
where we have a new version of embedded data with default values or the
like. So I would not really bet on it.
But what puzzles me most is this. As I understand it, the idea is
- Alice serializes data to JSON
- Alice stores the data into some envelope and puts an SHA-256 along
with it, say:
struct Envelope {
1 : string data // Thrift JSON data
2 : binary check // SHA-256 hash on data
}
- Bob reads the data and validates the checksum
- Bob deserializes data from JSON (or whatever else the format is)
Questions:
-> Why could Bob need to write the exact same data again?
-> And if that is really necessary, why can't Bob just calculate the
SHA-256 again?
I probably overlook something here ...
Have fun,
JensG
Am 09.05.2023 um 10:22 schrieb Fabio Ronca:
Hi there,
I have a question about the Tserializer and the TJSONProtocol offered by Thrift.
I'm using Thrift to implement a RPC between applications written in
different programming languages.
I need to add new functionality in my solution implementing an
integrity check on the data exchanged between client and server.
The idea is to compute an integrity on the data (defined in the IDL
Thrift) exchanged between sender and clients.
The integrity tag will be computed by the sender and re-compute by the
receiver. To ensure the integrity the tag computed by the receiver
shall match with the one received from the sender.
For structured data types, I want to leverage on the Tserializer based
on TJSONProtocol to obtain a JSON string (representing the data to
protect) to provide as input to the algorithm for integrity
calculation.
Is it correct to assume that the JSON string resulting from conversion
is always the same (assuming to have the same input data) across
different programming languages?
I mean, can I assume that the behaviour of TSerializer (based on
TJSONProtocol) is the same across the different implementations of
Thrift libraries available for the different programming languages?
Thanks in advance
Best Regards