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