Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) ChartURL - Create a Signed URLDemonstrates how to create a signed URL for ChartURL.
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.