Sample code for 30+ languages & platforms
PHP ActiveX Requires Chilkat v11.0.0+

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$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.

$privatekeyOut = new COM("Chilkat.PrivateKey");
$success = $cert->GetPrivateKey($privatekeyOut);
if ($success == 0) {
    print $cert->LastErrorText . "\n";
    exit;
}


?>