From d040b091d0e8556a536978fe830e5db7695e5bef Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 22 Jul 2005 16:07:10 +0000 Subject: updated for MAO WID (wbPK) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@400 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/Constants.java | 35 ++++++++++++++++++++-- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 22 ++++++++++++++ .../src/at/gv/egovernment/moa/util/XPathUtils.java | 1 + 3 files changed, 56 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 48b633b94..99fe81065 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -43,7 +43,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.2.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = @@ -66,7 +66,18 @@ public interface Constants { /** Local location of the Security Layer 1.1 XML schema definition */ public static final String SL11_SCHEMA_LOCATION = SCHEMA_ROOT + "Core.20020831.xsd"; + + /** URI of the Security Layer 1.2 XML namespace */ + public static final String SL12_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; + + /** Prefix used for the Security Layer 1.2 XML namespace */ + public static final String SL12_PREFIX = "sl"; + /** Local location of the Security Layer 1.2 XML schema definition */ + public static final String SL12_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core-1.2.xsd"; + /** URI of the ECDSA XML namespace */ public static final String ECDSA_NS_URI = "http://www.w3.org/2001/04/xmldsig-more#"; @@ -101,9 +112,13 @@ public interface Constants { /** Prefix used for the PersonData XML namespace */ public static final String PD_PREFIX = "pr"; +// /** Local location of the PersonData XML schema definition */ +// public static final String PD_SCHEMA_LOCATION = +// SCHEMA_ROOT + "PersonData.xsd"; + /** Local location of the PersonData XML schema definition */ public static final String PD_SCHEMA_LOCATION = - SCHEMA_ROOT + "PersonData.xsd"; + SCHEMA_ROOT + "PersonData_20_en.xsd"; /** URI of the SAML namespace. */ public static final String SAML_NS_URI = @@ -208,6 +223,7 @@ public interface Constants { + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI_ANCIENT + " " + ECDSA_SCHEMA_LOCATION_ANCIENT + " ") + (ECDSA_NS_URI_WRONG + " " + ECDSA_SCHEMA_LOCATION_WRONG + " ") // TODO Entfernen, sobald ZMR umgestellt hat @@ -221,6 +237,21 @@ public interface Constants { + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); + /** URN prefix for bPK and wbPK. */ + public static final String URN_PREFIX = "urn:publicid:gv.at"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; + + /** URN prefix for context dependent id (bPK). */ + public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; + + /** URN prefix for context dependent id (wbPK). */ + public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; + /** Security Layer manifest type URI. */ public static final String SL_MANIFEST_TYPE_URI = "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 53b1a0e48..52f6554d5 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -41,6 +41,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; + import at.gv.egovernment.moa.logging.Logger; /** @@ -832,5 +833,26 @@ public class DOMUtils { } return false; } + + /** + * Selects the (first) element from a node list and returns it. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or null + * if the node list is null or empty or no element is + * included in the list. + */ + public static Element getElementFromNodeList (NodeList nl) { + if ((nl == null) || (nl.getLength() == 0)) { + return null; + } + for (int i=0; i