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.
861D8424000218XXXXXXXXXXXXXXXXYYYYYYYY (Where XXXXXXXXXXXXXXXX is pinblock and YYYYYYYY
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
--
--
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: sa...@jpos.org
---
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 jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
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.
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++;
}
}
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 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[].
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);
}
--
--
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: sa...@jpos.org
---
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 jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cba5ec16-69ce-72a9-2159-42760f35525f%40talktalk.net.