TripleDES = new TripleDESCryptoServiceProvider();
this.GenerateKey(); //Generate Key ..
TripleDES.Mode = CipherMode.CBC;
TripleDES.Padding = 开发者_JS百科PaddingMode.PKCS7;
byte[] cipher = new byte[0];
ICryptoTransform ict = TripleDES.CreateEncryptor();
cipher = ict.TransformFinalBlock(data, 0, data.Length);
Hi when i decypt the message using the same instance of the TripleDES = new TripleDESCryptoServiceProvider();
works properly but when i try to dcrypt using a new instance it says "Bad Data"
I believe you are generating a new key on each run. Try giving a static key instead of using this.GenerateKey();
.
精彩评论