In the implementations I’ve been involved, I solved the problem by setting the MAC fields with a dummy place holder, and then adjusting it in an ISOFilter.
i.e. the filter would use code like this:
public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt)
throws VetoException
{
try {
m.set (128, sm.generateEDE_MAC (generateMockImage(channel, m), tak));
} catch (ISOException e) {
evt.addMessage (e);
throw new VetoException (e);
}
return m;
}
private byte[] generateMockImage (ISOChannel channel, ISOMsg m)
throws ISOException
{
byte[] msg = m.pack();
int offset = 4 + (m.getMaxField() > 64 ? 16 : 8);
ByteBuffer buf = ByteBuffer.allocate (msg.length - offset);
buf.put (msg, offset, msg.length - offset);
return buf.array();
}
Hope this helps.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
Join us in IRC at http://webchat.freenode.net/?channels=jpos
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cd023b7d-8919-4f5f-80f7-54316c27ef3f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
But your solution made me think a little, and I think I can do it by packing the message and copy the byte array excluding the last 4 (for this implementation) bytes:)
Exactly. You set a dummy MAC field so that jPOS properly sets the bitmap, then you don’t take that last part into account when computing the MAC. Good luck!
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/2eb27f45-5d24-4fd0-80a4-dd3aef57a1ca%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dmg%3DgWu8Un1Hmn4q0YpDW-NJ2pYDCp494Hh8Pbmy9mdUw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefBzKgenwF4%2BbUvsGjMVjSh9UUpkWqjkjvQ%2BN4QR6ne%3D-w%40mail.gmail.com.
create a new binary field packager that could produce no output for a zero-length byte array.
packedMsg[9] = (byte) (packedMsg[9] ^ 0x01);
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
Join us in IRC at http://webchat.freenode.net/?channels=jpos
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/d5357e12-a961-4311-a68d-40e5b19cfd3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.