Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python 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. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% set certStore = Server.CreateObject("Chilkat.CertStore") ' Load the PFX file into a certificate store object password = "myPassword" success = certStore.LoadPfxFile("chilkat.pfx",password) If (success <> 1) Then Response.Write certStore.LastErrorText & "<br>" End If ' Find the cert to be exported by the subject: ' cert is a Chilkat.Cert Set cert = certStore.FindCertBySubject("Chilkat Software, Inc.") If (cert Is Nothing ) Then Response.Write "Certificate not found." & "<br>" End If ' Does this cert have a private key? If (cert.HasPrivateKey() = 1) Then ' Get the private key. ' pvkey is a Chilkat.PrivateKey Set pvkey = cert.ExportPrivateKey() ' Export the private key to a PEM file: success = pvkey.SaveRsaPemFile("chilkat_pkey.pem") If (success <> 1) Then Response.Write pvkey.LastErrorText & "<br>" End If End If ' Save the cert to a PEM file: success = cert.ExportCertPemFile("chilkat_cert.pem") If (success <> 1) Then Response.Write cert.LastErrorText & "<br>" End If %> </body> </html> |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.