Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

PowerBuilder Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(PowerBuilder) Duplicate openssl dgst -sha256 -verify pubKey.pem -signature signature.sig in.dat

Demonstrates how to duplicate this OpenSSL command:

openssl dgst -sha256 -verify pubKey.pem -signature signature.sig in.dat
The in.dat file contains the original data that was signed, and can contain text or binary data of any type. The above OpenSSL command does the following:
  1. Creates a SHA256 digest of the contents of the input file.
  2. Verifies the SHA256 digest using the public key.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_PubKey
integer li_Success
oleobject loo_BdFileData
oleobject loo_BdSig
oleobject loo_Rsa

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_PubKey = create oleobject
li_rc = loo_PubKey.ConnectToNewObject("Chilkat_9_5_0.PublicKey")
if li_rc < 0 then
    destroy loo_PubKey
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Load the public key from an PEM file:
li_Success = loo_PubKey.LoadOpenSslPemFile("pubKey.pem")
if li_Success <> 1 then
    Write-Debug loo_PubKey.LastErrorText
    destroy loo_PubKey
    return
end if

// Load the data of the original file that was signed.
loo_BdFileData = create oleobject
li_rc = loo_BdFileData.ConnectToNewObject("Chilkat_9_5_0.BinData")

li_Success = loo_BdFileData.LoadFile("in.dat")

// Load the signature.
loo_BdSig = create oleobject
li_rc = loo_BdSig.ConnectToNewObject("Chilkat_9_5_0.BinData")

li_Success = loo_BdSig.LoadFile("signature.sig")

loo_Rsa = create oleobject
li_rc = loo_Rsa.ConnectToNewObject("Chilkat_9_5_0.Rsa")

// Import the public key into the RSA component:
li_Success = loo_Rsa.ImportPublicKeyObj(loo_PubKey)
if li_Success <> 1 then
    Write-Debug loo_Rsa.LastErrorText
    destroy loo_PubKey
    destroy loo_BdFileData
    destroy loo_BdSig
    destroy loo_Rsa
    return
end if

// OpenSSL uses big-endian.
loo_Rsa.LittleEndian = 0

li_Success = loo_Rsa.VerifyBd(loo_BdFileData,"sha256",loo_BdSig)
if li_Success <> 1 then
    Write-Debug loo_Rsa.LastErrorText
    Write-Debug "The signature was invalid."
    destroy loo_PubKey
    destroy loo_BdFileData
    destroy loo_BdSig
    destroy loo_Rsa
    return
end if

Write-Debug "The signature was verified."


destroy loo_PubKey
destroy loo_BdFileData
destroy loo_BdSig
destroy loo_Rsa

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.