Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Load PFX (PKCS#12) and List CertificatesLoads a PFX file (.pfx, .p12) and iterates over the certificates found within.
use chilkat(); $certStore = new chilkat::CkCertStore(); $pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"; $pfxPassword = "test"; $success = $certStore->LoadPfxFile($pfxPath,$pfxPassword); if ($success != 1) { print $certStore->lastErrorText() . "\r\n"; exit; } $numCerts = $certStore->get_NumCertificates(); print "PFX contains " . $numCerts . " certificates" . "\r\n"; if ($numCerts == 0) { exit; } for ($i = 0; $i <= ($numCerts - 1); $i++) { # cert is a CkCert $cert = $certStore->GetCertificate($i); if (!($cert eq null )) { print $i . ": (Common Name) " . $cert->subjectCN() . "\r\n"; print $i . ": (Serial Number) " . $cert->serialNumber() . "\r\n"; print $i . ": (Distinguished Name) " . $cert->subjectDN() . "\r\n"; } } |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.