![]() |
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
(DataFlex) RSA Sign using Base64 Private KeySigns a string using a non-encrypted RSA private key in base64 encoding. Returns the RSA signature as a base64 string. Note: This example requires Chilkat v11.0.0 or greater.
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Variant vPrivKey Handle hoPrivKey Handle hoSbPem Handle hoRsa Variant vBd Handle hoBd String sStrOriginal String sTemp1 Move False To iSuccess // This requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatPrivateKey)) To hoPrivKey If (Not(IsComObjectCreated(hoPrivKey))) Begin Send CreateComObject of hoPrivKey End Get Create (RefClass(cComChilkatStringBuilder)) To hoSbPem If (Not(IsComObjectCreated(hoSbPem))) Begin Send CreateComObject of hoSbPem End Get ComAppendLine Of hoSbPem "-----BEGIN RSA PRIVATE KEY-----" True To iSuccess Get ComAppendLine Of hoSbPem "MIIC .... j5A==" True To iSuccess Get ComAppendLine Of hoSbPem "-----END RSA PRIVATE KEY-----" True To iSuccess Get ComGetAsString Of hoSbPem To sTemp1 Get ComLoadPem Of hoPrivKey sTemp1 To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoPrivKey To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatRsa)) To hoRsa If (Not(IsComObjectCreated(hoRsa))) Begin Send CreateComObject of hoRsa End Get pvComObject of hoPrivKey to vPrivKey Get ComUsePrivateKey Of hoRsa vPrivKey To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoRsa To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatBinData)) To hoBd If (Not(IsComObjectCreated(hoBd))) Begin Send CreateComObject of hoBd End Get ComAppendString Of hoBd "12345678" "utf-8" To iSuccess Get pvComObject of hoBd to vBd Get ComSignRawBd Of hoRsa vBd To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoRsa To sTemp1 Showln sTemp1 Procedure_Return End // Get the base64 RSA signature. Get ComGetEncoded Of hoBd "base64" To sTemp1 Showln sTemp1 Get pvComObject of hoBd to vBd Get ComVerifyRawBd Of hoRsa vBd To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoRsa To sTemp1 Showln sTemp1 Procedure_Return End Get ComGetString Of hoBd "utf-8" To sStrOriginal Showln sStrOriginal End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.