Task #4982

Error in sending/receiving parameters in Interest using setApplicationParameters

Added by Ritik kumar 11 months ago. Updated 11 months 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.



Updated by Jeff Thompson 11 months 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.)


Updated by Ritik kumar 11 months ago

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


Updated by Jeff Thompson 11 months 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) ?


Updated by Jeff Thompson 11 months ago

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


Updated by Ritik kumar 11 months 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)


Updated by Jeff Thompson 11 months ago

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


Updated by Jeff Thompson 11 months 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());

Updated by Ritik kumar 11 months ago

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


Updated by Jeff Thompson 11 months ago

  • Status changed from New to Closed

You're welcome. Closing.

Also available in: Atom PDF