![]()  | 
  
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
 
      (PureBasic) Simple AES ECB DecryptionSee more Encryption ExamplesDecrypt 256-bit encrypted content.
 IncludeFile "CkCrypt2.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. crypt.i = CkCrypt2::ckCreate() If crypt.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Encrypted content (base64-encoded) ct.s = "d/95VziAnUNKkpXr3dJBFcQqAEDWlDkc7EU2jLkYPxmr6PpLRJlgHos+/Uy28CvJsmztQ3JkJAMukVoj46QJ/7RMuqLb31cSKd1ZvMzx9J9b6q0EkmPJcSfBhf2x7v5Qvq3lz1EIH7RM61cDGf+g9p4lt6FtU2MzCqtYD+Vr29voCn5WU1CnXmks64RrbyDA1DDHOx2deJ4Kn68+KoPM9tAw9kbf4HApL1nJYU3Mfzl+MnuHuB2kJpL5GqbuNvS+4QjxuwtNGuZEEY0gOS4RIvWl/XfkxtWHMkzsKy08AO792xDGer4rL4Q1NcfI/H2V" ; 256-bit AES key (literally the 32 us-ascii bytes of this string) key.s = "sQsPQYesBM5qEM5OSxicFatIiLM459Bu" ; Note: If your AES key is a string, and it's not clearly hex or base64, AND if the length of the string is the exact size of the AES key, ; then *literally* use the ascii chars as the AES key. CkCrypt2::setCkCryptAlgorithm(crypt, "aes") CkCrypt2::setCkCipherMode(crypt, "ecb") CkCrypt2::setCkKeyLength(crypt, 256) ; use the exact ascii bytes as the key. CkCrypt2::ckSetEncodedKey(crypt,key,"ascii") CkCrypt2::setCkEncodingMode(crypt, "base64") pt.s = CkCrypt2::ckDecryptStringENC(crypt,ct) Debug pt CkCrypt2::ckDispose(crypt) ProcedureReturn EndProcedure  | 
  ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.