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

DataFlex 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 Encryption
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

 

 

 

(DataFlex) ChartURL - Create a Signed URL

Demonstrates how to create a signed URL for ChartURL.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoCrypt
    String sKey
    String sToken
    String sSlug
    String sData
    Handle hoJson
    String sSig
    Handle hoSbUrl
    String sTemp1

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

    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End

    // Example key: "dek-d7a46236eda961a6c3c18ffcc6b077ba87d27e9ae85f7842c6d427c265dd5f69d5131308d93332353d4a55a4b1160fcf516515a4a9f0aa50fbf2d7a2e7d0f1c5"
    Move "charturl-sign-encrypt-key" To sKey
    // Example token: "dt-RwYN"
    Move "charturl-token" To sToken

    Move "weekly-activity" To sSlug
    Move '{ "options": {"data": {"columns": [["This Week",10,13],["Last Week",9,5]]}}}' To sData

    Set ComHashAlgorithm Of hoCrypt To "SHA256"
    Set ComMacAlgorithm Of hoCrypt To "HMAC"
    Get ComSetMacKeyString Of hoCrypt sKey To iSuccess
    Set ComEncodingMode Of hoCrypt To "base64"

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComLoad Of hoJson sData To iSuccess
    Get ComEmit Of hoJson To sTemp1
    Showln "json = " sTemp1

    Get ComEmit Of hoJson To sTemp1
    Get ComMacStringENC Of hoCrypt sTemp1 To sSig

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbUrl
    If (Not(IsComObjectCreated(hoSbUrl))) Begin
        Send CreateComObject of hoSbUrl
    End
    Get ComAppend Of hoSbUrl "https://charturl.com/i/" To iSuccess
    Get ComAppend Of hoSbUrl sToken To iSuccess
    Get ComAppend Of hoSbUrl "/" To iSuccess
    Get ComAppend Of hoSbUrl sSlug To iSuccess
    Get ComAppend Of hoSbUrl "?d=" To iSuccess
    Get ComEncodeString Of hoCrypt (ComEmit(hoJson)) "utf-8" "url" To sTemp1
    Get ComAppend Of hoSbUrl sTemp1 To iSuccess
    Get ComAppend Of hoSbUrl "&s=" To iSuccess
    Get ComEncodeString Of hoCrypt sSig "utf-8" "url" To sTemp1
    Get ComAppend Of hoSbUrl sTemp1 To iSuccess

    Get ComGetAsString Of hoSbUrl To sTemp1
    Showln "Signed URL: " sTemp1


End_Procedure

 

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