GetResponse + Secure messaging + Error codes
Hi there :-)
Suppose a situation that you want to send out an error code using GetResponse command. Is there any way to do this?
I am writing an applet which should support SecureMessaging. In this case when I want to return an error code I should secure it. For example when the Sw1Sw2 is the error code which I want to send out, I should sent the secured version of it. So the actual string I should send out should be like this:
99 02 Sw1 Sw2 8E 08 [CC of the Sw1 and Sw2] Sw1 Sw2
If I use apdu.sendBytesLong() method to send out the above response message, a 9000 will be automatically attached to this response message! (which is not correct)
So I divided my response message into 2 parts. First part is 99 02 Sw1 Sw2 8E 08 [CC of the Sw1 and Sw2] which I send using apdu.sendBytesLong() and the second part which is Sw1Sw2 and I send it using ISOException.throwIt(Sw1Sw2). But surprisingly this won't work for error codes! If I change Sw1Sw2 to some warning code it works well. I mean if for example Sw1Sw2 is 0x6281(which is a warning code) the response message at output is as I expect but when the Sw1Sw2 is for example 0x6981(which is error code) the response is 61xx, which xx is the length of data at output.
I have no idea how I should solve this problem. I'll appreciate any comment.
-Thanks a lot
Edited by: Bluefairy on Nov 10, 2010 2:05 AM
Edited by: Bluefairy on Nov 10, 2010 2:06 AM