Following code decrypts the encrypted string "thisDecode" but gives an error:
(Unhandled Exception: System.Security.Cryptography.CryptographicException: Bad Data.
at System.Security.Cryptography.CryptoAPITransform._DecryptData(IntPtr hKey,
Byte[] rgb, Int32 ib, Int32 cb, Boolean fDone)
at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount))
Code:
TripleDESCryptoServiceProvider* des;
des = new TripleDESCryptoServiceProvider();
des->GenerateKey();
des->GenerateIV();
In fact I have a report i could lend you on the encryption method and some source code if you need it. It's in C++.
Bill
I'm not sure about what your code is referring to, or what it means. Basically I just finished making my program to encrypt and decrypt a file. The program isn't complete, but it works, and it demonstrates the process. If you're trying to use a program that was already created I wish you luck. The DES algorithm isn't all that difficult if you have someone who is capable of explaining it to you, but otherwise it can be a bit annoying. I do recommend that you write your own program though for the simple fact that if you write your own program, well then you know how that works.
I put some source code on my site in case you still need some help. It was written on MS Visual C++ 6.0
Thanks for your reply, but i got a solution for my problem. Actually i am working in .net, and using its inbuilt libraries of cryptography. This is much easier to work on, instead of working on VC6. It just requires few lines of code to implement DES/Triple DES, in comparison with VC6.
If you are interested in code of Triple DES implemented in C#, i can provide you that.
No big surprise I'd say: The post is almost eight years old.
I can't give you an implementation of 3DES either, but the Wikipedia article may take you somewhat further. It refers to the article on DES, which describes the algorithm in detail so you may be able to implement it. The fourth external link from the article page seems to more specifically describe a concrete implementation and may even contain source code; I didn't take the effort to download and inspect the PostScript file, though. Once you've got the DES part working, it shouldn't be too difficult to implement 3DES based on that and the information from the first article I linked to.
HTH
Last edited by Eri523; February 8th, 2013 at 06:34 PM.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Bookmarks