SOAP Web Services Code Samples

Modified on Thu, 11 Apr, 2019 at 9:57 AM

C#

PHP

HMAC-MD5 Authentication

The following code samples provide examples for creating a HMAC-MD5 encryption algorithms in JavaScript and Perl for Forte's SOAP web services and Secure Web Pay application, specifically the pg_ts_hash (SWP) and TSHash (SOAP web services) parameters. NOTE: The JavaScript code should only be used internally or on a secure intranet as the Secret Key is viewable to anyone who views the HTML source code. 

Perl

#!/usr/bin/perl

use Digest::HMAC_MD5 qw(hmac_md5_hex);

# generate hex hash of message with secret key
my $digest = hmac_md5_hex("MESSAGE_TEXT","SECRET_KEY");

print $digest;

JavaScript

<script type="text/javascript" src="http://crypto-js.googlecode.com/files/2.2.0-crypto-md5.js"></script>
<script type="text/javascript" src="http://crypto-js.googlecode.com/files/2.2.0-hmac-min.js"></script>
<script type="text/javascript">
     // Generate hex hash of message with secret key
     var hmac = Crypto.HMAC(Crypto.MD5, "MESSAGE", "SECRET_KEY");
</script>



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article