|  | 
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
| (Unicode C) 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.
 #include <C_CkCertW.h> #include <C_CkPrivateKeyW.h> void ChilkatSample(void) { HCkCertW cert; BOOL success; HCkPrivateKeyW privKey; // The LoadFromFile method will automatically detect the file format.. cert = CkCertW_Create(); success = CkCertW_LoadFromFile(cert,L"qa_data/zatca/cert.pem"); if (success != TRUE) { wprintf(L"%s\n",CkCertW_lastErrorText(cert)); CkCertW_Dispose(cert); return; } wprintf(L"%s\n",CkCertW_subjectCN(cert)); // Load the private key. privKey = CkPrivateKeyW_Create(); success = CkPrivateKeyW_LoadPemFile(privKey,L"qa_data/zatca/ec-secp256k1-priv-key.pem"); if (success != TRUE) { wprintf(L"%s\n",CkPrivateKeyW_lastErrorText(privKey)); CkCertW_Dispose(cert); CkPrivateKeyW_Dispose(privKey); return; } wprintf(L"Key Type: %s\n",CkPrivateKeyW_keyType(privKey)); // Associate the private key with the certificate. success = CkCertW_SetPrivateKey(cert,privKey); if (success != TRUE) { wprintf(L"%s\n",CkCertW_lastErrorText(cert)); CkCertW_Dispose(cert); CkPrivateKeyW_Dispose(privKey); return; } wprintf(L"Success.\n"); CkCertW_Dispose(cert); CkPrivateKeyW_Dispose(privKey); } | ||||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.