简体   繁体   English

解析iso8583消息时出现问题

[英]Problems parsing iso8583 message

I've download code from here https://github.com/vikrantlabde/iso8583-Java and after some modifications I'm parsing almost fine my fields.... I defined the schema like this: 我从这里下载代码https://github.com/vikrantlabde/iso8583-Java并经过一些修改我正在解析几乎我的字段....我定义了这样的架构:

ISOSCHEMA.put("1","BITMAP");
ISOSCHEMA.put("2","NUM-2-19-0_0");
ISOSCHEMA.put("3","NUMERIC-0-6-0_0");
ISOSCHEMA.put("4","NUMERIC-0-12-0_0");
ISOSCHEMA.put("7","NUMERIC-0-10-0_0");
ISOSCHEMA.put("11","NUMERIC-0-6-0_0");
ISOSCHEMA.put("12","NUMERIC-0-6-0_0");
ISOSCHEMA.put("13","NUMERIC-0-4-0_0");
ISOSCHEMA.put("22","NUMERIC-0-3-0_0");
ISOSCHEMA.put("23","NUMERIC-0-3-0_0");
ISOSCHEMA.put("35","NUM-2-37-0_0");
ISOSCHEMA.put("41","FCHAR-0-8-0_0");
ISOSCHEMA.put("49","FCHAR-0-3-0_0");
ISOSCHEMA.put("55","NUM-3-999-0_0");

The problem is the field 55 that is a binary field. 问题是字段55是二进制字段。 The standard documentation says it: 标准文档说:

55 Reserved ISO B 255 LLLVAR (ISO DOCUMENTATION) 55保留ISO B 255 LLLVAR(ISO文档)

I'm having an error parsing a string that has the bitmap turned on for the field 55. 我正在解析为字段55打开位图的字符串时出错。

I'm having from the output: 820200409F36020004950500000000009A031409039C01005F2A020 978 9F02060000000005009F03060000000000009F10201F430200200000000000000000045895000000000000000000000000000000009F260840D26C4BA5577CFB9F2701809F370443DD7E879F1A0202509F3303E0B0C8 我输出的是:820200409F36020004950500000000009A031409039C01005F2A020 978 9F02060000000005009F03060000000000009F10201F43020020000000000000000000000895000000000000000000000000000000009F260840D26C4BA5577CFB9F2701809F370443DD7E879F1A0202509F3303E0B0C8

But I expect: 820200409F36020004950500000000009A031409039C01005F2A020 124 9F02060000000005009F03060000000000009F10201F430200200000000000000000045895000000000000000000000000000000009F260840D26C4BA5577CFB9F2701809F370443DD7E879F1A0202509F3303E0B0C8 但我期待:820200409F36020004950500000000009A031409039C01005F2A020 124 9F02060000000005009F03060000000000009F10201F4302002000000000000000000000000009F260840D26C0000BA000000

The length of the iso payload converted is highly different too... 转换的iso有效负载的长度也大不相同......

The program output is: 程序输出是:

What I expect is: 30313030723806002080820031363635343332313131323233333434353530303030303030303030303030303030303131303136313833343236303032333934313333343330313031363037313030313337363534333231313132323333343435353D33313130323230303039323833303031303130323834303137343039313234313135820200409F36020004950500000000009A031409039C01005F2A0201249F02060000000005009F03060000000000009F10201F430200200000000000000000045895000000000000000000000000000000009F260840D26C4BA5577CFB9F2701809F370443DD7E879F1A0202509F3303E0B0C8 我想到的是:30313030723806002080820031363635343332313131323233333434353530303030303030303030303030303030303131303136313833343236303032333934313333343330313031363037313030313337363534333231313132323333343435353D33313130323230303039323833303031303130323834303137343039313234313135820200409F36020004950500000000009A031409039C01005F2A0201249F02060000000005009F03060000000000009F10201F430200200000000000000000045895000000000000000000000000000000009F260840D26C4BA5577CFB9F2701809F370443DD7E879F1A0202509F3303E0B0C8

One advice is: I have to make the explicit conversion to hex from the resultant byte[] and viceversa. 一个建议是:我必须从结果byte []中明确转换为十六进制,反之亦然。 It is: 它是:

String isoMessage = ISOUtil.hexString(packIsoMsg("0100", isofields).getBytes());

And: 和:

unpackIsoMsg(new String(ISOUtil.hex2byte(isoMessage), "UTF-8"));

What about the definition of this kind of fields in this class? 这个类中这类字段的定义怎么样? I'm really a newbie with the standard but I arrived here because jpos doesn't work in an Android environment. 我真的是标准的新手,但我到了这里是因为jpos在Android环境中不起作用。 Also I'm confused with the last mentioned conversion to hex. 另外我对上次提到的转换为十六进制感到困惑。

Any help is really appreciated... Kind regards. 任何帮助都非常感谢...亲切的问候。

DE55 is defined as a Tag-Lag-Value (TLV) field that is not in the normal Binary / text / or numeric packed format you see the rest of ISO-8583 messages typically but is in ASN.1 BER-TLV / X.690-0207 format. DE55被定义为Tag-Lag-Value(TLV)字段,它不是正常的二进制/文本/或数字打包格式,您通常会看到其余的ISO-8583消息,但是在ASN.1 BER-TLV / X中。 690-0207格式。

Unless you account for the BER-TLV you will not successfully unpack DE55 unless it is for non-EMV/Tokenization purposes. 除非您考虑BER-TLV,否则除非用于非EMV /标记目的,否则您将无法成功解压缩DE55。 It threw me at first as well as I was thinking something more straight forward. 它一开始就把我扔了,而且我正在思考更直接的事情。 Be aware that sometimes the field transport format is actually longer in this format than the original plain text or other binary data output so it is not the most efficient. 请注意,有时字段传输格式在此格式中实际上比原始纯文本或其他二进制数据输出更长,因此它不是最有效的。

There are a couple of other fields depending on the ISO specification may also use BER-TLV but DE55 is the industry standard field to use BER-TLV for EMV functionality replacing DE55's previous use as a generic and rarely used 'fee field'. 根据ISO规范,还有其他几个领域也可能使用BER-TLV,但DE55是将BER-TLV用于EMV功能的行业标准领域,取代了DE55以前作为通用且很少使用的“费用领域”的用途。

The ISO-7816 specification its ISO-8583 use in detail for EMV and Tokenization, as well there are other references and quick guides out there if you are just looking for something not so in-depth. ISO-7816规范其ISO-8583详细用于EMV和标记化,如果您只是寻找不那么深入的东西,还有其他参考和快速指南 All volumes of the ISO-7816 specification can be found openly on the internet for free, or can be purchased directly (spendy) from the ISO organization if you want them in the plain ISO format. ISO-7816规范的所有卷都可以在互联网上公开免费找到,或者如果您希望它们采用普通的ISO格式,可以直接从ISO组织购买(花费)

I am not familiar with the specific JAVA Git you referenced but this one has a help page on how to use BER-TLV. 我不熟悉您引用的特定JAVA Git,但是这个有一个关于如何使用BER-TLV的帮助页面。 Oracle also has a page on dealing with BER-TLV here . 甲骨文还与BER-TLV处理页面在这里 BinaryFoo has a Git available as well. BinaryFoo也有一个Git

For the purposes of initial testing, if your data is just test data (DO NOT USE PRODUCTION DATA!) you can use http://www.emvlab.org/tlvutils/ to verify your results. 出于初始测试的目的,如果您的数据只是测试数据(请勿使用生产数据!),您可以使用http://www.emvlab.org/tlvutils/来验证您的结果。 Which when I input your inputs it kicks out your expected output. 当我输入您的输入时,它会踢出您的预期输出。

what is the field defined by sender in field 55.Assign the same in unpacking.If they are sending string it should be LLLVAR. 在字段55中由发送者定义的字段是什么。在解包中分配相同的内容。如果他们发送字符串,则应该是LLLVAR。 when sending ISO message header must be in hex format.hence they convert bytes to hex. 当发送ISO消息头时必须是十六进制格式。因此它们将字节转换为十六进制。

From the looks of it, you consider 5F2A020978 as wrong whereas you expect 5F2A020124. 从它的外观来看,你认为5F2A020978是错误的,而你期望5F2A020124。 The EMV tag's 5F2A data (with length 02) is the transaction currency code . EMV标签的5F2A数据(长度为02)是交易货币代码 This means your transaction is performed in EURO currency instead of Canadian dollar as you expect. 这意味着您的交易以欧元货币而非加元执行,如您所料。 You can find a currency code list here . 您可以在此处找到货币代码列表。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM