Samooramad
asked on
CAPICOM on 64 bit machine
Hi All,
I am using the capicom dll to sign some xml messages and send them using BizTalk. It was working fine on the test server, but on the production server which is 64 bit I get this error when CAPICOM dll is being called I get this error:
Retrieving the COM class factory for component with CLSID {94AFFFCC-6C05-4814-B123-A 941105AA77 F} failed due to the following error: 80040154.
so I did a little searching and apperently the capicom is not supported in 64 bit is the conclusion I have reached.
So my question is:
1- Is there anyway to make this work in 64 bit without needing to write some additional code?
2- If not, then how do I accomplish what is being done in the code below?
I am using the capicom dll to sign some xml messages and send them using BizTalk. It was working fine on the test server, but on the production server which is 64 bit I get this error when CAPICOM dll is being called I get this error:
Retrieving the COM class factory for component with CLSID {94AFFFCC-6C05-4814-B123-A
so I did a little searching and apperently the capicom is not supported in 64 bit is the conclusion I have reached.
So my question is:
1- Is there anyway to make this work in 64 bit without needing to write some additional code?
2- If not, then how do I accomplish what is being done in the code below?
public string SignIt(string sClearText, bool bDetached)
{
EventLog.WriteEntry(
"SignatureMgr::SignIt",
WindowsIdentity.GetCurrent().Name,
EventLogEntryType.Information
);
SignedData signedData = new SignedDataClass();
byte[] binArr = Encoding.UTF8.GetBytes(sClearText);
Utilities utils = new CAPICOM.UtilitiesClass();
signedData.set_Content(utils.ByteArrayToBinaryString(binArr));
Store store = new Store();
store.Open(
CAPICOM_STORE_LOCATION.CAPICOM_LOCAL_MACHINE_STORE,
"MY",
CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_READ_ONLY
);
Signer signer = new Signer();
string certSimpleName = null;
foreach (object cert in store.Certificates)
{
certSimpleName =
((Certificate)cert).GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME).ToLower();
System.Diagnostics.EventLog.WriteEntry(
"CSadadMessags::CMessageSigner",
certSimpleName + "=" + _certName,
System.Diagnostics.EventLogEntryType.Information
);
if (certSimpleName == _certName.ToLower())
{
signer.Certificate = (Certificate)cert;
break;
}
}
string signedText =
signedData.Sign(
signer,
bDetached,
CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64
);
return signedText;
}
ASKER
you mean change it for the project which is referencing the CAPICOM dll right?
Capicom isn't available in 64-bit. If you want to continue using capicom you have no choice but to force your project to 32-bit by setting it to x86. Projects that reference other projects must match - i.e. a 64-bit project cannot reference a 32-bit project, so you will probably need to make sure all the projects in your solution are either "x86" or "AnyCPU".
ASKER
still not working
ASKER
what can i use instead of Capicom?
Here is what I found:
MSDN - Alternatives to Using CAPICOM
http://msdn.microsoft.com/en-us/library/cc778518%28v=vs.85%29.aspx
MSDN - Alternatives to Using CAPICOM
http://msdn.microsoft.com/en-us/library/cc778518%28v=vs.85%29.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
figured it out
replaced this line:
string result = EnvelopEncryptedContent(en cryptedCon tent);
with this line:
string result = encryptedContent;
Thanks all
replaced this line:
string result = EnvelopEncryptedContent(en
with this line:
string result = encryptedContent;
Thanks all
ASKER
Thanks
http://www.derkeiler.com/Newsgroups/microsoft.public.platformsdk.security/2007-02/msg00039.html
https://www.experts-exchange.com/questions/25272570/Windows-7-Excel-and-CAPICOM-dll.html