summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml1
-rw-r--r--smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml1
4 files changed, 18 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) {
diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml
index 951d903a..963f7ebf 100644
--- a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml
+++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml
@@ -31,6 +31,7 @@
<property name="files">
<list>
<bean parent="EF_Infobox">
+ <property name="fid" value="c0:02" />
<property name="kid" value="-1" />
<property name="container" value="true" />
<property name="publicKey" ref="publicKeyAUT" />
diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml
index 0d872ffb..357f1fd8 100644
--- a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml
+++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml
@@ -31,6 +31,7 @@
<property name="files">
<list>
<bean parent="EF_Infobox">
+ <property name="fid" value="c0:02" />
<property name="kid" value="-1" />
<property name="container" value="true" />
</bean>