JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

Exceptions doesn't work in Extended Length APDU

JavaCard Applet Development Related Questions and Answers.
hosseinpro
Posts: 13
Joined: Wed Jun 28, 2017 6:35 pm
Points :190
Contact:

Exceptions doesn't work in Extended Length APDU

Post by hosseinpro » Sat Jul 15, 2017 5:55 pm

Hi

I wrote an applet that receives an extended length APDU.
For short command APDU, if applet throws an exception the card sends error sw.
But for extended length APDU, if applet throws an exception, the card sends 9000 instead of error!!

I test this simple code:

Code: Select all

   public void process(APDU apdu)
   {
      if(selectingApplet()){
         return;
      }
      
      ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);


This is the log of short and long (extended length) APDUs:

Code: Select all

>> /send 002000800431323334
>> 00 20 00 80 04 31 32 33 34
<< 6D 00   Instruction code not supported or invalid

>> /send 0030000000012c30820128308192020101300D06092A864886F70D01010505003050310B30090603550406130255533110300E06035504081307466C6F726964613110300E060355040713074F726C616E646F310C300A060355040A1303554346310F300D06035504031306526F6F744341170D3137303731323133313134365A170D3137303831313133313134365AA00E300C300A0603551D140403020101300D06092A864886F70D010105050003818100A37CE322462A73B3C0889BE5D88830F7D4C8701D49921619B1950765538A241B712A19288EF3039AB804ECB0A482CAEEAEB1BAA6E2C3A0873091724D4855DE2DF3CE9BF34CFDEC9FCD8BDDAABE8B8BA680DEE6D1FB1A519CFEF111B1BD72F716182508A92BF4DFA6048614487F789E33E66BF257FDB795F2A2350224088C82F7
>> 00 30 00 00 00 01 2C 30 82 01 28 30 81 92 02 01 01 30 0D 06 09 2A 86 48 86 F7 0D 01 01 05 05 00 30 50 31 0B 30 09 06 03 55 04 06 13 02 55 53 31 10 30 0E 06 03 55 04 08 13 07 46 6C 6F 72 69 64 61 31 10 30 0E 06 03 55 04 07 13 07 4F 72 6C 61 6E 64 6F 31 0C 30 0A 06 03 55 04 0A 13 03 55 43 46 31 0F 30 0D 06 03 55 04 03 13 06 52 6F 6F 74 43 41 17 0D 31 37 30 37 31 32 31 33 31 31 34 36 5A 17 0D 31 37 30 38 31 31 31 33 31 31 34 36 5A A0 0E 30 0C 30 0A 06 03 55 1D 14 04 03 02 01 01 30 0D 06 09 2A 86 48 86 F7 0D 01 01 05 05 00 03 81 81 00 A3 7C E3 22 46 2A 73 B3 C0 88 9B E5 D8 88 30 F7 D4 C8 70 1D 49 92 16 19 B1 95 07 65 53 8A 24 1B 71 2A 19 28 8E F3 03 9A B8 04 EC B0 A4 82 CA EE AE B1 BA A6 E2 C3 A0 87 30 91 72 4D 48 55 DE 2D F3 CE 9B F3 4C FD EC 9F CD 8B DD AA BE 8B 8B A6 80 DE E6 D1 FB 1A 51 9C FE F1 11 B1 BD 72 F7 16 18 25 08 A9 2B F4 DF A6 04 86 14 48 7F 78 9E 33 E6 6B F2 57 FD B7 95 F2 A2 35 02 24 08 8C 82 F7
<< 90 00

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3055
Contact:

Re: Exceptions doesn't work in Extended Length APDU

Post by UNKNwYSHSA » Tue Jul 18, 2017 2:19 am

You have to use ENVELOPE COMMAND to send extended length APDU when using protocol T=0.
sense and simplicity

hosseinpro
Posts: 13
Joined: Wed Jun 28, 2017 6:35 pm
Points :190
Contact:

Re: Exceptions doesn't work in Extended Length APDU

Post by hosseinpro » Tue Jul 18, 2017 9:45 am

I use Java card Emulator, so I changed the protocol to T1 and it works without any change!

Thanx

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3055
Contact:

Re: Exceptions doesn't work in Extended Length APDU

Post by UNKNwYSHSA » Tue Jul 18, 2017 10:22 pm

Yes.
OK.
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 9 guests

JavaCard OS : Disclaimer