Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Read data from javacard, How?

lmoreno7Apr 17 2015 — edited Apr 28 2015

Hi all!

I’m really newbie on Smart cards in general. Sorry for the bad next coming English :-S

We are developing a mini-app to read the open available data (without encryption) of the official license from the University of Seville.

The Smart Card has a java-card contact-chip with WG10 emulator for retro-compatibility with older cards and with 32Kb of capacity. There is a mifare chip too, but the data we need is at first chip.

The contact-chip content is organized like the next structure:

estructura-MF.png

The data we want to read is written at EFdatos 1005. This EF has more data than we need, so the concrete data is allocated at Offset 0xF2 with length 8d (length in bytes) and his label is “Número de serie”.

Here is a little code to try to read the data from smartcard:


public void cardInfo() throws CardException, CardNotPresentException {

                              TerminalFactory factory = TerminalFactory.getDefault();
                              List <CardTerminal> terminals = factory.terminals().list();
                              CardTerminal terminal = terminals.get(FIRST_TERMINAL);
                              Card card = terminal.connect(PROTOCOL_T0);
                              CardChannel channel = card.getBasicChannel();
             
                              byte[] resp = {(byte)0x00, (byte)0xA4, 0x04, 0x00, 0x00 };
                              CommandAPDU command = new CommandAPDU(resp);
                              ResponseAPDU response = channel.transmit(command);
                              System.out.println(DatatypeConverter.printHexBinary(response.getBytes()));
                              card.disconnect(false);

}

This is the only output I have get without errors/warnings like 6A82, 6D00, 6A86, … (SW1||SW2):

6F658408A000000018434D00A559734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640

B06092A864886FC6B040255650B06092B8510864864020103660C060A2B060104012A026E01029F6E061291111101009F6501FF9000

Other commands like GET DATA, READ BINARY etc. has not worked for me. And with the data above, I have tried to decode it with an ASN1 decoder but neither has got successful info on how to go further with this.

Please can someone help me or give me some idea how to continue. I'm really disappointed.

I really appreciate your help!

Thanks in advance,

Luis.

This post has been answered by dimatteo on Apr 23 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 26 2015
Added on Apr 17 2015
13 comments
3,700 views