(PHP ActiveX) 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.
<?php
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Cert')
$cert = new COM("Chilkat.Cert");
// ------------------------------------------------------------------------
// The ExportPrivateKey method is deprecated:
// privatekeyObj is a Chilkat.PrivateKey
$privatekeyObj = $cert->ExportPrivateKey();
if ($cert->LastMethodSuccess == 0) {
print $cert->LastErrorText . "\n";
exit;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using GetPrivateKey.
// Your application creates a new, empty PrivateKey object which is passed
// in the last argument and filled upon success.
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.PrivateKey')
$privatekeyOut = new COM("Chilkat.PrivateKey");
$success = $cert->GetPrivateKey($privatekeyOut);
if ($success == 0) {
print $cert->LastErrorText . "\n";
exit;
}
?>
|