summaryrefslogtreecommitdiff
path: root/smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-11-10 14:26:19 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-11-10 14:26:19 +0000
commit8a7c17888fd80cf0de70008c31d4679d42dc6489 (patch)
tree93e50f02957dddc3d27628ee69a71fa65d89806a /smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java
parentf52d7c9e8fa0918c511c80c5e298caedb8f39d15 (diff)
downloadmocca-8a7c17888fd80cf0de70008c31d4679d42dc6489.tar.gz
mocca-8a7c17888fd80cf0de70008c31d4679d42dc6489.tar.bz2
mocca-8a7c17888fd80cf0de70008c31d4679d42dc6489.zip
get certificate info from EF.CD
Issue #MOCCA-754 - LIEZertifikat (LIE-Post) Integration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@828 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java b/smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java
index b5ffa267..70a35685 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java
@@ -105,12 +105,29 @@ public class LIEZertifikatCard extends AbstractSignatureCard implements Signatur
CardChannel channel = getCardChannel();
// SELECT DF.CIA
execSELECT_AID(channel, AID_SIG);
- byte[] ef_qcert = getFID_QCERT(channel);
+
+ EFObjectDirectory ef_od = new EFObjectDirectory();
+ ef_od.selectAndRead(channel);
+
+ CIOCertificateDirectory ef_cd = new CIOCertificateDirectory(ef_od.getEf_cd());
+ ef_cd.selectAndRead(channel);
+
+ byte[] ef_qcert = null;
+ for (CIOCertificate cioCertificate : ef_cd.getCIOs()) {
+ String label = cioCertificate.getLabel();
+ //"TEST LLV APO 2s Liechtenstein Post Qualified CA ID"
+ if (label != null && label.toLowerCase()
+ .contains("liechtenstein post qualified ca id")) {
+ ef_qcert = cioCertificate.getEfidOrPath();
+ }
+ }
+
+
if (ef_qcert == null) {
throw new NotActivatedException();
}
- // SELECT CERT
+ // SELECT CERT, assume efid
execSELECT_EF(channel, ef_qcert);
// READ BINARY
@@ -122,6 +139,9 @@ public class LIEZertifikatCard extends AbstractSignatureCard implements Signatur
} catch (FileNotFoundException e) {
throw new NotActivatedException();
+ } catch (IOException ex) {
+ log.warn("failed to get certificate info", ex);
+ throw new SignatureCardException(ex);
} catch (CardException e) {
log.info("Failed to get certificate.", e);
throw new SignatureCardException(e);
@@ -294,7 +314,11 @@ public class LIEZertifikatCard extends AbstractSignatureCard implements Signatur
}
-
+
+ /**
+ *
+ * @return null if not found
+ */
protected byte[] getFID_QCERT(CardChannel channel)
throws SignatureCardException, CardException {