Closed micro24 closed 9 years ago
Hi Farnaz!
For which purpose do you need the MAC? Usually there is no MAC computation needed for offline authorization. In case of online authorization, you usually compute a MAC over the ISO 8583 messages. The standard algorithm for MAC is 3DES CBC, as far as I know you can compute it with plain Java - if not try http://www.bouncycastle.org/. But if you're needing MAC for online authorization, you should get more detailed information from your Issuer.
Best regards, Andreas
Hi
Thank you for your answering,I know that i can calculate MAC with java and bouncycastle but i want to calculate mac with Device(XFS). I calculated PIN BLOCK with your application.I have all of the keys for example Master Key,... Does your application supports this feature? or How can i use your application for generating MAC?
Best Regards Farnaz
In your Project I write a CryptClass that extends from Struct with below fields:
private LPSTR key = new LPSTR();
private LPSTR keyEncKey = new LPSTR();
private LPSTR startValueKey = new LPSTR();
private LPSTR startValue = new LPSTR();
private BYTE padding = new BYTE();
private BYTE compression = new BYTE();
private LPSTR cryptData = new LPSTR();
private WORD mode = new WORD();
private WORD algorithm = new WORD();
I fill fields and send command with below code this code writes in a class( this class implements XfsEventNotification) but after excute(below code) i get this error: "at.o2xfs.xfs.XfsServiceException: WFS_ERR_INTERNAL_ERROR(-15)" ,
public void execute() {
XfsExecuteCommand command = new XfsExecuteCommand(pinService,
PINExecuteCommand.CRYPT, pinCrypt);
try {
command.execute(this);
} catch (XfsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
please tell me. How can i solve my problem?
Best Regards Farnaz
I've already computed MAC with WFS_CMD_PIN_CRYPT, I try to push the code later.
Thank you for your response.
I pushed the necessary Struct and Command, some method like the following should do the trick:
public byte[] createMAC(byte[] data) throws XfsException {
WfsPinCrypt pinCrypt = new WfsPinCrypt();
pinCrypt.allocate();
pinCrypt.setMode(PinMode.ENCRYPT);
pinCrypt.setKey(...);
pinCrypt.setAlgorithm(PINAlgorithm.TRIDESMAC);
pinCrypt.setStartValue(new byte[8]);
pinCrypt.setCryptData(data);
return new PinCryptCommand(pinService, pinCrypt).call().getData();
}
Note, you must specify the key (setKey) loaded in the PIN Pad. Also the start value is, as far as I know, used for padding. Since the data is already padded, I simply use a empty array.
Hi Thank you for your efforts and follow.
Hi I am using your code, it is very well, thank 's for your code but i have a problem, i do not know how can i generate MAC(message authentication code) ? please guidance me.
Best Regards Farnaz