I need a standard, Microsoft delivered, encryption library that works for both .NET 2.0 and C++. What would you suggest?
We find that AES is only offered in .NET 3.5 (and available in C++)
We find that Rijndael is used in .NET 2.0 but not available in the standard C++ libraries.
If I am wrong (very good chance), can you point me in the right direction?
Worst case scenario, I suppose I can call the Rijndael algorithm from .NET using PInvoke but I would rather have a native solution.
-
3DES is available via Capicom. See here for info.
-
AES and Rijndael are essentially the same algorithm with a restriction on block size and cipher mode. So as long as you can live with the restrictions (which are not onerous) you can use them interchangeably.
-
We successfully do a similar thing that I hope might help you:
C++ CryptoAPI
- CryptoAPI is pure Win32 (c/c++), native to all Microsoft OS's.
- Use Enhanced Cryptographic Provider (
MS_ENHANCED_PROV) - Use Triple DES (
CALG_3DES) algorithm
.NET TripleDes Provider
- Use TripleDESCryptoServiceProvider on the .NET side.
Side Notes
- We avoid CAPICOM like the plague as the deployment nightmares that come with it are not worth the hassle.
- Byte order on the .NET side can come into play at times. For example, to consume a key that is generated on the C++ (CryptoAPI) side, you need to reverse the byte array prior to using it within the TripleDESCryptoServiceProvider.
If you would like more details please leave a comment and I can give more. Happy crypto!
Jason : Thank you. I will look into this... and of course, any other information you could provide, I would be delighted.Cheeso : don't forget the AES Crypto Provider - also available as part of Windows. http://msdn.microsoft.com/en-us/library/aa386979(VS.85).aspx It delivers AES algorithms, which is what the OP wanted I think.Scott Saad : True, but it's worth noting that AES algorithms are not supported on Windows 2000/NT. -
Windows includes a C/C++ AES encryption library, as part of the AES Cryptographic Services Provider. It is suitable for use from within native C/C++ applications.
0 comments:
Post a Comment