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
Enviada há cerca de 3 meses
Resposta selecionada
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 setembro às 20:14
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 outubro às 03:46
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 outubro às 04:20
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 dezembro às 06:29
Mostafa