Replacement of CAPICOM Setsecret API in C# RRS feed

  • Question

  • Hi All,

         We were using CAPICOM API for encryption and decryption. now we are planning to upgrade with C# application and replace CAPICOM component.

    CAPICOM code:

    IEncryptedDataPtr encryption(__uuidof(EncryptedData));
    HRESULT hr = encryption->SetSecret("SQOSDKD232WSDW", CAPICOM_SECRET_PASSWORD);
    _bstr_t localcontent = ((_bstr_t)"CREATE A SAMPLE APPLICATION");
    hr = encryption->put_Content(localcontent );
    _bstr_t encrytpedcontent = encryption->Encrypt(CAPICOM_ENCODE_BASE64);

    We are thinking to upgrade above CAPICOM code in C# because CAPICOM is going to deprecate. but unable to understand how can we upgrade. because we have used below mentioned code to upgrade in C#. but during decryption we are getting error "wrong key" used to access data. i think the key we used to access data during encryption is wrong.

    Please help me.


    Thursday, February 4, 2016 8:10 PM


  • Hi Rahul,

    >>now we are planning to upgrade with C# application and replace CAPICOM component.

    Which encryption method and certificate did you use in CAPICOM API?

    There is a correspondence between CAPICOM API and .NET Framework encryption and decryption API. Link below is for your reference. I suggest you reading this article and fefactor your code.

    Best Regards,
    Li Wang

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 5, 2016 8:41 AM