• Post Reply Bookmark Topic Watch Topic
  • New Topic

CardException is not enough for my case  RSS feed

 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have implemented Andoid app - server side application. The connection between the both works with TCP socket. When the user touches the button
in the Android app, a connenction is being built to the server to get the user authenticated.  Thereafter, the server communicates with the smart card reader. The exchanged messages between the app
and server have the following format:

<type> 0x00 0x00 0x00 <length> 0x00 0x00 0x00 [<data>]

if the message has the type value `06` that means error in the smart card reader.
if the message has the type value `07` that means error in the smart card.

I am using code like below for the communication with the smart card reader:


The smartcardio has the `CardException` class for exception. My problem I do not know when to send the message of type `06` or `07` because I can not
differentiate where the error happens when the CardException is thrown. how can I manage that?

I appreciate any help
 
Campbell Ritchie
Marshal
Posts: 55793
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who wrote that exception class? Are you always getting a message? Does that message include the codes 06/07? Does the exception class have a code field, like SQLException? Can you create subclasses for ordinary cards and smart cards?
 
Dave Tolls
Rancher
Posts: 2914
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's part of the smart card stuff that (now) comes with Java 8.

https://docs.oracle.com/javase/8/docs/jre/api/security/smartcardio/spec/javax/smartcardio/CardException.html

I think it used to be a separate download.
 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

As Dave Tolls has mentioned it is part of the smartcardio API. I had CardException for example if the card reader is not connected to the laptop but for example if the smart card is defekt I need to detect this case and handle it by sending message of type 07 to the Android app.
 
Campbell Ritchie
Marshal
Posts: 55793
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for that information, but in the documentation it suggests that Exception is only for smart cards.
 
Dave Tolls
Rancher
Posts: 2914
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure.

"Exception for errors that occur during communication with the Smart Card stack or the card itself."

I read that as meaning any issues in reading, and not just the card itself.

I suspect this is going to need some investigation in trying to cause a mix of errors and seeing what exceptions appear.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!