Reprint: 8583 Simple Message analysis

Source: Internet
Author: User

http://blog.csdn.net/pony_maggie/article/details/6568192

Do not think that this article is to tell you what is 8583, tell you the principle of map, and then analyze what each domain means, format, and then a little more detailed even tell you how to write programs and so on. No, the reason for not writing above is based on two points:
1 Too many people write these, online a search 8583, out of the article is about these.


2 The role is not small, because these norms are there, we see the specification will understand, I wrote is useless.

My article is suitable for two kinds of people to see:
1 is very familiar with the 8583 messages, the senior engineer in this field, why this kind of people want to see, because they see, can give me some comments and suggestions.

2 read many times the specification, but there are some details are not very clear.

OK, I'm going to start.

8583 messages In most cases, the data exchange between the POS terminal and the backend receiving system, in general (please note the wording here) a complete message consists of the following parts

Figure 1

For different applications, there are some differences in the length and format of some of the above sections, and there are some applications even in front of the "Length" section. So if you wait, you see the length or format of some of the following data is not the same as yours, don't be surprised.

First of all, the "Length" section, generally two bytes, indicates the total length of the message (that is, the length of the "message header" + "Data" section), in two bytes in the message representation method due to the system and the terminal protocol different. There are generally two kinds:
1 BCD method, such as the total length of the message is 134 bytes, then in the actual message, the two bytes is "01h,34h" (note 16 binary)
2 The actual length of the calculation, such as a 134-length byte, the actual message, two bytes is "00h, 86h" (note is also 16, 00h*256+86h = 134d).

Then say "message header", this part of the different system application is not small, but generally this part contains TPDU, this TPDU determines the terminal and the network protocol between the system. TPDU is a 10-bit number, the actual transmission of the message, some in ASCII representation of the 10 digits, some in BCD, for example:
TPDU is "6000120000",

In ASCII notation, the bytes in the message are "36h,30h,30h,30h,31h,32h,30h,30h,30h,30h" (10 bytes).
In the case of BCD, the bytes in the message are as follows: "60h,00h,12h,00h,00h" (5 bytes).

The play comes, the "Data" section.
This part is 8583, I said above, I wrote this article only write what others have not written,

So ......,

Directly on the example. A section of 8583 messages.

"C0 82 00 19 06 20 51 32 00 00 00 02 61 20 60 00 00 00 00 00 02 00 00 00 00 73 37 06 20 51 32 00 00 0 0. d1-XX---------------------- B6 AE 9a 9b 2e d6 9f by the 9f of the A0 A0-----0a------


This is a string of actual transmitted messages, which shows the 16 binary of the data. Are you ready, I'm going to start analyzing.


<02 00>
This is the information type (MTI), is a four-bit number, here is the "0200", the transmission with the BCD means "02h,00h" (if using ASCII it?). Look at the contents above). This four-digit number, each one has its meaning,
First bit: 8583 version number
Second Position: Message class
Third place: Message sub-class
Fourth bit: Transaction originator
Do not translate, after all, is originally a foreigner's things, understand it.

<70 C0 00>
Bit map domain, which indicates which domains exist and is easy to calculate, the following fields exist: 2, 3, 4, 11, 35, 41, 42, 49, 55.

<19-20>, XX
Field 2, account number, N.. Llvar, a byte represents the length (19), the account number is 19 bits, the front 0, the 10-byte BCD is represented.

<60 00>
Field 3, processing code, N6, fixed length, represented by 3-byte BCD

<00 xx 00>
Field 4, transaction amount, n12, fixed length, 6-byte BCD, the amount here is 200.00 yuan

<00 73>
Field 11, serial number, N6, fixed length, represented by 3-byte BCD. The serial number is "000073".

<37----------D1
Field 35, two-track data, Z.. Llvar, one byte for length (37), followed by a 19-byte BCD representation of the track data

<30-31>
Field 41, terminal number, ANS8, fixed length, ASCII, terminal number "00001111" here

<31-from + to-31>
Field 42, merchant number, ANS15, fixed length, ASCII, here the merchant number is "102250153111111"

<01 56>
Field 49, currency code, N3, fixed length, preceded by 0, with two-byte BCD, where the currency code is "156"

<00 9f b6 ae 9a 9b 2e d6 9f 27
9f A0 A0, 0a 01.
The 3a be>
Field 55, this is the IC card transaction related data, the maximum length is 255, this domain uses the IC card data generally in the PBOC/EMV specification
have their own definitions (including the format), so the format generally in the message is consistent with what they are defined in the PBOC/EMV. Generally, TLV (Tag+lenght+value) represents a data. Briefly describe the meaning of the data.


"00 44": Length, representing 44 bytes
"9f b6 AE 9a 9b 2e d6": Application redaction (Application cryptogram), TLV, B8
"9f 27 01 80": Ciphertext information data (cryptogram information), TLV, B1

"9f A0 A0 0a---------3a
Issuing Bank application data (issuer Application data), TLV, variable length, max 32 bytes. B.. 32.

Reprint: 8583 Simple Message analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.