![]() |
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
(VB.NET) Duplicating OpenSSL rsautl (creating RSA signatures)Demonstrates how to duplicate OpenSSL rsautil RSA signatures. The Chilkat RSA component's methods for creating RSA signatures (SignBytes, SignBytesENC, SignString, and SignStringENC) are very different from OpenSSL's rsautl command. First, we'll explain what Chilkat's signing methods do, and then what OpenSSL's rsautl does. New signing methods have been added to Chilkat RSA to duplicate OpenSSL rsautl: OpenSslSignBytes, OpenSslSignBytesENC, OpenSslSignString, and OpenSslSignStringENC.
Here's what Chilkat's RSA Sign* methods do:
OpenSSL rsautl is very different. Here's what it does:
Note: This example requires Chilkat v11.0.0 or greater.
Dim success As Boolean = False ' This example assumes the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim privKey As New Chilkat.PrivateKey ' Load the private key from an RSA PEM file: success = privKey.LoadPemFile("private.pem") If (success = False) Then Debug.WriteLine(privKey.LastErrorText) Exit Sub End If Dim rsa As New Chilkat.Rsa success = rsa.UsePrivateKey(privKey) If (success = False) Then Debug.WriteLine(rsa.LastErrorText) Exit Sub End If Dim strData As String = "secret" Dim bd As New Chilkat.BinData bd.AppendString(strData,"utf-8") success = rsa.SignRawBd(bd) Dim hexSig As String = bd.GetEncoded("hex") Debug.WriteLine(hexSig) ' Recover the data using the corresponding public key: Dim pubKey As New Chilkat.PublicKey ' Load the public key from a PEM file: success = pubKey.LoadFromFile("public.pem") If (success = False) Then Debug.WriteLine(pubKey.LastErrorText) Exit Sub End If Dim rsa2 As New Chilkat.Rsa success = rsa2.UsePublicKey(pubKey) If (success = False) Then Debug.WriteLine(rsa2.LastErrorText) Exit Sub End If Dim bd2 As New Chilkat.BinData bd2.AppendEncoded(hexSig,"hex") ' Recover the original data. success = rsa2.VerifyRawBd(bd2) If (success = False) Then Debug.WriteLine(rsa2.LastErrorText) Exit Sub End If Dim originalData As String = bd2.GetString("utf-8") Debug.WriteLine(originalData) |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.