Chilkat HOME ASP Visual Basic VB.NET C# C C++ MFC Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
Create PFX from PEM (Certificate and Private Key Files)Create a PFX file from a pair of PEM files (the certificate PEM and private key PEM). <?php $cert = new COM("Chilkat.Cert"); $success = $cert->LoadFromFile('chilkat_cert.pem'); if ($success != true) { print $cert->lastErrorText() . "\n"; exit; } $privkey = new COM("Chilkat.PrivateKey"); // If the private key PEM is encrypted, call LoadEncryptedPemFile instead. $success = $privkey->LoadPemFile('chilkat_pkey.pem'); if ($success != true) { print $privkey->lastErrorText() . "\n"; exit; } $success = $cert->SetPrivateKey($privkey); if ($success != true) { print $cert->lastErrorText() . "\n"; exit; } // Now export to a PFX: $bIncludeCertsInChain = false; $success = $cert->ExportToPfxFile('chilkat2.pfx','myPassword',$bIncludeCertsInChain); if ($success != true) { print $cert->lastErrorText() . "\n"; exit; } print 'PFX created!' . "\n"; ?> |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.