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
(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
#include <C_CkPrivateKeyW.h> #include <C_CkPublicKeyW.h> void ChilkatSample(void) { HCkPrivateKeyW pkey; BOOL success; HCkPublicKeyW pubKey; pkey = CkPrivateKeyW_Create(); // Load the private key from an PEM file: success = CkPrivateKeyW_LoadPemFile(pkey,L"private.pem"); if (success != TRUE) { wprintf(L"%s\n",CkPrivateKeyW_lastErrorText(pkey)); CkPrivateKeyW_Dispose(pkey); return; } pubKey = CkPrivateKeyW_GetPublicKey(pkey); if (CkPrivateKeyW_getLastMethodSuccess(pkey) == FALSE) { wprintf(L"%s\n",CkPrivateKeyW_lastErrorText(pkey)); CkPrivateKeyW_Dispose(pkey); return; } success = CkPublicKeyW_SavePemFile(pubKey,FALSE,L"pubKey.pem"); if (success != TRUE) { wprintf(L"%s\n",CkPublicKeyW_lastErrorText(pubKey)); CkPublicKeyW_Dispose(pubKey); CkPrivateKeyW_Dispose(pkey); return; } wprintf(L"Success.\n"); CkPublicKeyW_Dispose(pubKey); CkPrivateKeyW_Dispose(pkey); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.