summaryrefslogtreecommitdiff
path: root/smcc
diff options
context:
space:
mode:
Diffstat (limited to 'smcc')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java13
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java7
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ITCard.java7
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java7
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java17
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SuisseIDCard.java (renamed from smcc/src/main/java/at/gv/egiz/smcc/SwissSignIDCard.java)53
9 files changed, 55 insertions, 61 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
index bb913c67..febb8677 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
@@ -113,10 +113,6 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
*/
protected int appVersion = -1;
- public ACOSCard() {
- super("at/gv/egiz/smcc/ACOSCard");
- }
-
@Override
public void init(Card card, CardTerminal cardTerminal) {
super.init(card, cardTerminal);
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
index 73dadceb..ecf08c54 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
@@ -33,17 +33,13 @@ public abstract class AbstractSignatureCard implements SignatureCard {
private final Logger log = LoggerFactory.getLogger(AbstractSignatureCard.class);
- private ResourceBundle i18n;
- private String resourceBundleName;
-
private Locale locale = Locale.getDefault();
private Card card_;
protected CardReader reader;
- protected AbstractSignatureCard(String resourceBundleName) {
- this.resourceBundleName = resourceBundleName;
+ protected AbstractSignatureCard() {
}
protected String toString(byte[] b) {
@@ -83,13 +79,6 @@ public abstract class AbstractSignatureCard implements SignatureCard {
this.locale = locale;
}
- protected ResourceBundle getResourceBundle() {
- if (i18n == null) {
- i18n = ResourceBundle.getBundle(resourceBundleName, locale);
- }
- return i18n;
- }
-
@Override
public void disconnect(boolean reset) {
log.debug("Disconnect called");
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java b/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java
index bd42f47c..e9f0db83 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java
@@ -68,13 +68,6 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard {
new PinInfo(4, 12, "[0-9]",
"at/gv/egiz/smcc/BELPICCard", "sig.pin", KID, DF_BELPIC, PinInfo.UNKNOWN_RETRIES);
- /**
- * Creates a new instance.
- */
- public BELPICCard() {
- super("at/gv/egiz/smcc/BelpicCard");
- }
-
@Override
@Exclusive
public byte[] getCertificate(KeyboxName keyboxName)
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 9d889d79..f32109c9 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java
@@ -50,10 +50,6 @@ public class EstEIDCard extends AbstractSignatureCard {
private static final PinInfo QS_PIN_SPEC = new PinInfo(5, 12, "[0-9]",
"at/gv/egiz/smcc/EstEIDCard", "qs.pin", KID_PIN_2, DF, PinInfo.UNKNOWN_RETRIES);
- public EstEIDCard() {
- super("at/gv/egiz/smcc/EstEIDCard");
- }
-
@Override
public byte[] getCertificate(KeyboxName keyboxName)
throws SignatureCardException, InterruptedException {
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java
index 9ed65d53..357fc845 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java
@@ -52,13 +52,6 @@ public class ITCard extends AbstractSignatureCard {
"at/gv/egiz/smcc/ITCard", "sig.pin", (byte) 0x10,
new byte[] { (byte) 0x11, (byte) 0x00 }, PinInfo.UNKNOWN_RETRIES);
- /**
- * Creates a new instance.
- */
- public ITCard() {
- super("at/gv/egiz/smcc/ITCard");
- }
-
@Override
@Exclusive
public byte[] getCertificate(KeyboxName keyboxName)
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java b/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java
index 8bd49e01..f9f9af9e 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java
@@ -62,10 +62,6 @@ public class PtEidCard extends AbstractSignatureCard {
new PinInfo(4, 4, "[0-9]",
"at/gv/egiz/smcc/PtEidCard", "sig.pin", (byte) 0x82, DF_ISSUES, PinInfo.UNKNOWN_RETRIES);
- protected PtEidCard() {
- super("at/gv/egiz/smcc/PtEidCard");
- }
-
@Override
public byte[] getCertificate(KeyboxName keyboxName)
throws SignatureCardException, InterruptedException {
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 7eb86601..d619dc39 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -137,13 +137,6 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
protected PinInfo cardPinInfo;
protected PinInfo ssPinInfo;
- /**
- * Creates a new instance.
- */
- public STARCOSCard() {
- super("at/gv/egiz/smcc/STARCOSCard");
- }
-
/* (non-Javadoc)
* @see at.gv.egiz.smcc.AbstractSignatureCard#init(javax.smartcardio.Card, javax.smartcardio.CardTerminal)
*/
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java
index c57b8c3a..efb99820 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java
@@ -393,8 +393,23 @@ public class SignatureCardFactory {
(byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff},
- "at.gv.egiz.smcc.SwissSignIDCard"));
+ "at.gv.egiz.smcc.SuisseIDCard"));
+ supportedCards.add(new SupportedCard(
+ // ATR 3b:f2:18:00:02:c1:0a:31:fe:58:c8:08:74
+ new byte[] { (byte) 0x3b, (byte) 0xf2, (byte) 0x18,
+ (byte) 0x00, (byte) 0x02, (byte) 0xc1, (byte) 0x0a,
+ (byte) 0x31, (byte) 0xfe, (byte) 0x58, (byte) 0xc8,
+ (byte) 0x08, (byte) 0x74},
+ // mask
+ new byte[] {
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff},
+ "at.gv.egiz.smcc.SuisseIDCard"));
+
}
/**
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SwissSignIDCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SuisseIDCard.java
index f2eea0ae..f0f78318 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SwissSignIDCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SuisseIDCard.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import javax.smartcardio.ATR;
import javax.smartcardio.CardChannel;
import javax.smartcardio.CardException;
@@ -36,13 +37,15 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.smcc.util.ISO7816Utils;
import at.gv.egiz.smcc.util.SMCCHelper;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardTerminal;
-public class SwissSignIDCard extends AbstractSignatureCard implements SignatureCard {
+public class SuisseIDCard extends AbstractSignatureCard implements SignatureCard {
/**
* Logging facility.
*/
- private final Logger log = LoggerFactory.getLogger(SwissSignIDCard.class);
+ private final Logger log = LoggerFactory.getLogger(SuisseIDCard.class);
public static final byte[] MF = new byte[] { (byte) 0x3F, (byte) 0x00 };
@@ -55,15 +58,39 @@ public class SwissSignIDCard extends AbstractSignatureCard implements SignatureC
public static final byte KID = (byte) 0x81;
- protected PinInfo pinInfo =
- new PinInfo(5, 12, "[0-9]",
- "at/gv/egiz/smcc/SwissSignIDCard", "pin", KID, AID_SIG, PinInfo.UNKNOWN_RETRIES);
-
- /**
- * Creates a new instance.
- */
- public SwissSignIDCard() {
- super("at/gv/egiz/smcc/SwissSignIDCard");
+ protected PinInfo pinInfo;
+ protected String name = "SuisseID";
+
+ @Override
+ public void init(Card card, CardTerminal cardTerminal) {
+ super.init(card, cardTerminal);
+
+ byte[] atr = card.getATR().getBytes();
+ if (atr[11] == 'S' &&
+ atr[12] == 'w' &&
+ atr[13] == 'i' &&
+ atr[14] == 's' &&
+ atr[15] == 's' &&
+ atr[16] == 'S' &&
+ atr[17] == 'i' &&
+ atr[18] == 'g' &&
+ atr[19] == 'n') {
+ name = "SwissSign SuisseID";
+ pinInfo = new PinInfo(5, 12, "[0-9]",
+ "at/gv/egiz/smcc/SwissSignIDCard", "pin", KID, AID_SIG, PinInfo.UNKNOWN_RETRIES);
+
+ } else {
+ name = "QuoVadis SuisseID";
+ pinInfo = new PinInfo(6, 12, "[0-9]",
+ "at/gv/egiz/smcc/QuoVadisIDCard", "pin", KID, AID_SIG, PinInfo.UNKNOWN_RETRIES);
+ }
+
+ log.debug("initializing {} for ATR {}", name, toString(atr));
+ }
+
+ @Override
+ public String toString() {
+ return name;
}
@Override
@@ -166,10 +193,6 @@ public class SwissSignIDCard extends AbstractSignatureCard implements SignatureC
}
- public String toString() {
- return "Belpic Card";
- }
-
protected void verifyPINLoop(CardChannel channel, PinInfo spec,
PINGUI provider) throws LockedException, NotActivatedException,
SignatureCardException, InterruptedException, CardException {