diff options
Diffstat (limited to 'smcc/src/main/java/at/gv/egiz')
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java | 18 | ||||
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 2 | ||||
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java | 2 |
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)) { |