Binary data in CAPICOM through C#
From: Kaare Langedrag (kare.langedrag_at_ergo.no)
Date: 09/26/03
- Next message: Karl Thorén: "RE: ResourceManager connection fails (SCARD_E_NO_SERVICE)"
- Previous message: Ohaya: "Re: Certadm.dll/CCertAdmin on Win2K?"
- Next in thread: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 26 Sep 2003 15:39:07 +0200
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: Karl Thorén: "RE: ResourceManager connection fails (SCARD_E_NO_SERVICE)"
- Previous message: Ohaya: "Re: Certadm.dll/CCertAdmin on Win2K?"
- Next in thread: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Reply: Michel Gallant: "Re: Binary data in CAPICOM through C#"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|