Posts

Crypto js similar to c sharp, Port crypto-js AES functions to C#,Cryptojs equivalent in c#

Image
Crypto js similar to c sharp, Port crypto-js AES functions to C#, Symmetric and asymmetric encryption using c# example In this Article we will discuss about Encryption and decryption technique using c# Port crypto-js AES functions to C# Here's a simple example of how you might use CryptoJS for hashing a string using SHA-256 If we want to encryption or decryption using crypto.js then use do this by following way.   public class Protection { public static string OpenSSLEncrypt(string plainText, string passphrase) { // generate salt byte[] key, iv; byte[] salt = new byte[8]; RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); rng.GetNonZeroBytes(salt); DeriveKeyAndIV(passphrase, salt, out key, out iv); // encrypt bytes byte[] encryptedBytes = EncryptStringToBytesAes(plainText, key, iv); // add salt as first 8 bytes byte[] encryptedBytesWit...