Reply
Contributor
Posts: 10
Registered: ‎07-23-2014

Correct Finger print not getting generated

[ Edited ]

Hi,

 

I have written java code to create a unique fingerprint but I am seeing that the finger print generated does not map with one genretaed by Authorize.net tool

 

Finger print from java code:                          c3063337bb38216506b62140d3d2315e

Finge print from Authorize error code tool: 3e27938b0dc41131b977edc13c9b8c15

 

Due to which I am getting error code 99 when opening the SIM form, can you please let me know why this 2 finger print do not match.

 

Java code

 

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class test1 {
/**
* @Param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(hmacDigest("5H4P6xnv^78656712^1417088591^20.0", "****", "HmacMD5"));
}
public static String hmacDigest(String msg, String keyString, String algo) {
String digest = null;
try {
SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), algo);
Mac mac = Mac.getInstance(algo);
mac.init(key);
byte[] bytes = mac.doFinal(msg.getBytes("ASCII"));
StringBuffer hash = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(0xFF & bytes[i]);
if (hex.length() == 1) {
hash.append('0');
}
hash.append(hex);
}
digest = hash.toString();
} catch (UnsupportedEncodingException e) {
} catch (InvalidKeyException e) {
} catch (NoSuchAlgorithmException e) {
}
return digest;
}
}

 

Administrator Administrator
Administrator
Posts: 563
Registered: ‎08-03-2011

Re: Correct Finger print not getting generated

 

Hi nitinb123,

 

Please make sure to include the final caret seperator between the amount and (optional) currency code.

 

Thanks,

Joy