Question

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.

Was it helpful?

Solution

We successfully do a similar thing that I hope might help you:

C++ CryptoAPI

.NET TripleDes Provider

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!

OTHER TIPS

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.

3DES is available via Capicom. See here for info.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top