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
|
PFX to PEM (Certificate and Private Key Files)Export a certificate and private key from a PFX to a pair of PEM files. LOCAL lnSuccess LOCAL loCertStore LOCAL lcPassword LOCAL loCert LOCAL loPvkey loCertStore = CreateObject('Chilkat.CertStore') * Load the PFX file into a certificate store object lcPassword = "myPassword" lnSuccess = loCertStore.LoadPfxFile("chilkat.pfx",lcPassword) IF (lnSuccess <> 1) THEN =MESSAGEBOX(loCertStore.LastErrorText) QUIT ENDIF * Find the cert to be exported by the subject: loCert = loCertStore.FindCertBySubject("Chilkat Software, Inc.") IF (loCert = NULL ) THEN =MESSAGEBOX("Certificate not found.") QUIT ENDIF * Does this cert have a private key? IF (loCert.HasPrivateKey() = 1) THEN * Get the private key. loPvkey = loCert.ExportPrivateKey() * Export the private key to a PEM file: lnSuccess = loPvkey.SaveRsaPemFile("chilkat_pkey.pem") IF (lnSuccess <> 1) THEN =MESSAGEBOX(loPvkey.LastErrorText) QUIT ENDIF RELEASE loPvkey ENDIF * Save the cert to a PEM file: lnSuccess = loCert.ExportCertPemFile("chilkat_cert.pem") IF (lnSuccess <> 1) THEN =MESSAGEBOX(loCert.LastErrorText) QUIT ENDIF RELEASE loCert |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser