From 8a7c17888fd80cf0de70008c31d4679d42dc6489 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 10 Nov 2010 14:26:19 +0000 Subject: 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 --- .../java/at/gv/egiz/smcc/LIEZertifikatCard.java | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'smcc/src/main/java/at/gv/egiz/smcc/LIEZertifikatCard.java') 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 { -- cgit v1.2.3