Hi All,
I am trying to validate that a file we are being sent matches a checksum that is also being provided. The checksum has been calculated by running the command prompt "certutil -hashfile {filename} MD5" and this provides me with a 32 character string.
Is there a function inbuilt in this component that allows me to run across the file and receive a code to be matched to validate that the file hasnt been tampered with?
I have tried the "ComputeHash" function passing my file binary in (converted from BinaryDataToText) and "MD5" in the Algorithm but doesnt seem to match.
Any advise would be great
Dan
Hi!Although the original post is from December 2020 and now is March 2023, I was running into the same problems as Daniel Asserati when trying to calculate an MD5 Hash of a file using the action "ComputeHash" from CryptoAPI.When converting the Binary Data of the file to Text to then supply to the ComputeHash action, whatever encoding I would use (UTF-8, UTF-16, UTF-32, ASCII), the resulting hash would never match the result from running the command:
> certutil -hashfile <filename> MD5
or by using any other online tool like:
https://emn178.github.io/online-tools/md5_checksum.html
I investigated the code in the extension of CryptoAPI and the best solution would be to build an action that would receive the binary data of the file and output the MD5 Hash, avoiding any need to convert binary data to text.Fortunately it already existed a simple component that did just that:
File MD5https://www.outsystems.com/forge/component-overview/6256/
It exposes an action "GetFileMD5" that receives a binary data and returns an MD5 Hash in hexadecimal format, for example: 9729281065652EFAAF3EA55695B5212E
Hope this information helps anyone in the future.
--Tiago Bernardo
Hi Daniel,
With powershell component you can validate any file directly on the server with certutil.
Sample: https://cesar-mateus.outsystemscloud.com/WebAppsTests/MD5Checksum
Component: Powershell Commander
Regards
very useful, thank you César