smartcard - Why I can't receive APDU buffer contents? -


i wrote following program return apdu buffer contents on reception of each apdu command:

package testpack;  import javacard.framework.apdu; import javacard.framework.applet; import javacard.framework.isoexception;  public class bufferreturner extends applet {      private bufferreturner() {     }      public static void install(byte barray[], short boffset, byte blength) throws isoexception {         new bufferreturner().register();     }      public void process(apdu arg0) throws isoexception {         if(selectingapplet()){             return;         }         arg0.setoutgoingandsend((short)0, (short)255);      }  } 

when send commands though contact interface using t=0 protocol, receive following result:

 connect successful. send: 00 a4 04 00 06 01 02 03 04 05 00 00 recv: 90 00 time used: 8.000 ms send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 00 send apdu error: device attached system not functioning. send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 00 recv: 6c ff time used: 5.000 ms send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ff recv: 6c ff time used: 5.000 ms send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ff recv: 6c ff time used: 5.000 ms send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ff recv: 6c ff time used: 6.000 ms send: 00 c0 00 00 ff send apdu error: device attached system not functioning. send: 00 c0 00 00 ff send apdu error: device attached system not functioning. 

as see can't receive apdu buffer contents. what's wrong?

just transmission error t=0 javacards there nothing wrong card , kind of "expected" behavior.

for setoutgoing() method (setoutgoingandsend() convenience method wrapping setoutgoing()), java card api specification states:

on case 4 command, setincomingandreceive() must invoked prior calling method. otherwise, erroneous behavior may result in t=0 protocol.

hence, see "erroneous behavior" indicated in api specification.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -