Currently, there is a gap between the crypto stuff inside .NET and the Microsoft crypto APIs. .NET currently does not have support for managing the key stores and the certificate stores. You can use the excellent CAPICOM COM component in interop mode under .NET to fill in this gap. I wrote a sample doing this about 6 months ago.
J. Keith Wedinger Senior Software Developer Sterling Commerce -----Original Message----- From: FRIEDMAN,Adam [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 20, 2003 1:12 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] CAPI -> .NET Crypto Interoperability Hi all, Before I spend too much more time on this I would like to know if anybody else has successfully used the System.Security.Cryptography.RC2 algorithm (from managed code) in to encrypt data, and then used CAPI (from unmanaged code) to decrypt it. I am aware that the .NET RC2 crypto class just wraps CAPI which is why I am expecting it to work (but have not been as successful as I would like). I'm pretty sure my logic is good, as the .NET crypto class can decrypt data which it has encrypted (and vice-versa for the CAPI code). Whenever trying between them, though, I just get ERROR_INVALID_DATA (or something equivalent). I assume it's to do with the padding, but I can't be sure (.NET crypto classes support PKCS7 or Zero-byte padding, while CAPI only supports PCKS5 padding). Again, I find this rather odd, since the .NET crypto classes are just wrappers for CAPI! Any ideas? TIA, Adam. Notice: The information contained in this e-mail message and any attached files may be confidential information, and may also be the subject of legal professional privilege. If you are not the intended recipient any use, disclosure or copying of this e-mail is unauthorised. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete all copies of this transmission together with any attachments.