![]() |
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
(Delphi DLL) Get Base64 Public Key from Private KeyDemonstrates how to get the public key in base64 format from a private key. Note: This example requires Chilkat v11.0.0 or greater.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, BinData, PrivateKey, PublicKey; ... procedure TForm1.Button1Click(Sender: TObject); var success: Boolean; bd: HCkBinData; privKey: HCkPrivateKey; pubKey: HCkPublicKey; pubKeyBase64: PWideChar; begin success := False; // Load a private key from base64. bd := CkBinData_Create(); success := CkBinData_AppendEncoded(bd,'MHQCA....n0Q==','base64'); privKey := CkPrivateKey_Create(); success := CkPrivateKey_LoadAnyFormat(privKey,bd,''); if (success = False) then begin Memo1.Lines.Add(CkPrivateKey__lastErrorText(privKey)); Exit; end; pubKey := CkPublicKey_Create(); CkPrivateKey_ToPublicKey(privKey,pubKey); pubKeyBase64 := CkPublicKey__getEncoded(pubKey,True,'base64'); Memo1.Lines.Add(pubKeyBase64); CkBinData_Dispose(bd); CkPrivateKey_Dispose(privKey); CkPublicKey_Dispose(pubKey); end; |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.