Re: Binary data in CAPICOM through C#
From: Michel Gallant (neutron_at_nspxistar.ca)
Date: 09/26/03
- Next message: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Previous message: BF: "Need NT4 version of ConvertStringSecurityDescriptorToSecurityDescriptor"
- In reply to: Kaare Langedrag: "Binary data in CAPICOM through C#"
- Next in thread: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 26 Sep 2003 11:49:25 -0400
Hi Kaare,
This problem, and the appropriate dis/ass workaround was discussed
in CAPICOM list:
http://discuss.microsoft.com/archives/capicom.html
Search for thread "How do we sign binary data". The last messages in
that thread have the details of the msil changes required.
Cheers,
- Michel Gallant
MVP Security
"Kaare Langedrag" <kare.langedrag@ergo.no> wrote in message
news:uDaehODhDHA.2516@TK2MSFTNGP09.phx.gbl...
> I want to sign and verify (and encrypt and decrypt) binary data with capicom
> through C#.
> I have found most parts of the solution (1-5 below), but i miss the last
> part (6).
>
> I hope someone could help me with the right code-lines to get the IntPtr
> value from the dll back into a C# array.....
>
>
> what i have done so far is:
>
> 1) i dissassembled the default created interop dll for capicom
>
> 2) i replaced "string " to "native int" in:
> .property string Content()
> .get instance string CAPICOM.SignedDataClass::get_Content()
> .set instance void CAPICOM.SignedDataClass::set_Content(string)
> .get instance string CAPICOM.ISignedData::get_Content()
> .set instance void CAPICOM.ISignedData::set_Content(string)
> .get instance string CAPICOM.EnvelopedDataClass::get_Content()
> .set instance void CAPICOM.EnvelopedDataClass::set_Content(string)
> .set instance void CAPICOM.IEnvelopedData::set_Content(string)
> .get instance string CAPICOM.IEnvelopedData::get_Content()
> .get instance string CAPICOM.EncryptedDataClass::get_Content()
> .set instance void CAPICOM.EncryptedDataClass::set_Content(string)
> .get instance string CAPICOM.IEncryptedData::get_Content()
> .set instance void CAPICOM.IEncryptedData::set_Content(string)
> 3) i replaced "string marshal( bstr)" to "native int" in:
> instance void set_Content([in] string marshal( bstr) pVal) runtime
>
> 4) i assembled a new interop dll
>
>
> 5) I load binary data to be signed or enveloped. (data is a signeddata or
> envelopeddata object)
>
> byte []dataContentByte;
> unsafe
> {
> fixed(byte * bstrPtr = &dataContentByte[0])
> {
> data.Content = new IntPtr (bstrPtr);
> }
> }
>
>
> 6) I have not figured how to get the resulting (signed or enveloped) read
> the data from the resulting IntPtr (data.sign() and data.envelop())......
>
>
- Next message: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Previous message: BF: "Need NT4 version of ConvertStringSecurityDescriptorToSecurityDescriptor"
- In reply to: Kaare Langedrag: "Binary data in CAPICOM through C#"
- Next in thread: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|