Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm using Node.js to encrypt a validation string using 'AES-256-CBC' in crypto. I'd eventually like to decrypt that string using C# System.Security.Cryptography.Aes class.

How do I find the corresponding c# decryption settings?


For testing, I'm encrypting a string in node.js, and encrypting that same string in c# and comparing my cipher texts.

As you can see below, they differ by only 1 character.

Here's the node.js cipher text:
efd50eda8f2c41c5ea7fd9ad94200edd

Here's the c# cipher text:
efd5eda8f2c41c5ea7fd9ad94200edd

What I have tried:

In both node.js and c#, I'm encrypting with a 32-byte key and a 16-byte IV.
Posted
Comments
Atlapure Ambrish 25-Oct-17 3:33am    
I am sure you have referred these articles, but still wanted to point those out..
http://gsferreira.com/archive/2015/02/how-to-encrypt-in-nodejs-and-decrypt-in-c-sharp/

https://social.msdn.microsoft.com/Forums/en-US/47800a60-4461-4f8e-a8d1-751fa62c7884/aes-encrypt-in-javascript-and-decrypt-in-c?forum=csharpgeneral
[no name] 25-Oct-17 12:53pm    
Thanks for the response....you solved my problem.
Atlapure Ambrish 26-Oct-17 10:52am    
no problem, it's my pleasure!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900