From 545b95a682cccde0938c9a2c4047f2fbeb30d7d2 Mon Sep 17 00:00:00 2001 From: tzefferer Date: Tue, 10 Jul 2012 12:12:02 +0000 Subject: TZ: Added support for EstEIDv3.0 card. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1092 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java') diff --git a/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java index 9092c089..6cd584f8 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java @@ -192,10 +192,34 @@ public class EstEIDCard extends AbstractSignatureCard { } - protected void execSELECT_MF(CardChannel channel) - throws SignatureCardException, CardException { - execSELECT(channel, 0x00, 0x04, MF); - } + // protected void execSELECT_MF(CardChannel channel) + // throws SignatureCardException, CardException { + // execSELECT(channel, 0x00, 0x04, MF); + // } + + // In contrast to older cards, + // v3 cards require MF to be selected by APDU [00 A4 00 0C] + protected void execSELECT_MF(CardChannel channel) + throws SignatureCardException, CardException { + + CommandAPDU command = new CommandAPDU((byte) 0x00, (byte) 0xA4, + (byte) 0x00, (byte) 0x0C); + + ResponseAPDU resp = channel.transmit(command); + + if (resp.getSW() == 0x6A82) { + String msg = "Master file not found. SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.info(msg); + throw new FileNotFoundException(msg); + } else if (resp.getSW() != 0x9000) { + String msg = "Failed to select master file. SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.error(msg); + throw new SignatureCardException(msg); + } + + } protected void execSELECT_DF(CardChannel channel, byte[] fid) throws SignatureCardException, CardException { -- cgit v1.2.3