Reprinted please indicate the source
Author: Pony
Don't think that this article tells you what is 8583, tells you the principle of map, and then analyzes what each domain means and how the format is, in more detail, I even tell you how to write a program. no, the reason for not writing the above is based on two points:
1. Too many people wrote this, searched 8583 on the Internet, and published articles about this.
2. It does not play a major role, because these specifications are available. As soon as you read them, you will understand them. I wrote them, and they are useless.
My article is suitable for two types of users:
1. I am very familiar with 8583 packets. I am a senior engineer in this field. Why should I look at this type of packets? They can give me some comments and suggestions.
2. I read the specifications many times, but I still have some details that I don't quite understand.
Okay, I'm starting.
8583 messages are mostly used for data exchange between the POS terminal and the background receiving system. Generally (note the words here) A complete packet consists of the following parts:
Figure 1
In different application fields, the preceding sections have some differences in length and format, including some applications and even the preceding section "length. so don't be surprised if you see the following data in different lengths or formats.
First, let's talk about the "length" section. Generally, two bytes Indicate the total length of the packet (that is, the length of the "packet header" + "data" section ), the representation of two bytes in a message varies with the protocol of the system and the terminal. there are two types:
1 BCD method. For example, if the total length of a message is 134 bytes, the two bytes in the actual message are "01 H, 34 h" (pay attention to hexadecimal notation)
2. The actual calculated length, for example, 134 bytes. In the actual message, the two bytes are "00 h, 86 H" (note that they are also hexadecimal, 00 H * 256 + 86 H = 134d ).
Then let's talk about the "packet header". The differences between different system applications are not small, but this part usually contains tpdu, which determines the network protocol between the terminal and the system. tpdu is a 10-digit number. Some of the packets actually transmitted use ASCII to represent the 10-digit number, and some use BCD to represent the number. For example:
The tpdu is "6000120000 ",
If ASCII is used, the bytes in the packet are "36 h, 30 h, 30 h, 30 h, 31 H, 32 h, 30 h, 30 h, 30 h, 30 h "(10 bytes ).
If BCD is used, the bytes in the message are as follows: "60 h, 00 h, 12 h, 00 h, 00 H" (5 bytes ).
The first thing is coming, "data.
This part is 8583. As I mentioned above, I only write things that others have not written in this article,
So .....,
The preceding example shows a 8583 packet.
"02 00 70 20 00 00 20 C0 82 00 19 06 20 51 32 00 00 00 00 02 61 20 60 00 00 00 00 00 00 00 00 00 00 73 37 06 20 51 32 00 00 00 02 61 20 D1 91 12 01 00 00 00 00 30 30 30 30 31 31 31 31 31 31 30 32 32 35 30 31 31 31 31 31 31 31 01 56 00 44 9f 26 08 92 B6 AE 9A 9B 10 2E D6 9f 27 01 80 9f 10 13 07 01 01 03 A0 A0 10 01 0a 01 00 00 00 10 37 51 3A 22 be"
This is a string of actually transmitted packets. The above shows the hexadecimal format of the data. Are you ready? I want to begin the analysis.
<02 00>
This is an information type (MTI). It is a four-digit number. Here it is "0200". During transmission, it is expressed as "02 h, 00 H "(What if ASCII is used? Look at the above content). This four-digit number, each of which has its meaning,
First Digit: 8583 version number
Second: Message class
Third: Message sub-class
Fourth: transaction originator
I will not translate it. After all, it is a foreigner's stuff. Please understand it yourself.
<70 20 00 00 20 C0 82 00>
The bit map field indicates which domains exist and is easy to calculate. the following fields exist: 2, 3, 4, 11, 35, 41, 42, 49, 55.
<19 06 20 51 32 00 00 00 02 61 20>
Field 2, account, n .. 19, llvar. one byte represents the length (19), and the account is 19 digits. After the preceding value is 0, it is represented by 10 bytes BCD.
<60 00 00>
Field 3, processing code, N6, fixed length, expressed in 3 bytes BCD
<00 00 00 02 00>
Field 4, transaction amount, n12, fixed length, expressed in 6 bytes BCD, the amount here is 200.00 yuan
<00 00 73>
Field 11, serial number, N6, fixed length, expressed in 3 bytes BCD. Serial number is "000073 ".
<37 06 20 51 32 00 00 00 00 02 61 20 D1 91 12 01 00 00 00 00>
Field 35, binary track data, Z .. 35, llvar. one byte indicates the length (37), followed by the magnetic track data represented by 19 bytes BCD
<30 30 30 31 31 31 31>
Field 41, terminal number, ans8, fixed length, ASCII, the terminal number is "00001111"
<31 30 32 35 30 31 31 31 31 31 31 31>
Field 42, merchant ID, ans15, fixed length, ASCII representation, here the Merchant number is "102250153111111"
<01 56>
Field 49, currency code, N3, fixed length. After the preceding value is 0, it is represented by two bytes of BCD. The currency code here is "156"
<00 44 9f 26 08 92 B6 AE 9A 9B 10 2E D6 9f 27
01 80 9f 10 13 07 01 01 03 A0 A0 10 01 0a 01
00 00 00 10 37 51 3A 22 be>
Field 55, which is the data related to IC card transactions. The maximum length is 255. IC card data used in this domain is generally in the PBOC/EMV specification.
They all have their own definitions (including formats). Therefore, the formats in messages are generally consistent with those defined in PBOC/EMV. generally, TLV (TAG + lenght + value) represents a data. briefly introduces the meaning of data.
"00 44": length, 44 bytes
"9f 26 08 92 B6 AE 9A 9B 10 2E D6": Application cryptogram, TLV, B8
"9f 27 01 80": cryptogram information data, TLV, B1
"9f 10 13 07 01 01 03 A0 A0 10 01 0a 01 00 00 00 10 37 51 3A 22 be ":
Issuer application data (issuer application data), TLV, extended, up to 32 bytes. B... 32.