rijndael

Using node.js to decrypt data encrypted using c#

孤者浪人 提交于 2021-02-11 08:56:10
问题 I'm facing a issue now which need you guys help. I use c# to do some encryption. Then need to use node.js to decry-pt it. But I just found that I can't do it correctly base on my c# encryption algorithm. If you guys have any solution, please help me. Here is my c# encryption code: public static string Encrypt(string text, String password, string salt, string hashAlgorithm, int passwordIterations, string initialVector, int keySize) { if (string.IsNullOrEmpty(text)) return ""; var

Using node.js to decrypt data encrypted using c#

眉间皱痕 提交于 2021-02-11 08:55:10
问题 I'm facing a issue now which need you guys help. I use c# to do some encryption. Then need to use node.js to decry-pt it. But I just found that I can't do it correctly base on my c# encryption algorithm. If you guys have any solution, please help me. Here is my c# encryption code: public static string Encrypt(string text, String password, string salt, string hashAlgorithm, int passwordIterations, string initialVector, int keySize) { if (string.IsNullOrEmpty(text)) return ""; var

DeflateStream / GZipStream to CryptoStream and vice versa

☆樱花仙子☆ 提交于 2021-02-07 09:33:39
问题 I want to to compress and encrypt a file in one go by using this simple code: public void compress(FileInfo fi, Byte[] pKey, Byte[] pIV) { // Get the stream of the source file. using (FileStream inFile = fi.OpenRead()) { // Create the compressed encrypted file. using (FileStream outFile = File.Create(fi.FullName + ".pebf")) { using (CryptoStream encrypt = new CryptoStream(outFile, Rijndael.Create().CreateEncryptor(pKey, pIV), CryptoStreamMode.Write)) { using (DeflateStream cmprss = new

DeflateStream / GZipStream to CryptoStream and vice versa

寵の児 提交于 2021-02-07 09:30:42
问题 I want to to compress and encrypt a file in one go by using this simple code: public void compress(FileInfo fi, Byte[] pKey, Byte[] pIV) { // Get the stream of the source file. using (FileStream inFile = fi.OpenRead()) { // Create the compressed encrypted file. using (FileStream outFile = File.Create(fi.FullName + ".pebf")) { using (CryptoStream encrypt = new CryptoStream(outFile, Rijndael.Create().CreateEncryptor(pKey, pIV), CryptoStreamMode.Write)) { using (DeflateStream cmprss = new

Is it possible to NOT use the IV when implementing Rijndael decryption?

♀尐吖头ヾ 提交于 2021-02-07 03:56:49
问题 I am implementing a decryption of ciphertext using Rijndael's algorithm. Unfortunately, I have not got access to the encryption of the data and have only been provided with a password (to generate the key with) and the type of algorithm. I do not have a salt (which seems to be ok), and I do not have the IV. Now, my question is whether I absolutely have to have the IV in order to perform decryption? I suspect the developers who wrote the encryption made no use of salt, or IV (if this is even

Is it possible to NOT use the IV when implementing Rijndael decryption?

余生颓废 提交于 2021-02-07 03:54:20
问题 I am implementing a decryption of ciphertext using Rijndael's algorithm. Unfortunately, I have not got access to the encryption of the data and have only been provided with a password (to generate the key with) and the type of algorithm. I do not have a salt (which seems to be ok), and I do not have the IV. Now, my question is whether I absolutely have to have the IV in order to perform decryption? I suspect the developers who wrote the encryption made no use of salt, or IV (if this is even

Decrypt string with Rijndael return “System.SecureString” (as a string) but not the string

断了今生、忘了曾经 提交于 2021-01-29 08:23:49
问题 I'm using Rijndael Algorithm to encrypt strings (user passwords), but when I decrypt them, it returns me "System.SecureString", and not my decrypted password. I'm using this basic code: public static string DecryptString(string cipherText, string password) { byte[] key, iv; Rfc2898DeriveBytes rfcDb = new Rfc2898DeriveBytes(password, Encoding.UTF8.GetBytes(password)); key = rfcDb.GetBytes(16); iv = rfcDb.GetBytes(16); byte[] cipheredData = Convert.FromBase64String(cipherText); RijndaelManaged

How does RFC2898DeriveBytes generate an AES key?

余生长醉 提交于 2021-01-27 04:42:29
问题 I saw some code like string password = "11111111"; byte[] salt = Encoding.ASCII.GetBytes("22222222"); Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(password, salt); RijndaelAlg.Key = key.GetBytes(RijndaelAlg.KeySize / 8); I can see the key is generated by Rfc2898DeriveBytes with passphrase and salt. Then AES retrieves the key by GetBytes. But the question is, what does RFC2898DeriveBytes do and what key.GetBytes(cb) do? Could anyone elaborate this? I couldn't get it from the documentation.

Decryption Exception - length of the data to decrypt is invalid

谁说胖子不能爱 提交于 2021-01-14 07:53:07
问题 I am working in a C# application. We have common methods to store data on a file. These methods encrypt the data and store them on the file system. when we need the data, ReadData method decrypts the data and returns me plain text. This code works fine in normal cases if size of the text in small. but for a example text given below, the decryption code is throwing exception - length of the data to decrypt is invalid. The exception occurs at line // close the CryptoStream x_cryptostream.Close(

Rijndael 256 encryption with Java & Bouncy Castle

怎甘沉沦 提交于 2020-07-22 13:26:07
问题 I'm working on a project built in pure php, i'm doing a rework on the login, but the users in the database are cipher in Rijndael-256, i've tried a lot of things and nothing seems to work, and i feel i'm so close with this code, but it doesn't work, and i'm really lost private final String key = "..."; public String decrypt(String password, String cypherKey) { try { password = password.substring(0, password.lenght() - 1); // 1 byte[] passwordBytes = password.getBytes("UTF-8"); byte[] key =