Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) ZATCA Load Certificate and Private Key from PEM FilesSee more ZATCA ExamplesDemonstrates how to load a certificate and private key from a pair of PEM files.
Use ChilkatAx-win32.pkg Procedure Test Handle hoCert Boolean iSuccess Variant vPrivKey Handle hoPrivKey String sTemp1 // The LoadFromFile method will automatically detect the file format.. Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadFromFile Of hoCert "qa_data/zatca/cert.pem" To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End Get ComSubjectCN Of hoCert To sTemp1 Showln sTemp1 // Load the private key. Get Create (RefClass(cComChilkatPrivateKey)) To hoPrivKey If (Not(IsComObjectCreated(hoPrivKey))) Begin Send CreateComObject of hoPrivKey End Get ComLoadPemFile Of hoPrivKey "qa_data/zatca/ec-secp256k1-priv-key.pem" To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoPrivKey To sTemp1 Showln sTemp1 Procedure_Return End Get ComKeyType Of hoPrivKey To sTemp1 Showln "Key Type: " sTemp1 // Associate the private key with the certificate. Get pvComObject of hoPrivKey to vPrivKey Get ComSetPrivateKey Of hoCert vPrivKey To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End Showln "Success." End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.