Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Jim M. on March 17, 2016, 02:52:38 pm



Title: com.Util.CreateDigestString
Post by: Jim M. on March 17, 2016, 02:52:38 pm
I need to create an MD5 checksum as part of an xml file being submitted to the IRS.  MD5 is specifically required.

In version 2.5 I am using security.digest and I can specify that MD5 is the algorithm to use.

I need to do the same thing in 2.32 and 2.21.   The only function I can find there is com.Util.CreateDigestString

Can anyone confirm if this is my best option?

Can someone tell me what algorithm is uses?  I don't see any way to tell it what to use.  I do see that the function security.Digest.CreateDigestString creates a SHA1 digest so I'm guessing that the com.Util version does the same thing - but I need MD5.

Thanks for any guidance you can provide.



Title: Re: com.Util.CreateDigestString
Post by: Sisavanh S. on March 17, 2016, 04:43:08 pm
Hi,

I'm afraid you do not have the equivalent in 2.32 and 2.21.
An alternative is to use an external command that you launch with RUN, like openssl for example.

Best regards,
Sisa.


Title: Re: com.Util.CreateDigestString
Post by: Laurent G. on March 17, 2016, 08:57:36 pm
You can also look into using a Java utility signing method via our Java Bridge (introduced in 2.20) until you get all your programs upgraded to 2.50:
https://4js.com/online_documentation/fjs-fgl-manual-html/?path=fjs-fgl-manual#c_fgl_JavaBridge_001.html


Title: Re: com.Util.CreateDigestString
Post by: Jim M. on March 17, 2016, 09:06:53 pm
Thank you for your quick responses


Title: Re: com.Util.CreateDigestString
Post by: Reuben B. on March 17, 2016, 09:24:10 pm
Hi,

I'm afraid you do not have the equivalent in 2.32 and 2.21.
An alternative is to use an external command that you launch with RUN, like openssl for example.

Best regards,
Sisa.

As well as openssl, you may find commands such as md5 or md5sum on your O/S (or can be downloaded). 

Also use base.Channel.openPipe instead of RUN if you want to capture what is written to stdout

https://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassChannel_openPipe.html
https://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassChannel_example_2.html

I have also seen someone implement the md5 checksum calculation in 4gl if you want an interesting programming exercise :-)

Reuben