开发者

TripleDES Decryption in C#

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();.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜