summaryrefslogtreecommitdiff
path: root/smcc/src/main/java/at/gv
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-06-16 11:19:41 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-06-16 11:19:41 +0000
commit265b0aca555d9880361b754b6a18ce70b5be28cd (patch)
tree158387c96aa33e53beec0caab6bb938148c15587 /smcc/src/main/java/at/gv
parent1615a1e0bea092641bd72351876f6aa6edba655e (diff)
downloadmocca-265b0aca555d9880361b754b6a18ce70b5be28cd.tar.gz
mocca-265b0aca555d9880361b754b6a18ce70b5be28cd.tar.bz2
mocca-265b0aca555d9880361b754b6a18ce70b5be28cd.zip
Refactored smart card unit tests to use Spring to configure smart card emulators.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@754 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smcc/src/main/java/at/gv')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java18
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java2
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java2
3 files changed, 16 insertions, 6 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 eea1b6ed..bb913c67 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
@@ -166,7 +166,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
@Override
@Exclusive
public byte[] getCertificate(KeyboxName keyboxName)
- throws SignatureCardException, InterruptedException {
+ throws SignatureCardException {
byte[] aid;
byte[] fid;
@@ -240,7 +240,13 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
// READ BINARY
while(true) {
try {
- return ISO7816Utils.readTransparentFileTLV(channel, maxSize, (byte) 0x30);
+ byte[] idLink = ISO7816Utils.readTransparentFileTLV(channel, maxSize,
+ (byte) 0x30);
+ if (idLink != null) {
+ return idLink;
+ } else {
+ throw new NotActivatedException();
+ }
} catch (SecurityStatusNotSatisfiedException e) {
verifyPINLoop(channel, infPinInfo, provider);
}
@@ -299,7 +305,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
}
// empty
- return null;
+ throw new NotActivatedException();
} catch (FileNotFoundException e) {
throw new NotActivatedException();
@@ -472,7 +478,11 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
* @see at.gv.egiz.smcc.PINMgmtSignatureCard#getpinInfos()
*/
@Override
- public PinInfo[] getPinInfos() {
+ public PinInfo[] getPinInfos() throws SignatureCardException {
+
+ //check if card is activated
+ getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR);
+
if (appVersion < 2) {
return new PinInfo[] {decPinInfo, sigPinInfo, infPinInfo };
}
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 01d8639a..f092b3fc 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -283,7 +283,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
}
// empty
- return null;
+ throw new NotActivatedException();
} else if ("Status".equals(infobox)) {
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java
index 444de316..f7a8d58b 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java
@@ -118,7 +118,7 @@ public class ISO7816Utils {
// check expected type
int b = is.read();
- if (b == 0x00) {
+ if (b == 0x00 || b == 0xFF) {
return null;
}
if (b == -1 || expectedType != (0xFF & b)) {