(Unicode C++) Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey
Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey. Note: This example requires Chilkat v11.0.0 or greater.
#include <CkCertW.h>
#include <CkPrivateKeyW.h>
void ChilkatSample(void)
{
CkCertW cert;
// ------------------------------------------------------------------------
// The ExportPrivateKey method is deprecated:
CkPrivateKeyW *privatekeyObj = cert.ExportPrivateKey();
if (cert.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",cert.lastErrorText());
return;
}
// ...
// ...
delete privatekeyObj;
// ------------------------------------------------------------------------
// Do the equivalent using GetPrivateKey.
// Your application creates a new, empty PrivateKey object which is passed
// in the last argument and filled upon success.
CkPrivateKeyW privatekeyOut;
bool success = cert.GetPrivateKey(privatekeyOut);
if (success == false) {
wprintf(L"%s\n",cert.lastErrorText());
return;
}
}
|