diff options
Diffstat (limited to 'smcc/src/main/java/at/gv/egiz')
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java | 10 | ||||
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 13 |
2 files changed, 16 insertions, 7 deletions
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 21028a8a..9d889d79 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java @@ -189,23 +189,23 @@ public class EstEIDCard extends AbstractSignatureCard { protected void execSELECT_MF(CardChannel channel) throws SignatureCardException, CardException { - execSELECT(channel, 0x00, MF); + execSELECT(channel, 0x00, 0x04, MF); } protected void execSELECT_DF(CardChannel channel, byte[] fid) throws SignatureCardException, CardException { - execSELECT(channel, 0x01, fid); + execSELECT(channel, 0x01, 0x04, fid); } protected void execSELECT_EF(CardChannel channel, byte[] fid) throws SignatureCardException, CardException { - execSELECT(channel, 0x02, fid); + execSELECT(channel, 0x02, 0x04, fid); } - protected void execSELECT(CardChannel channel, int p1, byte[] fid) + protected void execSELECT(CardChannel channel, int p1, int p2, byte[] fid) throws SignatureCardException, CardException { - CommandAPDU command = new CommandAPDU(0x00, 0xA4, p1, 0x0C, fid, 256); + CommandAPDU command = new CommandAPDU(0x00, 0xA4, p1, p2, fid, 256); ResponseAPDU resp = channel.transmit(command); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java index f092b3fc..7eb86601 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java @@ -90,7 +90,9 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x18, (byte) 0x01 }; - public static final byte[] EF_INFOBOX = new byte[] { (byte) 0xef, (byte) 0x01 }; + public static final byte[] EF_INFOBOX_LEGACY = new byte[] { (byte) 0xef, (byte) 0x01 }; + + public static final byte[] EF_INFOBOX = { (byte) 0xc0, (byte) 0x02 }; public static final byte[] AID_SVSIG_CERT = new byte[] { (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, @@ -232,7 +234,14 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu // SELECT application execSELECT_AID(channel, AID_INFOBOX); // SELECT file - execSELECT_FID(channel, EF_INFOBOX); + try { + // the file identifier has changed with version G3b + execSELECT_FID(channel, EF_INFOBOX); + } catch (FileNotFoundException e) { + // fallback for < G3b + log.debug("Not an eCard G3b, falling back to legacy FID for EF_Infobox."); + execSELECT_FID(channel, EF_INFOBOX_LEGACY); + } InfoboxContainer infoboxContainer = null; while (infoboxContainer == null) { |