Free Support Forum -

Can't get example to work

I’m following this example to test signing my URLs in Java:

I’m using the URL, appSID, and key specified in the example and running the same function:

String url =;
String key = 23e9d89a967a5f18142221fa8f7cbcd0;

byte[] keyBytes = key.getBytes();
SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
byte[] hexBytes = new Hex().encode(rawHmac);
String result = new String(hexBytes, "UTF-8");

At this point, the example says the result should be Z98TBrlwdtx3pTa6fWVD/Q0c2dE= but I am getting 67df1306b97076dc77a536ba7d6543fd0d1cd9d1

Obviously I need this to be correct before I can start using Saaspose. What is wrong?

Hi Andy,

Thanks for your inquiry. I would like to update you that you don’t need to prepare URL signing method. You can call an existing “sign” method available at the following link here. You just need to pass single URL parameter e.g. “”. You can download the Java SDK from here and please try the following source code below:



SaasposeApp.setAppKey("”); <o:p></o:p>

String signedURI = Utils.Sign(;<o:p></o:p>

System.out.println(Utils.StreamToString(Utils.ProcessCommand(signedURI, “GET”)));<o:p></o:p>

Note: Please sign up for the Saaspose trial account and try to use your own AppSID and AppKey.

Please let me know in case of further assistance and comments.