ISO 8583 C Library (v0.0.1)

It’s been almost two years since I wrote my ISO 8583 library and I’ve finally managed to get around to publishing it. Since its original conception back in 2005 I’ve made a few minor changes, mainly with regards to naming conventions and to facilitate the addition of different version handlers in the near future.

This version includes the ISO 8583:1993 (binary) message handler.

Check out the ISO 8583 page for further details…

12 Comments

  1. Ignacio Verdú says:

    Sorry to bother you, I’ve just found your site and thought that you might could help me out with what I think is a stupid question.
    The problem I´m facing is that I have to write an app to “translate” an ISO 8583 message so we at my company can read messages, update our systems, and send responses back. The think is that I don´t quite understand what an ISO 8583 message is, I mean: what is a primary bitmap?, what is a secondary Bitmap?. could you please point me out some directions?, I mean, I go to the wikipedia, but I may be silly, I still don´t understand it. Do you know of maybe, any tutorial with examples?
    Any help would be much appreciated,

    Thank you in advance four your time.

    Actually, sorry, my name is Nacho, I´m from Spain(Alicante)

  2. Oscar says:

    Nacho,

    I haven’t come across any tutorials covering ISO 8583, however it’s quite straightforward once you grasp the basic concepts.

    The basic structure of an ISO 8583 message is as follows:

    [MTI] Message Type Indicator
    [BITMAP] Indicating which fields are present
    [FIELDs] Data fields as indicated by the bitmap

    Unlike other encodings such as XML and TLV, ISO 8583 doesn’t use a tagging mechanism to indicate which fields are present in the message. Instead the message contains a ‘BITMAP’ immediately prior to the ‘FIELD’(s) which indicates in advance which of the pre-defined fields are present in the message.

    The ‘BITMAP’ is variable in size, but is always a multiple of 64 bits (i.e. 64 field indicators). If the message only contains fields between 2 and 64 then you only need a single 64 bit bitmap (i.e. the ‘Primary’ Bitmap), otherwise if any of the fields between 66 and 128 are present then you will need a 128 bit bitmap (i.e. both the ‘Primary’ and ‘Secondary’ bitmaps).

    The first field in each 64-bit bitmap (i.e. 1 and 65 respectively) is used to indicate whether another 64-bit bitmap follows this one. In the 1987/1993 versions it is not valid for field 65 to be set (i.e. 1st bit of Secondary bitmap) as no message can contain more than 128 fields.

  3. halo says:

    Hello Oscar,
    Thanks for your excellent software. I have a question about setting binary fields. For example if I want to set a binary fied to hex 0xff, what is the right way to go about it? It’s not clear to me that DL_ISO8583_MSG_SetField_Str will work in this case, since it assumes that the input is always an ascii string. Thanks in advance

  4. Oscar says:

    Halo,

    Simply use the DL_ISO8583_MSG_SetField_Bin / DL_ISO8583_MSG_GetField_Bin functions for setting / reading binary field data.

  5. Halo says:

    Thanks for the quick response. DL_ISO8583_MSG_SetField_Bin / DL_ISO8583_MSG_GetField_Bin works!

  6. ensskumar says:

    i want some information about bitmap mymessage is like this
    FIELD[003]= 400000
    FIELD[004]= 0000000001000000
    FIELD[009]= 10000010
    FIELD[011]= 000000075354
    FIELD[012]= 20080630070150
    FIELD[017]= 20080630
    FIELD[024]= 200
    FIELD[032]= 504511
    FIELD[034]= 200064902
    FIELD[049]= INR
    FIELD[096]= QFUpnPoBYs1OatcrfNCz2w
    FIELD[102]= 026 37890 378904020075864
    FIELD[103]= 026 31790 317902070065825
    FIELD[123]= BWY
    FIELD[125]= fee==00000000

    31 32 30 30 b0 b0 81 01 40 00 80 00 00 00 00 01 1200…………
    06 00 00 28 34 30 30 30 30 30 30 30 30 30 30 30 ….400000000000
    30 30 30 31 30 30 30 30 30 30 31 30 30 30 30 30 0001000000100000
    31 30 30 30 30 30 30 30 30 37 35 33 35 34 32 30 1000000007535420
    30 38 30 36 33 30 30 37 30 31 35 30 32 30 30 38 0806300701502008
    30 36 33 30 32 30 30 30 36 35 30 34 35 31 31 30 0630200065045110
    39 32 30 30 30 36 34 39 30 32 49 4e 52 30 32 32 9200064902INR022
    51 46 55 70 6e 50 6f 42 59 73 31 4f 61 74 63 72 QFUpnPoBYs1Oatcr
    66 4e 43 7a 32 77 33 38 30 32 36 20 20 20 20 20 fNCz2w38026
    20 20 20 33 37 38 39 30 20 20 20 33 37 38 39 30 37890 37890
    34 30 32 30 30 37 35 38 36 34 20 20 20 20 34 30 4020075864 40
    20 20 30 32 36 20 20 20 20 20 20 20 20 33 31 37 026 317
    39 30 20 20 20 33 31 37 39 30 32 30 37 30 30 36 90 31790207006
    35 38 32 35 20 20 20 20 30 30 33 42 57 59 30 35 5825 003BWY05
    30 66 65 65 3d 3d 30 30 30 30 30 30 30 30 20 20 0fee==00000000
    20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
    20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
    20 20 20

    after mti 1200 i have got like ………… that is bitmap i know but what is that format ? do u know about that which format data thatis plz let me know . is ter any encrypted format inthat bitmap .i think u definetely answer to my question

    thanks in advance
    kumar

  7. Oscar says:

    Kumar,

    The bitmap in your message just that… a bitmap! There is no special encoding or encryption.

    If you look at the binary representation of the 16 bytes after the MTI then you’ll get the following:

    10110000 10110000 10000001 00000001 01000000 00000000 10000000 00000000 00000000 00000000 00000000 00000001 00000110 00000000 00000000 00101000

    Now, simply read the bits in logical order (i.e. left to right) and you’ll see that the following bits are set in the bitmap:

    1,3,4,9,11,12,17,24,32,34,49,96,102,103,123,125

    Bit 1 is used to indicate that at least one of the fields between 65 and 128 is set in the ISO-8583 message. The others correspond to the actual fields which are set.

  8. Philippe says:

    Hi Oscar,

    I want to use our API for the commercial application, it’s possible ?

    Thanks

  9. Oscar says:

    Philippe,

    The DL-ISO8583 library uses a ‘zlib’ style license, which permits use in Commercial applications.

    Please drop me an email if you have any further questions on this topic…

  10. ingconti says:

    I am using your nice library.
    I found a problem in fields 93 & 94.
    In std documentation I read the this are FIXED size filelds, of 11 digits,
    so when we write down the contents of these fields we SHOULD NOT ADD length before.
    If we do in this way, my server accepts packets. if I use your encoding (i.e. I leave kDL_ISO8583_LLVAR) it FAILS.
    if we change type to : kDL_ISO8583_FIXED it works.

    note we do not pack packets, we send in ASCII,.

    thanks in advance

  11. Oscar says:

    Ingconti,

    Fields 93/94 are defined in the 1987 and 1993 versions as follows:

    [1987]
    Field 93 – Response Indicator – AN5
    Field 94 – Service Indicator – AN7

    [1993]
    Field 93 – Txn. destination inst. id. code – N11 (LLVAR)
    Field 94 – Txn. originator inst. id. code – N11 (LLVAR)

    Are you referring to the standard ISO documentation or documentation from a vendor?

Leave a Reply

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.