![]() |
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) Duplicate openssl pkey -in private.pem -pubout -out pubkey.pemHow to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command: openssl pkey -in private.pem -pubout -out pubkey.pem Note: This example requires Chilkat v11.0.0 or greater.
#include <C_CkPrivateKeyW.h> #include <C_CkPublicKeyW.h> void ChilkatSample(void) { BOOL success; HCkPrivateKeyW pkey; HCkPublicKeyW pubKey; success = FALSE; pkey = CkPrivateKeyW_Create(); // Load the private key from an PEM file: success = CkPrivateKeyW_LoadPemFile(pkey,L"private.pem"); if (success == FALSE) { wprintf(L"%s\n",CkPrivateKeyW_lastErrorText(pkey)); CkPrivateKeyW_Dispose(pkey); return; } pubKey = CkPublicKeyW_Create(); CkPrivateKeyW_ToPublicKey(pkey,pubKey); success = CkPublicKeyW_SavePemFile(pubKey,FALSE,L"pubKey.pem"); if (success != TRUE) { wprintf(L"%s\n",CkPublicKeyW_lastErrorText(pubKey)); CkPublicKeyW_Dispose(pubKey); CkPrivateKeyW_Dispose(pkey); CkPublicKeyW_Dispose(pubKey); return; } wprintf(L"Success.\n"); CkPrivateKeyW_Dispose(pkey); CkPublicKeyW_Dispose(pubKey); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.