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
(PowerBuilder) IKOF Generation Code for Montenegro Fiscalization ServiceDemonstrates computing the IKOF MD5 summary value as described in section 4.3 of this document: https://poreskauprava.gov.me/ResourceManager/FileDownload.aspx?rId=416042&rType=2
integer li_rc string ls_ConcatenatedParams oleobject loo_Pfx integer li_Success oleobject loo_PrivKey oleobject loo_Rsa string ls_HexSig oleobject loo_Crypt oleobject loo_Bd string ls_Md5_summary // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. ls_ConcatenatedParams = "12345678|2019-06-12T17:05:43+02:00|9952|bb123bb1231|cc123cc1231|ss123ss123|199.01" // Get the private key from a pfx file. loo_Pfx = create oleobject // Use "Chilkat_9_5_0.Pfx" for versions of Chilkat < 10.0.0 li_rc = loo_Pfx.ConnectToNewObject("Chilkat.Pfx") if li_rc < 0 then destroy loo_Pfx MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Pfx.LoadPfxFile("qa_data/pfx/cert_test123.pfx","test123") if li_Success <> 1 then Write-Debug loo_Pfx.LastErrorText destroy loo_Pfx return end if loo_PrivKey = loo_Pfx.GetPrivateKey(0) if loo_Pfx.LastMethodSuccess = 0 then Write-Debug loo_Pfx.LastErrorText destroy loo_Pfx return end if // Create IIC signature according to RSASSA-PKCS-v1_5 using SHA256 loo_Rsa = create oleobject // Use "Chilkat_9_5_0.Rsa" for versions of Chilkat < 10.0.0 li_rc = loo_Rsa.ConnectToNewObject("Chilkat.Rsa") li_Success = loo_Rsa.ImportPrivateKeyObj(loo_PrivKey) if li_Success = 0 then Write-Debug loo_Rsa.LastErrorText destroy loo_Pfx destroy loo_Rsa return end if // PKCS-v1_5 is used by default. loo_Rsa.EncodingMode = "hex" loo_Rsa.Charset = "utf-8" ls_HexSig = loo_Rsa.SignStringENC(ls_ConcatenatedParams,"sha256") Write-Debug "Signature value result is: " + ls_HexSig // Compute the MD5 hash of the bytes. loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") loo_Crypt.EncodingMode = "hex" loo_Crypt.HashAlgorithm = "md5" loo_Bd = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData") loo_Bd.AppendEncoded(ls_HexSig,"hex") ls_Md5_summary = loo_Crypt.HashBdENC(loo_Bd) Write-Debug "MD5 summary value is: " + ls_Md5_summary destroy loo_PrivKey destroy loo_Pfx destroy loo_Rsa destroy loo_Crypt destroy loo_Bd |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.