Decrypting Enveloped data messages with .NET and P/Invoke
From: Michel Gallant (neutron_at_istar.ca)
Date: 09/05/03
- Next message: Dave: "Re: Writing Code for Semi-trusted Environment"
- Previous message: Lior Amar: "Re: ASPNET and Impersonation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 5 Sep 2003 17:34:53 -0400
Currently, .NET framework does not directly support CMS/pks7
encrypted message encapsulations, although I hear great things
are coming in Whidbey!
While CAPICOM 2 provides the EnvelopedData object, there are
some known .NET <-->COM interop marshaling issues involving
bstr-->managed strings and binary data truncation.
The current workaround is to disassemble/modify/reassemble the COM
interop assembly ... slightly messy.
As always, it is possible to Pinvoke to CryptoAPI to get the needed
functionality :-)
Here is a sample utility, showing how to invoke the CryptoAPI simplified
message function CryptDecryptMessage() to decode/decrypt most
standard CMS/pkcs7 enveloped messages:
http://pages.istar.ca/~neutron/feature/decenvelop.html (current feature article).
- Michel Gallant
MVP Security
http://pages.istar.ca/~neutron
- Next message: Dave: "Re: Writing Code for Semi-trusted Environment"
- Previous message: Lior Amar: "Re: ASPNET and Impersonation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]