How to Encrypt value in Typescript and Decrypt in c#
Loading
How to Encrypt value in Typescript and Decrypt in c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Mar 30, 2024, 2:30 PM
Please check below article
https://www.c-sharpcorner.com/UploadFile/4d9083/encrypt-in-javascript-and-decrypt-in-C-Sharp-with-aes-algorithm-i/
Jaimin ShethiyaPosted Mar 30, 2024, 12:44 PM
Hello Piyush,
You need to install the cryptojs in your typescript side and do the encryption when you required to encrypt your confidentials data.
When the request is send to the server side then you need to decrypt that value in server side and use in the application side.
For how to implement this mechanisum so you need to refer Amit or Tauhin Reply comments.
Thanks
Dhiraj PoojaryPosted Feb 7, 2024, 9:54 AM
You can find assistance on encrypting a string in TypeScript and decrypting it in C# using advanced encryption in the following Stack Overflow thread:
https://stackoverflow.com/questions/41671267/encrypt-the-string-in-typescript-and-decrypt-in-c-sharp-using-advanced-encryptio#:~:text=npm%20instal%20crypto%2Djs
Tuhin PaulPosted Feb 4, 2024, 5:43 PM
Encrypting a value in TypeScript and decrypting it in C# involves using a common encryption algorithm that is supported in both environments. One such algorithm is AES (Advanced Encryption Standard). I'll provide a basic example using AES encryption with CryptoJS in TypeScript and decryption with C#.
In C#, the
Aesclass fromSystem.Security.Cryptographyis used for decryption. Ensure you handle the secret key securely in your application. The Initialization Vector (IV) should also be handled securely in production but is kept simple in this example.Amit MohantyPosted Nov 21, 2023, 6:45 AM
You'll need to install CryptoJS in your TypeScript project. You can do this via npm:
The C# code to encode or decode is here.