![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Import a Certificate (.cer file) into a Windows Certificate StoreSee more Certificates ExamplesDemonstrates how to import a certificate (without private key) into a Windows certificate store.
integer li_rc oleobject loo_Cert integer li_Success oleobject loo_CertStoreCU integer li_ReadOnlyFlag loo_Cert = create oleobject li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert") if li_rc < 0 then destroy loo_Cert MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Cert.LoadFromFile("qa_data/certs/example.cer") if li_Success = 0 then Write-Debug loo_Cert.LastErrorText destroy loo_Cert return end if loo_CertStoreCU = create oleobject li_rc = loo_CertStoreCU.ConnectToNewObject("Chilkat.CertStore") li_ReadOnlyFlag = 0 // "CurrentUser" and "My" are the exact keywords to select your user account's certificate store. li_Success = loo_CertStoreCU.OpenWindowsStore("CurrentUser","My",li_ReadOnlyFlag) if li_Success = 0 then Write-Debug "Failed to open the CurrentUser/My certificate store for read/write." destroy loo_Cert destroy loo_CertStoreCU return end if // Import the certificate into the CurrentUser/My certificate store. li_Success = loo_CertStoreCU.AddCertificate(loo_Cert) if li_Success = 0 then Write-Debug loo_CertStoreCU.LastErrorText destroy loo_Cert destroy loo_CertStoreCU return end if Write-Debug "Imported " + loo_Cert.SubjectCN Write-Debug "Success." destroy loo_Cert destroy loo_CertStoreCU |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.