Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
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
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(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-win32.pkg

Procedure Test
    Handle hoCrypt
    String sKey
    String sToken
    String sSlug
    String sData
    Boolean iSuccess
    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-2024 Chilkat Software, Inc. All Rights Reserved.