[jpos-users] Adding Issuer script in response - Tag 72

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Adding Issuer script in response - Tag 72

Hari Gade
Hi All,

I am facing problems in adding Tag 72  issuer script in response in DE55. Below is the problem and please advice.

Description : When transaction is received with icc data, we expand the DE 55 and  create the issuer script if below scenario are true.
1)  whether issuer script update in last transaction is failed. 
2) There is a pin change requested.


Now if either of case is true . We format a command 351(with MKDMethod, SKDMethod etc..basically we are using atalla box) and send to atalla to generate the pin and mac. Now Atalla will respond with PINBLOCK and MAC.

Before I move forward , Just want to let you how the TAG 72 is :

Tag  length   value
72    1F      861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is pinblock and YYYYYYYY is Mac)

From the above value is in-turn a tag value as below

Tag     length         value
86       1D            8424000218XXXXXXXXXXXXXXXXYYYYYYYY

So TAG 72 value type is a EMV TAGVALUE (86 tag)

Now firstly I have created the 86 TAGVALUE where the object is of EMVTag[]. So the type of value of 72 tag is EMVTag[].

Reason why we need to create the type of value of 72 tag as EMVTag[]. is below 

public enum EMVStandardTagType implements EMVTagType {

ISSUER_SCRIPT_TEMPLATE_2_0x72(

            0x72,

            "Issuer Script Template 2",

            "Contains proprietary issuer data for transmission to the ICC after the second GENERATE AC command",

            DataSource.ISSUER, TLVDataFormat.CONSTRUCTED, new VariableDataLength(

            DataLength.DATA_LENGTH_VAR, DataLength.DATA_LENGTH_VAR), 0x00, new VariableByteLength(

            ByteLength.BYTE_LENGTH_VAR, ByteLength.BYTE_LENGTH_VAR)),

}


from above TLVDataFormat.CONSTRUCTED. if TLVDataFormat.CONSTRUCTED then 


 public Class<?> getDataType() throws ProprietaryFormatException {

        switch (format) {

            case PROPRIETARY:

                throw new ProprietaryFormatException(tagShortDescription);

            case BINARY:

                return byte[].class;

            case CONSTRUCTED:

                return EMVTag[].class;

            default:

                return String.class;

        }

    }


From the above  value of 72 tag (86 tag and value)  type should be EMVTag[]. 


So I have created the 72 tag value which is combination of 86 tag and value as a EMVTag[] object.


But now the problem here is in JPOS there is no where supported EMVTag[] ex:


In TagsequenceBase.class in JPOS has  below which doesn't have value instanceof EMVTag[].


public synchronized void writeTo(ISOMsg isoMsg) throws ISOException {

        int maxField = isoMsg.getMaxField();

        List<TagValue> tagValueList = getOrderedList();

        int fieldNumber = 0;

        for (TagValue tagValue : tagValueList) {

            Object value = tagValue.getValue();

            if (value != null) {

                ISOComponent subField;

                if (value instanceof byte[]) {

                    subField = new ISOBinaryField(fieldNumber + maxField + 1, (byte[]) value);

                } else if (value instanceof String) {

                    subField = new ISOField(fieldNumber + maxField + 1, (String) value);

                } else if (value instanceof TagSequence) {

                    TagSequence subSequence = (TagSequence) tagValue;

                    subField = new ISOMsg(fieldNumber + maxField + 1);

                    subSequence.writeTo((ISOMsg) subField);

                } else if (value instanceof ISOMsg) {

                    ISOMsgTagValue subSequence = (ISOMsgTagValue) tagValue;

                    subField = subSequence.getValue();

                    subField.setFieldNumber(fieldNumber + maxField + 1);

                } else {

                    throw new ISOException("Unknown TagValue subclass: " + tagValue.getClass());

                }

                isoMsg.set(new ISOTaggedField(tagValue.getTag(), subField));

            }

            fieldNumber++;

        }

    }


I can override and include the if condition that checks whether instanceof EMVTag[] , but I need to change like this in every .class of JPOS that is not possible.


So please can anyone suggest how can Tag 72 is added in the DE55 response.


Thanks,

Hari.




--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/2fd05dc8-96fa-4f69-9bb4-0aa306141e69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

jPOS - Users mailing list
On 09/12/16 03:31, Hari Gade wrote:
> I am facing problems in adding Tag 72  issuer script in response in
> DE55. Below is the problem and please advice.
Please confirm the version of jPOS you are actually using.

I don't recognise the classes you reference and fear you are on the
wrong mailing list or perhaps referencing code that forms part of your
'closed' project and not our open one.

If you are really using jPOS, then you are doing way too much lifting,
since what you want can be achieved in a handful of lines of code using
jPOS.

Please confirm or rebuked my guess work above and I will try to provide
some code examples later today (I am on my way out of the door now).

--
Mark

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/a109ad5f-77c9-c2fc-b44e-28c08887fa74%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

Victor Salaman-Medina
In reply to this post by Hari Gade

On Thu, Dec 8, 2016 at 10:31 PM, Hari Gade <[hidden email]> wrote:
861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is pinblock and YYYYYYYY


Hi:

You can construct first the Tag 86 independently, convert to a byte array. The result of that operation you will use to create Tag 72. Doesn't this do what you need?

/V


--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SyzvQBVE9GR2fCnthZg8QMFAWTGh1LS37Q8_%2BaGKPZ%2BpiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

chhil

Mark,
It's from a contributed code to jpos

E. G.

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/emv/EMVStandardTagType.java

-chhil


On Fri, Dec 9, 2016, 12:34 PM Victor Salaman <[hidden email]> wrote:

On Thu, Dec 8, 2016 at 10:31 PM, Hari Gade <[hidden email]> wrote:
861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is pinblock and YYYYYYYY


Hi:

You can construct first the Tag 86 independently, convert to a byte array. The result of that operation you will use to create Tag 72. Doesn't this do what you need?

/V


--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SyzvQBVE9GR2fCnthZg8QMFAWTGh1LS37Q8_%2BaGKPZ%2BpiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefDZ6YWu%3DyMogA-%3Dj5ejKsW3eG%2BQ2pvgkpzEfCPRTCCfaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

Hari Gade
In reply to this post by Victor Salaman-Medina


On Thursday, December 8, 2016 at 11:04:47 PM UTC-8, Victor Salaman wrote:

On Thu, Dec 8, 2016 at 10:31 PM, Hari Gade <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="yVz8xfBaCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hari.g...@...> wrote:
861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is pinblock and YYYYYYYY


Hi:

You can construct first the Tag 86 independently, convert to a byte array. The result of that operation you will use to create Tag 72. Doesn't this do what you need?

/V

Hi Victor,

Thanks for your quick response. I want to add Tag 72 which is an constructed tag (ex: 72LLTLVTLV). DO you have any code / any way of implementation, how to add this tag 72 as a sub element of DE-55 with tag 91 (issuer resposne data). I am facing problem adding it.
Tag 91 and tag 72 both should go in transaction response to the card.
 
Below is the implementaion/code i am trying to implement.

I have created TAG 86 independently and result of that operation is used to create Tag 72. Now the problem here is I have to add the result operation of Tag 72 to the response of ISO MSG in DE 55(I want to add Tag 72 as one of the sub element in DE 55 like Tag 91)  . For this to add in ISO MSG i have to use TagSequenceBase class in JPOS  as shown in below.

public synchronized void writeTo(ISOMsg isoMsg) throws ISOException {

        int maxField = isoMsg.getMaxField();

        List<TagValue> tagValueList = getOrderedList();

        int fieldNumber = 0;

        for (TagValue tagValue : tagValueList) {

            Object value = tagValue.getValue();

            if (value != null) {

                ISOComponent subField;

                if (value instanceof byte[]) {

                    subField = new ISOBinaryField(fieldNumber + maxField + 1, (byte[]) value);

                } else if (value instanceof String) {

                    subField = new ISOField(fieldNumber + maxField + 1, (String) value);

                } else if (value instanceof TagSequence) {

                    TagSequence subSequence = (TagSequence) tagValue;

                    subField = new ISOMsg(fieldNumber + maxField + 1);

                    subSequence.writeTo((ISOMsg) subField);

                } else if (value instanceof ISOMsg) {

                    ISOMsgTagValue subSequence = (ISOMsgTagValue) tagValue;

                    subField = subSequence.getValue();

                    subField.setFieldNumber(fieldNumber + maxField + 1);

                } else {

                    throw new ISOException("Unknown TagValue subclass: " + tagValue.getClass());

                }

                isoMsg.set(new ISOTaggedField(tagValue.getTag(), subField));

            }

            fieldNumber++;

        }

    }


From the above we don't have instance of EMVTag[] since result operation of Tag 72 value is an instance of EMVTag[] . Now i did override to customize my requirement as below

public synchronized void writeTo(ISOMsg isoMsgthrows ISOException {

        int maxField = isoMsg.getMaxField();

        List<TagValue> tagValueList = getOrderedList();

        int fieldNumber = 0;

        for (TagValue tagValue : tagValueList) {

            Object value = tagValue.getValue();

            if (value != null) {

                ISOComponent subField;

                if (value instanceof byte[]) {

                    subField = new ISOBinaryField(fieldNumber + maxField + 1, (byte[]) value);

                } else if (value instanceof String) {

                    subField = new ISOField(fieldNumber + maxField + 1, (String) value);

                } else if (value instanceof TagSequence) {

                    TagSequence subSequence = (TagSequence) tagValue;

                    subField = new ISOMsg(fieldNumber + maxField + 1);

                    subSequence.writeTo((ISOMsg) subField);

                } else if (value instanceof ISOMsg) {

                    ISOMsgTagValue subSequence = (ISOMsgTagValue) tagValue;

                    subField = subSequence.getValue();

                    subField.setFieldNumber(fieldNumber + maxField + 1);

                } else if (value instanceof EMVTag[]) {

                    subField = new ISOMsg(fieldNumber + maxField + 1);

                    subSequence.writeTo((ISOMsg) subField);

                 else {

                    throw new ISOException("Unknown TagValue subclass: " + tagValue.getClass());

                }

                isoMsg.set(new ISOTaggedField(tagValue.getTag(), subField));

            }

            fieldNumber++;

        }

    }



If I customise as above then I can pass the exception that I have faced(throw new ISOException("Unknown TagValue subclass: " + tagValue.getClass());)  but again going forward i have below in TagsequenceBase as 


   protected abstract TagSequence createTagValueSequence(String tag);


    protected abstract TagValue createLiteralTagValuePair(String tag, String value) throws ISOException;


    protected abstract TagValue createBinaryTagValuePair(String tag, byte[] value) throws ISOException;


Now from above value is type of string or byte but we dont have EMVTag[]. I cannot override again,  so like these we have many issues where I cannot fit tag 72 value since it is EMVTag[].







 

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/b3d8b1c4-033d-492c-838b-a3d3a694a696%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

jPOS - Users mailing list
In reply to this post by chhil
On 09/12/16 12:16, chhil wrote:
> Mark,
> It's from a contributed code to jpos
>
> E. G.
>
> https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/emv/EMVStandardTagType.java
>
Thanks Chhil, I had missed that, and I failed to get any 'jPOS' results
from my google search.

Thanks for sharing.

--
Mark

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/738a2667-e831-cea7-8fcd-1f5bd3653ef8%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

jPOS - Users mailing list
In reply to this post by Victor Salaman-Medina
On 09/12/16 07:04, Victor Salaman wrote:

>
> On Thu, Dec 8, 2016 at 10:31 PM, Hari Gade <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is
>     pinblock and YYYYYYYY
>
>
>
> Hi:
>
> You can construct first the Tag 86 independently, convert to a byte
> array. The result of that operation you will use to create Tag 72.
> Doesn't this do what you need?
Perfect advise Victor.

I see the OP is repeating himself, but I hope he will reread your
response and follow it - he seems lost in the detail and seems to be
missing the simply obvious.

--
Mark

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cba5ec16-69ce-72a9-2159-42760f35525f%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Adding Issuer script in response - Tag 72

Victor Salaman-Medina

Hi

Take a look at:

    public static void main(String[] args) throws ISOException
    {
        // Creates Tag 86 independently (Command/APDU for EMV PIN Change)
        //  CLA=84
        //  INS=24
        //   P1=00
        //   P1=02
        //  LEN=0C
        // DATA=0102030405060708 (PINBLOCK) + 01020304 (MAC)
        TLVMsg script=new TLVMsg(0x86,
                                 ISOUtil.hex2byte("842400020C010203040506070801020304"));

        // Creates a tag list
        TLVList l = new TLVList();

        // Add tag 72 using the TLV contents as opaque bytes from the "script"
        l.append(0x72,script.getTLV());

        // Create a byte array representation of the TLV
        byte[] packed=l.pack();

        // Let's print it.
        String hex=ISOUtil.hexString(packed);
        System.out.println("hex = " + hex);
    }

On Fri, Dec 9, 2016 at 5:57 PM, 'Mark Salter' via jPOS Users <[hidden email]> wrote:
On 09/12/16 07:04, Victor Salaman wrote:
>
> On Thu, Dec 8, 2016 at 10:31 PM, Hari Gade <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is
>     pinblock and YYYYYYYY
>
>
>
> Hi:
>
> You can construct first the Tag 86 independently, convert to a byte
> array. The result of that operation you will use to create Tag 72.
> Doesn't this do what you need?
Perfect advise Victor.

I see the OP is repeating himself, but I hope he will reread your
response and follow it - he seems lost in the detail and seems to be
missing the simply obvious.

--
Mark

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cba5ec16-69ce-72a9-2159-42760f35525f%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1Syx0mqpjQqPAkwmw8xUx8%2BxNq2AhMm3_deirSer_S4AJOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.