tectiv3 / react-native-aes

Native module for AES encryption
MIT License
188 stars 135 forks source link

[QUESTION] How to decrypt on server-side (.NET Core 3.1)? #48

Closed khuongtp closed 3 years ago

khuongtp commented 3 years ago

Hi, I want to decrypt the cipher in C# with this code but I can't manage to find the right key

using (Aes aesAlg = Aes.Create())
            {
                aesAlg.Key = [key];
                aesAlg.IV = [iv];

                // Create a decryptor to perform the stream transform.
                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for decryption.
                using MemoryStream msDecrypt = new MemoryStream(cipher);
                using CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read);
                using StreamReader srDecrypt = new StreamReader(csDecrypt);
                // Read the decrypted bytes from the decrypting stream
                // and place them in a string.
                plaintext = srDecrypt.ReadToEnd();
            }