Sample code for 30+ languages & platforms
PHP ActiveX

Example: Crypt2.SetSigningCert2 method

This example loads the certificate and private key from PEM files:

PEM Format

Certificate file (cert.pem or cert.crt):

-----BEGIN CERTIFICATE-----
MIID... (base64-encoded data)
-----END CERTIFICATE-----

Private key file (key.pem or key.key):

-----BEGIN PRIVATE KEY-----
MIIE... (base64-encoded data)
-----END PRIVATE KEY-----

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$cert = new COM("Chilkat.Cert");
$success = $cert->LoadFromFile('c:/certs_and_keys/certAbc.pem');
// Assume success...

$privKey = new COM("Chilkat.PrivateKey");
$success = $privKey->LoadAnyFormatFile('c:/certs_and_keys/certAbc_key.pem');
// Assume success...

$crypt = new COM("Chilkat.Crypt2");

$success = $crypt->SetSigningCert2($cert,$privKey);
if ($success == 0) {
    print $crypt->LastErrorText . "\n";
    exit;
}

print 'Success.' . "\n";

?>