![]() |
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
(DataFlex) 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.
Use ChilkatAx-win32.pkg Procedure Test Variant vCert Handle hoCert Boolean iSuccess Handle hoCertStoreCU Boolean iReadOnlyFlag String sTemp1 Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadFromFile Of hoCert "qa_data/certs/example.cer" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatCertStore)) To hoCertStoreCU If (Not(IsComObjectCreated(hoCertStoreCU))) Begin Send CreateComObject of hoCertStoreCU End Move False To iReadOnlyFlag // "CurrentUser" and "My" are the exact keywords to select your user account's certificate store. Get ComOpenWindowsStore Of hoCertStoreCU "CurrentUser" "My" iReadOnlyFlag To iSuccess If (iSuccess = False) Begin Showln "Failed to open the CurrentUser/My certificate store for read/write." Procedure_Return End // Import the certificate into the CurrentUser/My certificate store. Get pvComObject of hoCert to vCert Get ComAddCertificate Of hoCertStoreCU vCert To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCertStoreCU To sTemp1 Showln sTemp1 Procedure_Return End Get ComSubjectCN Of hoCert To sTemp1 Showln "Imported " sTemp1 Showln "Success." End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.