aboutsummaryrefslogtreecommitdiff
path: root/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans
diff options
context:
space:
mode:
authorgregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2003-12-01 09:29:01 +0000
committergregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2003-12-01 09:29:01 +0000
commit1bfa47c942022dbf4b294cdd494b728deb84298b (patch)
tree0cbd96b0997f1c3ddbd0fe5b8ab6305a58a2281d /spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans
parent75181af53bbe97bee472e5e8923c54bbd06ac32b (diff)
downloadmoa-id-spss-1bfa47c942022dbf4b294cdd494b728deb84298b.tar.gz
moa-id-spss-1bfa47c942022dbf4b294cdd494b728deb84298b.tar.bz2
moa-id-spss-1bfa47c942022dbf4b294cdd494b728deb84298b.zip
Zwischenstand
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@65 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans')
-rw-r--r--spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/ChecksInfoBean.java165
-rw-r--r--spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java25
-rw-r--r--spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/SignerInfoBean.java127
3 files changed, 317 insertions, 0 deletions
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/ChecksInfoBean.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/ChecksInfoBean.java
new file mode 100644
index 000000000..00c9fd517
--- /dev/null
+++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/ChecksInfoBean.java
@@ -0,0 +1,165 @@
+/*
+ * Created on 27.11.2003
+ *
+ * (c) Stabsstelle IKT-Strategie des Bundes
+ */
+package at.gv.egovernment.moa.spss.slinterface.beans;
+
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import at.gv.egovernment.moa.spss.slinterface.Constants;
+import at.gv.egovernment.moa.spss.slinterface.DOMUtils;
+
+/**
+ * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
+ */
+public class ChecksInfoBean
+{
+ private static final String SIG_CHECK_ELEM_ = "SignatureCheck";
+ private static final String SIGMF_CHECK_ELEM_ = "SignatureManifestCheck";
+ private static final String XMLDSIGMF_CHECK_ELEM_ = "XMLDSIGManifestCheck";
+ private static final String CERT_CHECK_ELEM_ = "CertificateCheck";
+ private static final String CODE_ELEM_ = "Code";
+ private static final String INFO_ELEM_ = "Info";
+ private static final String FAILEDREF_ELEM_ = "FailedReference";
+ private static final String REFSIGREF_ELEM_ = "ReferringSigReference";
+
+ private Element sigCheckElem_;
+ private int sigCheckFaildRefCount_;
+
+ private Element sigMFCheckElem_;
+ private int sigMFCheckFaildRefCount_;
+
+ private List xmldsigMFCheckElems_;
+ private int xmldsigMFCheckCount_;
+ private int xmldsigMFCheckFaildRefCount_;
+
+ private Element certCheckElem_;
+
+ /**
+ * Creates a bean with information about the checks executed for the verified xml signature.
+ *
+ * @pre slResponseDoc has been validated.
+ */
+ public ChecksInfoBean(Document slResponseDoc)
+ {
+ Element verifyXMLResponseElem = slResponseDoc.getDocumentElement();
+ sigCheckElem_ = DOMUtils.getChildElem(
+ verifyXMLResponseElem, Constants.NSURI_SL_11_, SIG_CHECK_ELEM_);
+ sigMFCheckElem_ = DOMUtils.getChildElem(
+ verifyXMLResponseElem, Constants.NSURI_SL_11_, SIGMF_CHECK_ELEM_);
+ xmldsigMFCheckElems_ = DOMUtils.getChildElems(
+ verifyXMLResponseElem, Constants.NSURI_SL_11_, XMLDSIGMF_CHECK_ELEM_, false);
+ certCheckElem_ = DOMUtils.getChildElem(
+ verifyXMLResponseElem, Constants.NSURI_SL_11_, CERT_CHECK_ELEM_);
+
+ sigCheckFaildRefCount_ = 0;
+ sigMFCheckFaildRefCount_ = 0;
+ xmldsigMFCheckFaildRefCount_ = 0;
+ xmldsigMFCheckCount_ = 0;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSigCheckCode()
+ {
+ return DOMUtils.getChildText(sigCheckElem_, Constants.NSURI_SL_11_, CODE_ELEM_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setSigCheckFailedRefCount(int count)
+ {
+ sigCheckFaildRefCount_ = count;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSigCheckFailedRef()
+ {
+ Element info = DOMUtils.getChildElem(sigCheckElem_, Constants.NSURI_SL_11_, INFO_ELEM_);
+ if (info == null) return null;
+ List failedRefElems = DOMUtils.getChildElems(info, Constants.NSURI_SL_11_, FAILEDREF_ELEM_, false);
+ if (failedRefElems == null || failedRefElems.size() <= sigCheckFaildRefCount_) return null;
+ return DOMUtils.getText((Element)failedRefElems.get(sigCheckFaildRefCount_));
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSigMFCheckCode()
+ {
+ return DOMUtils.getChildText(sigMFCheckElem_, Constants.NSURI_SL_11_, CODE_ELEM_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setSigMFCheckFailedRefCount(int count)
+ {
+ sigMFCheckFaildRefCount_ = count;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSigMFCheckFailedRef()
+ {
+ Element info = DOMUtils.getChildElem(sigMFCheckElem_, Constants.NSURI_SL_11_, INFO_ELEM_);
+ if (info == null) return null;
+ List failedRefElems = DOMUtils.getChildElems(info, Constants.NSURI_SL_11_, FAILEDREF_ELEM_, false);
+ if (failedRefElems == null || failedRefElems.size() <= sigMFCheckFaildRefCount_) return null;
+ return DOMUtils.getText((Element)failedRefElems.get(sigMFCheckFaildRefCount_));
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setXmldsigMFCheckCount(int count)
+ {
+ xmldsigMFCheckCount_ = count;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setXmldsigMFCheckFailedRefCount(int count)
+ {
+ xmldsigMFCheckFaildRefCount_ = count;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getXmldsigMFCheckCode()
+ {
+ Element xmldsigMFCheckElem = (Element)xmldsigMFCheckElems_.get(xmldsigMFCheckCount_);
+ return DOMUtils.getChildText(xmldsigMFCheckElem, Constants.NSURI_SL_11_, CODE_ELEM_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getXmldsigMFCheckFailedRef()
+ {
+ Element xmldsigMFCheckElem = (Element)xmldsigMFCheckElems_.get(xmldsigMFCheckCount_);
+ Element info = DOMUtils.getChildElem(xmldsigMFCheckElem, Constants.NSURI_SL_11_, INFO_ELEM_);
+ if (info == null) return null;
+ List failedRefElems = DOMUtils.getChildElems(info, Constants.NSURI_SL_11_, FAILEDREF_ELEM_, false);
+ if (failedRefElems == null || failedRefElems.size() <= xmldsigMFCheckFaildRefCount_) return null;
+ return DOMUtils.getText((Element)failedRefElems.get(xmldsigMFCheckFaildRefCount_));
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getXmldsigMFCheckReferringSigRef()
+ {
+ Element xmldsigMFCheckElem = (Element)xmldsigMFCheckElems_.get(xmldsigMFCheckCount_);
+ Element info = DOMUtils.getChildElem(xmldsigMFCheckElem, Constants.NSURI_SL_11_, INFO_ELEM_);
+ if (info == null) return null;
+ return DOMUtils.getChildText(info, Constants.NSURI_SL_11_, REFSIGREF_ELEM_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getCertCheckCode()
+ {
+ return DOMUtils.getChildText(certCheckElem_, Constants.NSURI_SL_10_, CODE_ELEM_);
+ }
+}
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java
new file mode 100644
index 000000000..1a64312d7
--- /dev/null
+++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java
@@ -0,0 +1,25 @@
+/*
+ * Created on 27.11.2003
+ *
+ * (c) Stabsstelle IKT-Strategie des Bundes
+ */
+package at.gv.egovernment.moa.spss.slinterface.beans;
+
+import org.w3c.dom.Document;
+
+/**
+ * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
+ */
+public class DataInfoBean
+{
+
+ /**
+ *
+ */
+ public DataInfoBean(Document slResponseDoc)
+ {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/SignerInfoBean.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/SignerInfoBean.java
new file mode 100644
index 000000000..2893b2ac3
--- /dev/null
+++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/SignerInfoBean.java
@@ -0,0 +1,127 @@
+/*
+ * Created on 27.11.2003
+ *
+ * (c) Stabsstelle IKT-Strategie des Bundes
+ */
+package at.gv.egovernment.moa.spss.slinterface.beans;
+
+import iaik.asn1.ObjectID;
+import iaik.asn1.structures.Name;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import at.gv.egovernment.moa.spss.slinterface.Constants;
+import at.gv.egovernment.moa.spss.slinterface.DOMUtils;
+
+/**
+ * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at)
+ */
+public class SignerInfoBean
+{
+ private static final String SIGNERINFO_ELEM_ = "SignerInfo";
+ private static final String X509DATA_ELEM_ = "X509Data";
+ private static final String X509SUBJNAME_ELEM_ = "X509SubjectName";
+ private static final String X509ISSUERSERIAL_ELEM_ = "X509IssuerSerial";
+ private static final String SERIAL_ELEM_ = "X509SerialNumber";
+ private static final String ISSUER_ELEM_ = "X509IssuerName";
+ private static final String QUALCERT_ELEM_ = "QualifiedCertificate";
+
+ private Element signerInfoElem_;
+
+ private String subjectNameItemSel_;
+ private String issuerNameItemSel_;
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public SignerInfoBean(Document slResponseDoc)
+ {
+ Element verifyXMLResponseElem = slResponseDoc.getDocumentElement();
+ signerInfoElem_ = DOMUtils.getChildElem(
+ verifyXMLResponseElem, Constants.NSURI_SL_11_, SIGNERINFO_ELEM_);
+
+ subjectNameItemSel_ = "2.5.4.3";
+ issuerNameItemSel_ = "2.5.4.3";
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setSubjectNameItemSel(String selector)
+ {
+ subjectNameItemSel_ = selector;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSubjectNameItem()
+ {
+ Element x509DataElem = DOMUtils.getChildElem(signerInfoElem_, Constants.NSURI_DSIG_, X509DATA_ELEM_);
+ String subjectNameStr = DOMUtils.getChildText(x509DataElem, Constants.NSURI_DSIG_, X509SUBJNAME_ELEM_);
+ if (subjectNameStr == null) return null;
+ return getRDN(subjectNameStr, subjectNameItemSel_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getSerial()
+ {
+ Element x509DataElem = DOMUtils.getChildElem(signerInfoElem_, Constants.NSURI_DSIG_, X509DATA_ELEM_);
+ Element iSElem = DOMUtils.getChildElem(x509DataElem, Constants.NSURI_DSIG_, X509ISSUERSERIAL_ELEM_);
+ return DOMUtils.getChildText(iSElem, Constants.NSURI_DSIG_, SERIAL_ELEM_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public void setIssuerNameItemSel(String selector)
+ {
+ issuerNameItemSel_ = selector;
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public String getIssuerNameItem()
+ {
+ Element x509DataElem = DOMUtils.getChildElem(signerInfoElem_, Constants.NSURI_DSIG_, X509DATA_ELEM_);
+ Element iSElem = DOMUtils.getChildElem(x509DataElem, Constants.NSURI_DSIG_, X509ISSUERSERIAL_ELEM_);
+ String issuerNameStr = DOMUtils.getChildText(iSElem, Constants.NSURI_DSIG_, ISSUER_ELEM_);
+ if (issuerNameStr == null) return null;
+ return getRDN(issuerNameStr, issuerNameItemSel_);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ public boolean getIsQualified()
+ {
+ Element x509DataElem = DOMUtils.getChildElem(signerInfoElem_, Constants.NSURI_DSIG_, X509DATA_ELEM_);
+ Element qCElem = DOMUtils.getChildElem(x509DataElem, Constants.NSURI_SL_11_, QUALCERT_ELEM_);
+ return (qCElem != null);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ private String getRDN(String nameStr, String oidStr)
+ {
+ try
+ {
+ RFC2253NameParser nameParser = new RFC2253NameParser(nameStr);
+ Name name = nameParser.parse();
+ ObjectID oid = ObjectID.getObjectID(oidStr);
+ if (oid == null) return null;
+ String[] rdns = name.getRDNs(oid);
+ if (rdns == null) return null;
+ StringBuffer rdnsStr = new StringBuffer();
+ for (int i = 0; i < rdns.length; i++)
+ {
+ if (i > 0) rdnsStr.append(", ");
+ rdnsStr.append(rdns[i]);
+ }
+ return rdnsStr.toString();
+ }
+ catch (RFC2253NameParserException e)
+ {
+ return null;
+ }
+ }
+}