Task #4982

Error in sending/receiving parameters in Interest using setApplicationParameters

Added by Ritik kumar 10 days ago. Updated 4 days ago.

Start date:
Due date:
% Done:


Estimated time:


Trying to send an interest using the Java client, to a Cpp Server listening to the same prefix, I got the error,

ERROR: ParametersSha256DigestComponent does not match the SHA-256 of Interest parameters

This behaviour is observed when using the method interest.setApplicationParameters with non-empty Blob.

Meanwhile listening as a Java Server worked fine.


#1 Updated by Jeff Thompson 10 days ago

It looks like Cpp Server is written with ndn-cxx which is enforcing a check of the parameters.
Instead of setApplicationParameters, please try appendParametersDigestToName().

appendParametersDigestToName() was written according to the first spec of computing the Parameters digest. (From what I undersatand the spec is not finalized. I don't know which spec is used by your version of ndn-cxx.)

#2 Updated by Ritik kumar 10 days ago

I have used that here (uncomment!). But even after that, the error continues.
I have built the latest commit of ndn-cxx.

#3 Updated by Jeff Thompson 10 days ago

There have been many changes to ndn-cxx for ApplicationParameters since the last release. I'm still waiting for the new digest calculation spec to be finalized.

In the mean time, can you call Interest::setAutoCheckParametersDigest(false) ?

#4 Updated by Jeff Thompson 10 days ago

(Call it in the Cpp Server app which is throwing the error.)

#5 Updated by Ritik kumar 9 days ago

Thanks for the help, the Cpp server doesn't crash now but there's a new problem!
The received Block on the Cpp Server gets a size 2 more than that of the Blob sent from the Java Client. Consequently, this results in parsing errors. (I have updated the files on the link to print this difference)

#6 Updated by Jeff Thompson 9 days ago

Can you please post the two different printouts so that I don't have to compile and run your code?

#8 Updated by Jeff Thompson 9 days ago

Can you print the hex of the Received Block? I suspect that it is the entire TLV of the ApplicationParameters, including the type and length bytes 0x24 0x12. You need to use the correct ndn-cxx code to just get the value from the Received Block TLV.

Also, why do you use paramFromJson? The parameters are already encoded in a JSON string (of 16 bytes). You don't need to encode them again into a TLV. You can just put the JSON string as the value of the ApplicationParameters.

Instead of

Blob blob = paramFromJson(jo.toString());

just use

Blob blob = new Blob(jo.toString().getBytes());

#9 Updated by Ritik kumar 8 days ago

Thanks for the prompt help, the error was fixed following what you suggested above.

#10 Updated by Jeff Thompson 4 days ago

  • Status changed from New to Closed

You're welcome. Closing.

Also available in: Atom PDF