WhatsApp Flows data exchange in c#
1

Hi there. I am looking at the Node.js documentation example and I cant seem to get the same example to work using c#. I keep getting the error: The specified nonce is not a valid size for this algorithm. (Parameter 'nonce').

Iv been looking around for possible solutions and every post I have seen regarding this issue is un answered. If you can help, please help.

Storm
Pregunta realizada hace aproximadamente 3 meses
Respuesta seleccionada
1

I had the same problem, you must use an external library like bouncy castle, the problem is that the iv of the C# library accepts only 12 bytes and the iv of the cloud api is 16 bytes.

27 de septiembre a las 8:14 p. m.
Julian
Storm

Thanks. I started having a look at that and I just cant seem to get passed the aes.Decrypt()t step.

I wanted to ask if you truncated the initial vector or left it at 16 bytes?

8 de octubre a las 3:46 a. m.
Storm

this is the line I am currently having issues with: aes.Decrypt(initialVectorBuffer, encryptedFlowDataBody, encryptedFlowDataTag, decryptedData);

The initial vector is a 16 byte array. The encrypted flow data is a 33 byte array and the encrypted encrypted flow data tag is a 16 byte array. Please let me know if you have any suggestions. The error that is being thrown is the same error of : The specified nonce is not a valid size for this algorithm. (Parameter 'nonce')

8 de octubre a las 4:20 a. m.
1

For future reference, we added example code for endpoint encryption in C# to our documentation along with the existing examples in Python, NodeJS, PHP, Java, Go,

https://developers.facebook.com/docs/whatsapp/flows/guides/implementingyourflowendpoint#c--example

16 de diciembre a las 6:29 a. m.
Mostafa