summaryrefslogtreecommitdiff
path: root/smcc/src/main
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-07-14 18:25:49 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-07-14 18:25:49 +0000
commita9334172e2222b8df44ae82b70336a446ba1c73c (patch)
tree0eb4c8fda512832c23d22a06938c6fe0b0abac91 /smcc/src/main
parentcf8a0175d85c2975c553429431f4dbfff16e9dc8 (diff)
downloadmocca-a9334172e2222b8df44ae82b70336a446ba1c73c.tar.gz
mocca-a9334172e2222b8df44ae82b70336a446ba1c73c.tar.bz2
mocca-a9334172e2222b8df44ae82b70336a446ba1c73c.zip
Fixed bug MOCCA-734. Fixed support for eCard G3b (infobox container).
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@769 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smcc/src/main')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java10
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java13
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) {