summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-04-02 16:38:44 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-04-02 16:38:44 +0000
commita83b192f92f91aac8596cf2a7e6a5f49cda647e4 (patch)
tree3bfcaa930ca7a70c79b41ce9e449e0d2f8b71ff8
parent54b6807c2275544334446bc123932a41f7b13a2f (diff)
downloadmocca-a83b192f92f91aac8596cf2a7e6a5f49cda647e4.tar.gz
mocca-a83b192f92f91aac8596cf2a7e6a5f49cda647e4.tar.bz2
mocca-a83b192f92f91aac8596cf2a7e6a5f49cda647e4.zip
Differenciate between e-card G3a & G3b
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1036 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java21
1 files changed, 18 insertions, 3 deletions
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 a11e720b..8cbe314b 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -142,6 +142,8 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
protected double version = 1.1;
+ protected String friendlyName;
+
protected PinInfo cardPinInfo;
protected PinInfo ssPinInfo;
@@ -165,8 +167,21 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
byte[] ver = ISO7816Utils.readRecord(channel, 1);
if (ver[0] == (byte) 0xa5 && ver[2] == (byte) 0x53) {
version = (0x0F & ver[4]) + (0xF0 & ver[5])/160.0 + (0x0F & ver[5])/100.0;
- String generation = (version < 1.2) ? "<= G2" : "G3";
- log.info("e-card version=" + version + " (" + generation + ")");
+ friendlyName = (version < 1.2) ? "<= G2" : "G3";
+ if (version == 1.2)
+ {
+ // SELECT application
+ execSELECT_AID(channel, AID_INFOBOX);
+ // SELECT file
+ try {
+ // the file identifier has changed with version G3b
+ execSELECT_FID(channel, EF_INFOBOX);
+ friendlyName = "G3b";
+ } catch (FileNotFoundException e) {
+ friendlyName = "G3a";
+ }
+ }
+ log.info("e-card version=" + version + " (" + friendlyName + ")");
}
} catch (CardException e) {
log.warn("Failed to execute command.", e);
@@ -632,7 +647,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
@Override
public String toString() {
- return "e-card";
+ return ("e-card version " + version + " (" + friendlyName + ")");
}
////////////////////////////////////////////////////////////////////////