![]() |
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
(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_CkPrivateKey.h> #include <C_CkPublicKey.h> void ChilkatSample(void) { BOOL success; HCkPrivateKey pkey; HCkPublicKey pubKey; success = FALSE; pkey = CkPrivateKey_Create(); // Load the private key from an PEM file: success = CkPrivateKey_LoadPemFile(pkey,"private.pem"); if (success == FALSE) { printf("%s\n",CkPrivateKey_lastErrorText(pkey)); CkPrivateKey_Dispose(pkey); return; } pubKey = CkPublicKey_Create(); CkPrivateKey_ToPublicKey(pkey,pubKey); success = CkPublicKey_SavePemFile(pubKey,FALSE,"pubKey.pem"); if (success != TRUE) { printf("%s\n",CkPublicKey_lastErrorText(pubKey)); CkPublicKey_Dispose(pubKey); CkPrivateKey_Dispose(pkey); CkPublicKey_Dispose(pubKey); return; } printf("Success.\n"); CkPrivateKey_Dispose(pkey); CkPublicKey_Dispose(pubKey); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.