diff options
Diffstat (limited to 'moaSig/common')
54 files changed, 7148 insertions, 3825 deletions
diff --git a/moaSig/common/build.gradle b/moaSig/common/build.gradle index 9b88188..5e9122b 100644 --- a/moaSig/common/build.gradle +++ b/moaSig/common/build.gradle @@ -1,10 +1,23 @@ dependencies { - compile files('../libs/iaik_jce_full.jar') + implementation files('../libs/iaik_jce_full-5.62_moa.jar') + api 'org.slf4j:slf4j-api:1.7.30' + api 'xerces:xercesImpl:2.12.0' + api 'xalan:xalan:2.7.1' + api group: 'xalan', name: 'serializer', version: '2.7.1' + api 'joda-time:joda-time:2.10.10' + api 'jaxen:jaxen:1.2.0' +} + +task testJar(type: Jar, dependsOn: testClasses) { + from sourceSets.test.output + classifier = 'tests' +} + +configurations { + tests +} - compile 'org.slf4j:slf4j-api:1.7.12' - compile 'xerces:xercesImpl:2.11.0' - compile 'xalan:xalan:2.7.1' - compile 'joda-time:joda-time:2.8.2' - compile 'jaxen:jaxen:1.1.6' +artifacts { + archives testJar } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java index 9eb84fa..54ab102 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LogMsg.java @@ -21,23 +21,22 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.logging; /** * A unified message type to log messages from inside the MOA subsystem. - * + * * @author Patrick Peck * @version $Id$ */ public class LogMsg { /** The message to log. */ - private Object message; + private final Object message; /** * Create a <code>LogMsg</code> object. - * - * @param message The actual message to log. May be <code>null</code>. + * + * @param message The actual message to log. May be <code>null</code>. */ public LogMsg(Object message) { this.message = message; @@ -45,16 +44,17 @@ public class LogMsg { /** * Convert this log message to a <code>String</code>. - * - * @return The <code>String</code> representation of this log message. + * + * @return The <code>String</code> representation of this log message. */ + @Override public String toString() { - StringBuffer msg = new StringBuffer(); - LoggingContext ctx = - LoggingContextManager.getInstance().getLoggingContext(); - String tid = ctx != null ? ctx.getTransactionID() : null; - String nodeId = ctx != null ? ctx.getNodeID() : null; - + final StringBuffer msg = new StringBuffer(); + final LoggingContext ctx = + LoggingContextManager.getInstance().getLoggingContext(); + final String tid = ctx != null ? ctx.getTransactionID() : null; + final String nodeId = ctx != null ? ctx.getNodeID() : null; + msg.append("TID="); msg.append(tid != null ? tid : "<null>"); msg.append(" NID="); diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java index 532a8be..23908ab 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/Logger.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.logging; import java.util.HashMap; @@ -29,28 +28,28 @@ import java.util.Map; /** * A utility class acting as a facade to the logging subsystem. - * + * * Configure the logging defaultHierarchy that the <code>Logger</code> uses by * calling <code>setHierarchy</code> once before calling any of the logging * output functions. - * + * * @author Patrick Peck * @version $Id$ */ public class Logger { - + /** * Set the default hierarchy to which the <code>Logger</code> should send its * logging output. + * * @param hierarchy The logging defaultHierarchy. */ public static void setHierarchy(String hierarchy) { - // there is no need for that anymore + // there is no need for that anymore } - /** The Constant instances. */ - private static final Map<String, org.slf4j.Logger> instances = new HashMap<String, org.slf4j.Logger>(); + private static final Map<String, org.slf4j.Logger> instances = new HashMap<>(); /** * Gets the logger. @@ -58,173 +57,177 @@ public class Logger { * @return the logger */ private static synchronized org.slf4j.Logger getLogger() { - StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); - - int i; - for(i = 2; i < stacktrace.length; i++) - if(!stacktrace[i].getClassName().equals(Logger.class.getName())) - break; + final StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); - String className = stacktrace[i].getClassName(); - - org.slf4j.Logger logger = instances.get(className); - if (logger != null) { - return logger; + int i; + for (i = 2; i < stacktrace.length; i++) { + if (!stacktrace[i].getClassName().equals(Logger.class.getName())) { + break; } + } - logger = org.slf4j.LoggerFactory.getLogger(className); - instances.put(className, logger); + final String className = stacktrace[i].getClassName(); + org.slf4j.Logger logger = instances.get(className); + if (logger != null) { return logger; + } + + logger = org.slf4j.LoggerFactory.getLogger(className); + instances.put(className, logger); + + return logger; } - + /** * Prepare the message for printing it as string. - * <p>Mainly introduce because the <code>message</code> might be <code>null</code>. + * <p> + * Mainly introduce because the <code>message</code> might be <code>null</code>. * * @param message the message * @return the string */ private static String prepareMessage(Object message) { - if(null == message) - return "no message given"; - return message.toString(); + if (null == message) { + return "no message given"; + } + return message.toString(); } - + /** * Test, if the trace log level is enabled. - * + * * @return boolean <code>true</code>, if tracing output is enabled - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ public static boolean isTraceEnabled() { - org.slf4j.Logger logger = getLogger(); - return logger.isTraceEnabled(); + final org.slf4j.Logger logger = getLogger(); + return logger.isTraceEnabled(); } - + /** * Test, if the trace log level is enabled for a given hierarchy. - * + * * @param hierarchy requested log hierarchy * @return boolean <code>true</code>, if tracing output is enabled - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ public static boolean isTraceEnabled(String hierarchy) { - org.slf4j.Logger logger = getLogger(); - return logger.isTraceEnabled(); + final org.slf4j.Logger logger = getLogger(); + return logger.isTraceEnabled(); } - + /** * Trace a message. - * + * * @param message The message to trace. */ public static void trace(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.trace(prepareMessage(message)); + final org.slf4j.Logger logger = getLogger(); + logger.trace(prepareMessage(message)); } - + /** * Test, if the debug log level is enabled. - * + * * @return boolean <code>true</code>, if debug output is enabled - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ public static boolean isDebugEnabled() { - org.slf4j.Logger logger = getLogger(); - return logger.isDebugEnabled(); + final org.slf4j.Logger logger = getLogger(); + return logger.isDebugEnabled(); } - + /** * Test, if the debug log level is enabled for a given hierarchy. - * + * * @param hierarchy requested log hierarchy * @return boolean <code>true</code>, if debug output is enabled - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ public static boolean isDebugEnabled(String hierarchy) { - org.slf4j.Logger logger = getLogger(); - return logger.isDebugEnabled(); + final org.slf4j.Logger logger = getLogger(); + return logger.isDebugEnabled(); } - + /** * Log a debug message. - * + * * @param message The message to log. */ public static void debug(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.debug(prepareMessage(message)); + final org.slf4j.Logger logger = getLogger(); + logger.debug(prepareMessage(message)); } -/** + /** * Log an info message. - * + * * @param message The message to log. */ public static void info(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.info(prepareMessage(message)); + final org.slf4j.Logger logger = getLogger(); + logger.info(prepareMessage(message)); } - + /** * Log a warning message. - * + * * @param message The message to log. */ public static void warn(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.warn(prepareMessage(message)); + final org.slf4j.Logger logger = getLogger(); + logger.warn(prepareMessage(message)); } /** * Log a warning message. - * + * * @param message The message to log. - * @param t An exception that may be the cause of the warning. + * @param t An exception that may be the cause of the warning. */ public static void warn(Object message, Throwable t) { - org.slf4j.Logger logger = getLogger(); - logger.warn(prepareMessage(message), t); + final org.slf4j.Logger logger = getLogger(); + logger.warn(prepareMessage(message), t); } - + /** * Log an error message. - * + * * @param message The message to log. */ public static void error(Object message) { - org.slf4j.Logger logger = getLogger(); - logger.error(prepareMessage(message)); + final org.slf4j.Logger logger = getLogger(); + logger.error(prepareMessage(message)); } /** * Log an error message. - * + * * @param message The message to log. - * @param t An exception that may be the cause of the error. + * @param t An exception that may be the cause of the error. */ public static void error(Object message, Throwable t) { - org.slf4j.Logger logger = getLogger(); - logger.error(prepareMessage(message), t); + final org.slf4j.Logger logger = getLogger(); + logger.error(prepareMessage(message), t); } - + /** * Log a fatal error message. - * + * * @param message The message to log. */ public static void fatal(Object message) { - error(message); + error(message); } /** * Log a fatal error message. - * + * * @param message The message to log. - * @param t An exception that may be the cause of the error. + * @param t An exception that may be the cause of the error. */ public static void fatal(Object message, Throwable t) { - error(message, t); + error(message, t); } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java index 0fb0e7d..d8f03a6 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContext.java @@ -21,47 +21,46 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.logging; /** * Encapsulates contextual information (i.e. per request information) for * logging purposes. - * + * * @author Patrick Peck * @version $Id$ */ public class LoggingContext { /** The name of the node ID system property. */ public static final String NODE_ID_PROPERTY = "moa.node-id"; - + /** The current transaction ID. */ - private String transactionID; + private final String transactionID; /** The node ID. */ - private String nodeID; - + private final String nodeID; + /** * Create a new <code>LoggingContext</code>. - * + * * @param transactionID The transaction ID. May be <code>null</code>. */ public LoggingContext(String transactionID) { this.transactionID = transactionID; this.nodeID = System.getProperty(NODE_ID_PROPERTY); } - + /** * Return the transaction ID. - * + * * @return The transaction ID. */ public String getTransactionID() { return transactionID; } - + /** * Return the node ID. - * + * * @return The node ID. */ public String getNodeID() { diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java index b4cd294..aa4bfe8 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/logging/LoggingContextManager.java @@ -21,25 +21,24 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.logging; /** * Provides each thread with a single instance of <code>LoggingContext</code>. - * + * * @author Patrick Peck * @version $Id$ */ public class LoggingContextManager { /** The single instance of this class. */ private static LoggingContextManager instance = null; - + /** The <code>LoggingContext</code> for each thread. */ - private ThreadLocal context; - + private final ThreadLocal context; + /** * Get the single instance of the <code>LoggingContextManager</code> class. - * + * * @return LoggingContextManager The single instance. */ public static synchronized LoggingContextManager getInstance() { @@ -48,30 +47,30 @@ public class LoggingContextManager { } return instance; } - + /** * Creates a new <code>LoggingContextManager</code>. - * + * * Protected to disallow direct instantiation. */ protected LoggingContextManager() { context = new ThreadLocal(); } - + /** * Set the <code>LoggingContext</code> context for the current thread. - * + * * @param ctx The <code>LoggingContext</code> for the current thread. */ public void setLoggingContext(LoggingContext ctx) { context.set(ctx); } - + /** * Return the <code>LoggingContext</code> for the current thread. - * + * * @return LoggingContext The <code>LoggingContext</code> for the current - * thread, or <code>null</code> if none has been set. + * thread, or <code>null</code> if none has been set. */ public LoggingContext getLoggingContext() { return (LoggingContext) context.get(); diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java index 25a19bc..2c9b4c0 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Base64Utils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.ByteArrayInputStream; @@ -35,81 +34,81 @@ import iaik.utils.Base64OutputStream; /** * Utitility functions for encoding/decoding Base64 strings. - * + * * @author Patrick Peck * @version $Id$ */ public class Base64Utils { /** - * Read the bytes encoded in a Base64 encoded <code>String</code>. - * - * @param base64String The <code>String</code> containing the Base64 encoded - * bytes. + * Read the bytes encoded in a Base64 encoded <code>String</code>. + * + * @param base64String The <code>String</code> containing the Base64 + * encoded bytes. * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. * @return byte[] The raw bytes contained in the <code>base64String</code>. * @throws IOException Failed to read the Base64 data. */ public static byte[] decode(String base64String, boolean ignoreInvalidChars, String encoding) - throws IOException { - - Base64InputStream in = - new Base64InputStream( - new ByteArrayInputStream(base64String.getBytes(encoding)), - ignoreInvalidChars); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] bytes = new byte[256]; + throws IOException { + + final Base64InputStream in = + new Base64InputStream( + new ByteArrayInputStream(base64String.getBytes(encoding)), + ignoreInvalidChars); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + final byte[] bytes = new byte[256]; int bytesRead; while ((bytesRead = in.read(bytes)) > 0) { out.write(bytes, 0, bytesRead); } in.close(); - + return out.toByteArray(); } public static byte[] decode(String base64String, boolean ignoreInvalidChars) throws IOException { - return decode(base64String, ignoreInvalidChars, "UTF-8"); + return decode(base64String, ignoreInvalidChars, "UTF-8"); } - + /** * Read the bytes encoded in a Base64 encoded <code>String</code> and provide * them via an <code>InputStream</code>. - * - * @param base64String The <code>String</code> containing the Base64 encoded - * bytes. + * + * @param base64String The <code>String</code> containing the Base64 + * encoded bytes. * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. * @return The <code>InputStream</code> from which the binary content of the - * <code>base64String</code> can be read. + * <code>base64String</code> can be read. */ public static InputStream decodeToStream( - String base64String, - boolean ignoreInvalidChars, - String encoding) { + String base64String, + boolean ignoreInvalidChars, + String encoding) { try { - ByteArrayInputStream bin = - new ByteArrayInputStream(base64String.getBytes(encoding)); - Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); - + final ByteArrayInputStream bin = + new ByteArrayInputStream(base64String.getBytes(encoding)); + final Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); + return in; - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { // cannot occur, since UTF-8 is required to be supported by every JRE - return null; + return null; } } public static InputStream decodeToStream( - String base64String, - boolean ignoreInvalidChars) { - return decodeToStream(base64String, ignoreInvalidChars, "UTF-8"); - + String base64String, + boolean ignoreInvalidChars) { + return decodeToStream(base64String, ignoreInvalidChars, "UTF-8"); + } - + /** * Convert a byte array to a Base64 encoded <code>String</code>. - * + * * @param bytes The bytes to encode. * @return String The Base64 encoded representation of the <code>bytes</code>. * @throws IOException Failed to write the bytes as Base64 data. @@ -119,25 +118,26 @@ public class Base64Utils { } public static String encode(byte[] bytes, String encoding) throws IOException { - return encode(new ByteArrayInputStream(bytes), encoding); - } - + return encode(new ByteArrayInputStream(bytes), encoding); + } + public static String encode(InputStream inputStream) throws IOException { - return encode(inputStream, "UTF-8"); + return encode(inputStream, "UTF-8"); } + /** * Convert the data contained in the given stream to a Base64 encoded * <code>String</code>. - * + * * @param inputStream The stream containing the data to encode. - * @return The Base64 encoded data of <code>inputStream</code>, as a - * <code>String</code>. + * @return The Base64 encoded data of <code>inputStream</code>, as a + * <code>String</code>. * @throws IOException Failed to convert the data in the stream. */ public static String encode(InputStream inputStream, String encoding) throws IOException { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); - byte[] bytes = new byte[256]; + final ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + final Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); + final byte[] bytes = new byte[256]; int bytesRead; while ((bytesRead = inputStream.read(bytes)) > 0) { diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java index 56eab08..42f98bc 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/BoolUtils.java @@ -21,25 +21,24 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; /** * Utility class for parsing XML schema boolean values. - * + * * @author Patrick Peck * @version $Id$ */ public class BoolUtils { - + /** - * Return the boolean value of an <code>xsd:boolean</code> type of DOM + * Return the boolean value of an <code>xsd:boolean</code> type of DOM * element/attribute. - * + * * @param boolStr The value of the <code>xsd:boolean</code> element/attribute. - * @return <code>true</code>, if <code>boolStr</code> equals - * <code>"true"</code> or <code>"1;"</code>. Otherwise, - * <code>false</code> is returned. + * @return <code>true</code>, if <code>boolStr</code> equals + * <code>"true"</code> or <code>"1;"</code>. + * Otherwise, <code>false</code> is returned. */ public static boolean valueOf(String boolStr) { return "true".equals(boolStr) || "1".equals(boolStr); diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java index 01a80ea..dcca377 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/CollectionUtils.java @@ -21,40 +21,39 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.Iterator; import java.util.List; /** - * Various utility methods for dealing with <code>java.util.Collection</code> - * classes. - * + * Various utility methods for dealing with <code>java.util.Collection</code> + * classes. + * * @author Patrick Peck * @version $Id$ */ public class CollectionUtils { - + /** - * Convert a <code>List</code> of <code>Number</code> objects to an + * Convert a <code>List</code> of <code>Number</code> objects to an * <code>int</code> array. - * - * @param nums The <code>List</code> containing the numbers whose integer - * value to put into the result. - * @return The <code>int</code> values of the <code>Number</code>s contained - * in <code>nums</code>. + * + * @param nums The <code>List</code> containing the numbers whose integer value + * to put into the result. + * @return The <code>int</code> values of the <code>Number</code>s contained in + * <code>nums</code>. */ public static int[] toIntArray(List nums) { - int[] result = new int[nums.size()]; + final int[] result = new int[nums.size()]; Iterator iter; int i; - + for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { - Number num = (Number) iter.next(); + final Number num = (Number) iter.next(); result[i] = num.intValue(); } - + return result; } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java index 549f8e3..1102975 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java @@ -21,506 +21,557 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.HashMap; /** * Contains various constants used throughout the system. - * + * * @author Patrick Peck * @version $Id$ */ public interface Constants { /** Root location of the schema files. */ - public static final String SCHEMA_ROOT = "/resources/schemas/"; + String SCHEMA_ROOT = "/resources/schemas/"; /** URI of the Widerrufregister XML namespace. */ - public static final String WRR_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/20041223"; + String WRR_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/20041223"; /** Prefix used for the Widerrufregister XML namespace */ - public static final String WRR_PREFIX = "wrr"; + String WRR_PREFIX = "wrr"; /** URI of the StandardTextBlock XML namespace. */ - public static final String STB_NS_URI = - "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; + String STB_NS_URI = + "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; /** Prefix used for the standard text block XML namespace */ - public static final String STB_PREFIX = "stb"; + String STB_PREFIX = "stb"; /** URI of the MOA XML namespace. */ - public static final String MOA_NS_URI = - "http://reference.e-government.gv.at/namespace/moa/20020822#"; + String MOA_NS_URI = + "http://reference.e-government.gv.at/namespace/moa/20020822#"; /** Name of the mandates infobox */ - public static final String INFOBOXIDENTIFIER_MANDATES = "Mandates"; + String INFOBOXIDENTIFIER_MANDATES = "Mandates"; /** Prefix used for the Mandate XML namespace */ - public static final String MD_PREFIX = "md"; + String MD_PREFIX = "md"; /** URI of the Mandate XML namespace. */ - public static final String MD_NS_URI = - "http://reference.e-government.gv.at/namespace/mandates/20040701#"; + String MD_NS_URI = + "http://reference.e-government.gv.at/namespace/mandates/20040701#"; /** Prefix used for the Mandate XML namespace */ - public static final String MVV_PREFIX = "mvv"; + String MVV_PREFIX = "mvv"; /** URI of the Mandate XML namespace. */ - public static final String MVV_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; + String MVV_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; /** Prefix used for the MandateCheckProfile XML namespace */ - public static final String MDP_PREFIX = "mdp"; + String MDP_PREFIX = "mdp"; /** URI of the Mandate XML namespace. */ - public static final String MDP_NS_URI = - "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; + String MDP_NS_URI = + "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; /** Prefix used for the MOA XML namespace */ - public static final String MOA_PREFIX = "moa"; + String MOA_PREFIX = "moa"; /** Local location of the MOA XML schema definition. */ - public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-3.0.0.xsd"; + String MOA_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-3.1.2.xsd"; /** URI of the MOA configuration XML namespace. */ - public static final String MOA_CONFIG_NS_URI = - "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; + String MOA_CONFIG_NS_URI = + "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; /** URI of the MOA ID configuration XML namespace. */ - public static final String MOA_ID_CONFIG_NS_URI = - "http://www.buergerkarte.at/namespaces/moaconfig#"; + String MOA_ID_CONFIG_NS_URI = + "http://www.buergerkarte.at/namespaces/moaconfig#"; /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_CONFIG_PREFIX = "conf"; + String MOA_CONFIG_PREFIX = "conf"; /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_ID_CONFIG_PREFIX = "confID"; + String MOA_ID_CONFIG_PREFIX = "confID"; /** Local location of the MOA configuration XML schema definition. */ - public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-3.0.0.xsd"; + String MOA_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-config-3.0.0.xsd"; /** 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.5.2.xsd"; + String MOA_ID_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-ID-Configuration-1.5.2.xsd"; /** URI of the Security Layer 1.0 namespace. */ - public static final String SL10_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; + String SL10_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; /** Prefix used for the Security Layer 1.0 XML namespace */ - public static final String SL10_PREFIX = "sl10"; + String SL10_PREFIX = "sl10"; /** Local location of the Security Layer 1.0 XML schema definition */ - public static final String SL10_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020225.xsd"; + String SL10_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020225.xsd"; /** URI of the Security Layer 1.1 XML namespace */ - public static final String SL11_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; + String SL11_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; /** Prefix used for the Security Layer 1.1 XML namespace */ - public static final String SL11_PREFIX = "sl11"; + String SL11_PREFIX = "sl11"; /** Local location of the Security Layer 1.1 XML schema definition */ - public static final String SL11_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020831.xsd"; - + 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#"; + 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"; + 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"; - + 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#"; - + String ECDSA_NS_URI = + "http://www.w3.org/2001/04/xmldsig-more#"; + /** Prefix used for ECDSA namespace */ - public static final String ECDSA_PREFIX = "ecdsa"; + String ECDSA_PREFIX = "ecdsa"; /** Local location of ECDSA XML schema definition */ - public static final String ECDSA_SCHEMA_LOCATION = - SCHEMA_ROOT + "ECDSAKeyValue.xsd"; + String ECDSA_SCHEMA_LOCATION = + SCHEMA_ROOT + "ECDSAKeyValue.xsd"; /** URI of the PersonData XML namespace. */ - public static final String PD_NS_URI = - "http://reference.e-government.gv.at/namespace/persondata/20020228#"; + String PD_NS_URI = + "http://reference.e-government.gv.at/namespace/persondata/20020228#"; /** Prefix used for the PersonData XML namespace */ - public static final String PD_PREFIX = "pr"; + 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_20_en_moaWID.xsd"; + String PD_SCHEMA_LOCATION = + SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; /** URI of the SAML namespace. */ - public static final String SAML_NS_URI = - "urn:oasis:names:tc:SAML:1.0:assertion"; + String SAML_NS_URI = + "urn:oasis:names:tc:SAML:1.0:assertion"; /** Prefix used for the SAML XML namespace */ - public static final String SAML_PREFIX = "saml"; + String SAML_PREFIX = "saml"; /** Local location of the SAML XML schema definition. */ - public static final String SAML_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; + String SAML_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; /** URI of the SAML request-response protocol namespace. */ - public static final String SAMLP_NS_URI = - "urn:oasis:names:tc:SAML:1.0:protocol"; + String SAMLP_NS_URI = + "urn:oasis:names:tc:SAML:1.0:protocol"; /** Prefix used for the SAML request-response protocol namespace */ - public static final String SAMLP_PREFIX = "samlp"; + String SAMLP_PREFIX = "samlp"; /** Local location of the SAML request-response protocol schema definition. */ - public static final String SAMLP_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; + String SAMLP_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; /** URI of the XML namespace. */ - public static final String XML_NS_URI = - "http://www.w3.org/XML/1998/namespace"; + String XML_NS_URI = + "http://www.w3.org/XML/1998/namespace"; /** Prefix used for the XML namespace */ - public static final String XML_PREFIX = "xml"; + String XML_PREFIX = "xml"; /** Local location of the XML schema definition. */ - public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; + String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; /** URI of the XMLNS namespace */ - public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; + String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; /** Prefix used for the XSI namespace */ - public static final String XSI_PREFIX = "xsi"; + String XSI_PREFIX = "xsi"; /** Local location of the XSI schema definition. */ - public static final String XSI_SCHEMA_LOCATION = - SCHEMA_ROOT + "XMLSchema-instance.xsd"; + String XSI_SCHEMA_LOCATION = + SCHEMA_ROOT + "XMLSchema-instance.xsd"; /** URI of the XSI XMLNS namespace */ - public static final String XSI_NS_URI = - "http://www.w3.org/2001/XMLSchema-instance"; + String XSI_NS_URI = + "http://www.w3.org/2001/XMLSchema-instance"; /** URI of the XSLT XML namespace */ - public static final String XSLT_NS_URI = - "http://www.w3.org/1999/XSL/Transform"; + String XSLT_NS_URI = + "http://www.w3.org/1999/XSL/Transform"; /** Prefix used for the XSLT XML namespace */ - public static final String XSLT_PREFIX = "xsl"; + String XSLT_PREFIX = "xsl"; /** URI of the XMLDSig XML namespace. */ - public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; + String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; /** Prefix used for the XMLDSig XML namespace */ - public static final String DSIG_PREFIX = "dsig"; + String DSIG_PREFIX = "dsig"; /** Local location of the XMLDSig XML schema. */ - public static final String DSIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-core-schema.xsd"; + String DSIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-core-schema.xsd"; /** URI of the XMLDSig XPath Filter XML namespace. */ - public static final String DSIG_FILTER2_NS_URI = - "http://www.w3.org/2002/06/xmldsig-filter2"; + String DSIG_FILTER2_NS_URI = + "http://www.w3.org/2002/06/xmldsig-filter2"; /** Prefix used for the XMLDSig XPath Filter XML namespace */ - public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; + String DSIG_FILTER2_PREFIX = "dsig-filter2"; /** Local location of the XMLDSig XPath Filter XML schema definition. */ - public static final String DSIG_FILTER2_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-filter2.xsd"; + String DSIG_FILTER2_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-filter2.xsd"; /** URI of the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_NS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - + String DSIG_EC_NS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + /** Prefix used for the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_PREFIX = "ec"; + String DSIG_EC_PREFIX = "ec"; /** Local location of the Exclusive Canonicalizaion XML schema definition */ - public static final String DSIG_EC_SCHEMA_LOCATION = - SCHEMA_ROOT + "exclusive-canonicalization.xsd"; + String DSIG_EC_SCHEMA_LOCATION = + SCHEMA_ROOT + "exclusive-canonicalization.xsd"; - /** URI of the XMLLoginParameterResolver Configuration XML namespace */ - public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; + /** URI of the XMLLoginParameterResolver Configuration XML namespace */ + String XMLLPR_NS_URI = "http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; - /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ - public static final String XMLLPR_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOAIdentities.xsd"; - - /** Local location of the XAdES v1.1.1 schema definition */ - public static final String XADES_1_1_1_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.1.1.xsd"; + /** + * Local location of the XMLLoginParameterResolver Configuration XML schema + * definition + */ + String XMLLPR_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOAIdentities.xsd"; + + /** Local location of the XAdES v1.1.1 schema definition */ + String XADES_1_1_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.1.1.xsd"; /** URI of the XAdES v1.1.1 namespace */ - public static final String XADES_1_1_1_NS_URI = "http://uri.etsi.org/01903/v1.1.1#"; - - public static final String XADES_1_1_1_NS_PREFIX = "xades111"; - - /** Local location of the XAdES v1.2.2 schema definition */ - public static final String XADES_1_2_2_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.2.2.xsd"; + String XADES_1_1_1_NS_URI = "http://uri.etsi.org/01903/v1.1.1#"; + + String XADES_1_1_1_NS_PREFIX = "xades111"; + + /** Local location of the XAdES v1.2.2 schema definition */ + String XADES_1_2_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.2.2.xsd"; /** URI of the XAdES v1.2.2 namespace */ - public static final String XADES_1_2_2_NS_URI = "http://uri.etsi.org/01903/v1.2.2#"; - - public static final String XADES_1_2_2_NS_PREFIX = "xades122"; + String XADES_1_2_2_NS_URI = "http://uri.etsi.org/01903/v1.2.2#"; + + String XADES_1_2_2_NS_PREFIX = "xades122"; - /** Local location of the XAdES v1.1.1 schema definition */ - public static final String XADES_1_3_2_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.3.2.xsd"; + /** Local location of the XAdES v1.1.1 schema definition */ + String XADES_1_3_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES01903v132-201601.xsd"; /** URI of the XAdES v1.3.2 namespace */ - public static final String XADES_1_3_2_NS_URI = "http://uri.etsi.org/01903/v1.3.2#"; - - public static final String XADES_1_3_2_NS_PREFIX = "xades132"; + String XADES_1_3_2_NS_URI = "http://uri.etsi.org/01903/v1.3.2#"; + + String XADES_1_3_2_NS_PREFIX = "xades132"; - /** Local location of the XAdES v1.4.1 schema definition */ - public static final String XADES_1_4_1_SCHEMA_LOCATION = - SCHEMA_ROOT + "XAdES-1.4.1.xsd"; + /** Local location of the XAdES v1.4.1 schema definition */ + String XADES_1_4_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES01903v141-201601.xsd"; /** URI of the XAdES v1.4.1 namespace */ - public static final String XADES_1_4_1_NS_URI = "http://uri.etsi.org/01903/v1.4.1#"; - - public static final String XADES_1_4_1_NS_PREFIX = "xades141"; + String XADES_1_4_1_NS_URI = "http://uri.etsi.org/01903/v1.4.1#"; + + String XADES_1_4_1_NS_PREFIX = "xades141"; /** URI of the SAML 2.0 namespace. */ - public static final String SAML2_NS_URI = - "urn:oasis:names:tc:SAML:2.0:assertion"; + String SAML2_NS_URI = + "urn:oasis:names:tc:SAML:2.0:assertion"; /** Prefix used for the SAML 2.0 XML namespace */ - public static final String SAML2_PREFIX = "saml2"; + String SAML2_PREFIX = "saml2"; /** Local location of the SAML 2.0 XML schema definition. */ - public static final String SAML2_SCHEMA_LOCATION = - SCHEMA_ROOT + "saml-schema-assertion-2.0.xsd"; - + String SAML2_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-assertion-2.0.xsd"; + /** URI of the SAML 2.0 protocol namespace. */ - public static final String SAML2P_NS_URI = - "urn:oasis:names:tc:SAML:2.0:protocol"; + String SAML2P_NS_URI = + "urn:oasis:names:tc:SAML:2.0:protocol"; /** Prefix used for the SAML 2.0 protocol XML namespace */ - public static final String SAML2P_PREFIX = "saml2p"; + String SAML2P_PREFIX = "saml2p"; /** Local location of the SAML 2.0 protocol XML schema definition. */ - public static final String SAML2P_SCHEMA_LOCATION = - SCHEMA_ROOT + "saml-schema-protocol-2.0.xsd"; - + String SAML2P_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-protocol-2.0.xsd"; + /** URI of the STORK namespace. */ - public static final String STORK_NS_URI = - "urn:eu:stork:names:tc:STORK:1.0:assertion"; + String STORK_NS_URI = + "urn:eu:stork:names:tc:STORK:1.0:assertion"; /** Prefix used for the STORK XML namespace */ - public static final String STORK_PREFIX = "stork"; + String STORK_PREFIX = "stork"; /** Local location of the STORK XML schema definition. */ - public static final String STORK_SCHEMA_LOCATION = - SCHEMA_ROOT + "stork-schema-assertion-1.0.xsd"; - + String STORK_SCHEMA_LOCATION = + SCHEMA_ROOT + "stork-schema-assertion-1.0.xsd"; + /** URI of the STORK protocol namespace. */ - public static final String STORKP_NS_URI = - "urn:eu:stork:names:tc:STORK:1.0:protocol"; + String STORKP_NS_URI = + "urn:eu:stork:names:tc:STORK:1.0:protocol"; /** Prefix used for the STORK protocol XML namespace */ - public static final String STORKP_PREFIX = "storkp"; + String STORKP_PREFIX = "storkp"; /** Local location of the STORK protocol XML schema definition. */ - public static final String STORKP_SCHEMA_LOCATION = - SCHEMA_ROOT + "stork-schema-protocol-1.0.xsd"; - + String STORKP_SCHEMA_LOCATION = + SCHEMA_ROOT + "stork-schema-protocol-1.0.xsd"; + /** URI of the TSL namespace. */ - public static final String TSL_NS_URI = - "http://uri.etsi.org/02231/v2#"; + String TSL_NS_URI = + "http://uri.etsi.org/02231/v2#"; /** Prefix used for the TSL namespace */ - public static final String TSL_PREFIX = "tsl1"; + String TSL_PREFIX = "tsl1"; /** Local location of the TSL schema definition. */ - public static final String TSL_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_119612v010201_xsd.xsd"; + String TSL_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_119612v010201_xsd.xsd"; /** URI of the TSL SIE namespace. */ - public static final String TSL_SIE_NS_URI = - "http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"; + String TSL_SIE_NS_URI = + "http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"; /** Prefix used for the TSL SIE namespace */ - public static final String TSL_SIE_PREFIX = "tslsie"; + String TSL_SIE_PREFIX = "tslsie"; /** Local location of the TSL SIE schema definition. */ - public static final String TSL_SIE_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_119612v010201_sie_xsd.xsd"; - + String TSL_SIE_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_119612v010201_sie_xsd.xsd"; + /** URI of the TSL additional types namespace. */ - public static final String TSL_ADDTYPES_NS_URI = - "http://uri.etsi.org/02231/v2/additionaltypes#"; + String TSL_ADDTYPES_NS_URI = + "http://uri.etsi.org/02231/v2/additionaltypes#"; /** Prefix used for the TSL additional types namespace */ - public static final String TSL_ADDTYPES_PREFIX = "tsltype"; + String TSL_ADDTYPES_PREFIX = "tsltype"; /** Local location of the TSL additional types schema definition. */ - public static final String TSL_ADDTYPES_SCHEMA_LOCATION = - SCHEMA_ROOT + "ts_ts_119612v010201_additionaltypes_xsd.xsd"; - + String TSL_ADDTYPES_SCHEMA_LOCATION = + SCHEMA_ROOT + "ts_ts_119612v010201_additionaltypes_xsd.xsd"; + /** URI of the XML Encryption namespace. */ - public static final String XENC_NS_URI = - "http://www.w3.org/2001/04/xmlenc#"; + String XENC_NS_URI = + "http://www.w3.org/2001/04/xmlenc#"; /** Prefix used for the XML Encryption XML namespace */ - public static final String XENC_PREFIX = "xenc"; + String XENC_PREFIX = "xenc"; /** Local location of the XML Encryption XML schema definition. */ - public static final String XENC_SCHEMA_LOCATION = - SCHEMA_ROOT + "xenc-schema.xsd"; + String XENC_SCHEMA_LOCATION = + SCHEMA_ROOT + "xenc-schema.xsd"; /* Prefix used for the XML Encryption XML namespace */ - public static final String SAML2_METADATA_PREFIX = "md"; - + String SAML2_METADATA_PREFIX = "md"; + /* Prefix used for the XML Encryption XML namespace */ - public static final String SAML2_METADATA_URI = "urn:oasis:names:tc:SAML:2.0:metadata"; + String SAML2_METADATA_URI = "urn:oasis:names:tc:SAML:2.0:metadata"; /* Local location of the XML Encryption XML schema definition. */ - public static final String SAML2_METADATA_SCHEMA_LOCATION = - SCHEMA_ROOT + "saml-schema-metadata-2.0.xsd"; + String SAML2_METADATA_SCHEMA_LOCATION = + SCHEMA_ROOT + "saml-schema-metadata-2.0.xsd"; /** Prefix used for the XML Encryption XML namespace */ - public static final String ASIC_PREFIX = "asic"; + String ASIC_PREFIX = "asic"; /* Prefix used for the XML Encryption XML namespace */ - public static final String ASIC_URI = "http://uri.etsi.org/02918/v1.2.1#"; + String ASIC_URI = "http://uri.etsi.org/02918/v1.2.1#"; /** Local location of the XML Encryption XML schema definition. */ - public static final String ASIC_SCHEMA_LOCATION = - SCHEMA_ROOT + "asic.xsd"; + String ASIC_SCHEMA_LOCATION = + SCHEMA_ROOT + "asic.xsd"; + + /* Prefix and Schema definition for eIDAS specific SAML2 extensions */ + String SAML2_eIDAS_EXTENSIONS_PREFIX = "eidas"; + String SAML2_eIDAS_EXTENSIONS = "http://eidas.europa.eu/saml-extensions"; + String SAML2_eIDAS_EXTENSIONS_SCHEMA_LOCATION = SCHEMA_ROOT + "eIDAS_saml_extensions.xsd"; + + String eDELIVERY20_PREFIX = "zu"; + String eDELIVERY20 = "http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#"; + String eDELIVERY20_SCHEMA_LOCATION = SCHEMA_ROOT + "zuse_p2.xsd"; + + String eDELIVERY_PERSON_20_PREFIX = "zup"; + String eDELIVERY_PERSON_20 = "http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#"; + String eDELIVERY_PERSON_20_SCHEMA_LOCATION = SCHEMA_ROOT + "zuse_mypersondata_en_p2.xsd"; + + String ONLY_MOASIG_SCHEMA_LOCATIONS = + MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " " + + MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " " + + 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 + " " + // + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + + SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " " + + SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " " + + XML_NS_URI + " " + XML_SCHEMA_LOCATION + " " + + XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " " + + DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " " + + DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " " + + DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " " + + XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " " + + XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " " + + XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " " + + XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " " + + XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION + " " + + TSL_NS_URI + " " + TSL_SCHEMA_LOCATION + " " + + TSL_SIE_NS_URI + " " + TSL_SIE_SCHEMA_LOCATION + " " + + TSL_ADDTYPES_NS_URI + " " + TSL_ADDTYPES_SCHEMA_LOCATION + " " + + SAML2_NS_URI + " " + SAML2_SCHEMA_LOCATION + " " + + SAML2P_NS_URI + " " + SAML2P_SCHEMA_LOCATION + " " + + STORK_NS_URI + " " + STORK_SCHEMA_LOCATION + " " + + STORKP_NS_URI + " " + STORKP_SCHEMA_LOCATION + " " + + XENC_NS_URI + " " + XENC_SCHEMA_LOCATION + " " + + SAML2_METADATA_URI + " " + SAML2_METADATA_SCHEMA_LOCATION + " " + + ASIC_URI + " " + ASIC_SCHEMA_LOCATION + " " + + SAML2_eIDAS_EXTENSIONS + " " + SAML2_eIDAS_EXTENSIONS_SCHEMA_LOCATION; /** - * Contains all namespaces and local schema locations for XML schema - * definitions relevant for MOA. For use in validating XML parsers. + * Contains all namespaces and local schema locations for XML schema definitions + * relevant for MOA. For use in validating XML parsers. */ - public static final String ALL_SCHEMA_LOCATIONS = - (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") - + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") - + (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 + " ") - + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") - + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") - + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") - + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") - + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") - + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") - + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") - + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") - + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " ") - + (XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " ") - + (XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " ") - + (XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " ") - + (XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION + " ") - + (TSL_NS_URI + " " + TSL_SCHEMA_LOCATION + " ") - + (TSL_SIE_NS_URI + " " + TSL_SIE_SCHEMA_LOCATION + " ") - + (TSL_ADDTYPES_NS_URI + " " + TSL_ADDTYPES_SCHEMA_LOCATION + " ") - + (SAML2_NS_URI + " " + SAML2_SCHEMA_LOCATION + " ") - + (SAML2P_NS_URI + " " + SAML2P_SCHEMA_LOCATION + " ") - + (STORK_NS_URI + " " + STORK_SCHEMA_LOCATION + " ") - + (STORKP_NS_URI + " " + STORKP_SCHEMA_LOCATION + " ") - + (XENC_NS_URI + " " + XENC_SCHEMA_LOCATION + " ") - + (SAML2_METADATA_URI + " " + SAML2_METADATA_SCHEMA_LOCATION + " ") - + (ASIC_URI + " " + ASIC_SCHEMA_LOCATION); + String ALL_SCHEMA_LOCATIONS = + MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " " + + MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " " + + 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 + " " + + PD_NS_URI + " " + PD_SCHEMA_LOCATION + " " + + SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " " + + SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " " + + XML_NS_URI + " " + XML_SCHEMA_LOCATION + " " + + XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " " + + DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " " + + DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " " + + DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " " + + XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " " + + XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " " + + XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " " + + XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " " + + XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION + " " + + TSL_NS_URI + " " + TSL_SCHEMA_LOCATION + " " + + TSL_SIE_NS_URI + " " + TSL_SIE_SCHEMA_LOCATION + " " + + TSL_ADDTYPES_NS_URI + " " + TSL_ADDTYPES_SCHEMA_LOCATION + " " + + SAML2_NS_URI + " " + SAML2_SCHEMA_LOCATION + " " + + SAML2P_NS_URI + " " + SAML2P_SCHEMA_LOCATION + " " + + STORK_NS_URI + " " + STORK_SCHEMA_LOCATION + " " + + STORKP_NS_URI + " " + STORKP_SCHEMA_LOCATION + " " + + XENC_NS_URI + " " + XENC_SCHEMA_LOCATION + " " + + SAML2_METADATA_URI + " " + SAML2_METADATA_SCHEMA_LOCATION + " " + + ASIC_URI + " " + ASIC_SCHEMA_LOCATION + " " + + SAML2_eIDAS_EXTENSIONS + " " + SAML2_eIDAS_EXTENSIONS_SCHEMA_LOCATION + " " + + eDELIVERY20 + " " + eDELIVERY20_SCHEMA_LOCATION + " " + + eDELIVERY_PERSON_20 + " " + eDELIVERY_PERSON_20_SCHEMA_LOCATION; /** URN prefix for bPK and wbPK. */ - public static final String URN_PREFIX = "urn:publicid:gv.at"; - + String URN_PREFIX = "urn:publicid:gv.at"; + /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; - + 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"; + String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; /** URN prefix for context dependent id (HPI). */ - public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; - + String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; + /** URN prefix for context dependent id (wbPK). */ - public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; + String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; /** URN prefix for context dependent id (stork). */ - public static final String URN_PREFIX_STORK = URN_PREFIX + ":storkid"; + String URN_PREFIX_STORK = URN_PREFIX + ":storkid"; /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; - + 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"; + String SL_MANIFEST_TYPE_URI = + "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; /** URI of the SHA1 digest algorithm */ - public static final String SHA1_URI = - "http://www.w3.org/2000/09/xmldsig#sha1"; - + String SHA1_URI = + "http://www.w3.org/2000/09/xmldsig#sha1"; + /** URI of the SHA1 digest algorithm */ - public static final String SHA256_URI = - "http://www.w3.org/2000/09/xmldsig#sha256"; - + String SHA256_URI = + "http://www.w3.org/2000/09/xmldsig#sha256"; + /** URI of the SHA1 digest algorithm */ - public static final String SHA384_URI = - "http://www.w3.org/2000/09/xmldsig#sha384"; - + String SHA384_URI = + "http://www.w3.org/2000/09/xmldsig#sha384"; + /** URI of the SHA1 digest algorithm */ - public static final String SHA512_URI = - "http://www.w3.org/2000/09/xmldsig#sha512"; - + String SHA512_URI = + "http://www.w3.org/2000/09/xmldsig#sha512"; + /** URI of the Canonical XML algorithm */ - public static final String C14N_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + String C14N_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; /** URI of the Canoncial XML with comments algorithm */ - public static final String C14N_WITH_COMMENTS_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + String C14N_WITH_COMMENTS_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; /** URI of the Exclusive Canonical XML algorithm */ - public static final String EXC_C14N_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - + String EXC_C14N_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + /** URI of the Exclusive Canonical XML with commments algorithm */ - public static final String EXC_C14N_WITH_COMMENTS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; - + String EXC_C14N_WITH_COMMENTS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + // // Local names for elements of the MOA SPSS schema // - - /** + + /** * Local name of request for creating an XML signature. */ - public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; - - /** + String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; + + /** * Local name of request for creating a CMS signature. */ - public static final String MOA_SPSS_CREATE_CMS_REQUEST = "CreateCMSSignatureRequest"; - - /** + String MOA_SPSS_CREATE_CMS_REQUEST = "CreateCMSSignatureRequest"; + + /** * Local name of request for creating a CMS signature. */ - public static final String MOA_SPSS_CREATE_PDF_REQUEST = "CreatePDFSignatureRequest"; - - /** + String MOA_SPSS_CREATE_PDF_REQUEST = "CreatePDFSignatureRequest"; + + /** * Local name of request for verifying an XML signature. */ - public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; - - /** - * A map used to map namespace prefixes to namespace URIs - */ - public static HashMap<String, String> nSMap = new HashMap<String, String>(5); - + String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; + + /** + * A map used to map namespace prefixes to namespace URIs + */ + HashMap<String, String> nSMap = new HashMap<>(5); + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java index c5550ad..2f96196 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DOMUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.ByteArrayInputStream; @@ -51,6 +50,7 @@ import javax.xml.transform.stream.StreamResult; import org.apache.xerces.parsers.DOMParser; import org.apache.xerces.parsers.SAXParser; import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SecurityManager; import org.apache.xerces.util.SymbolTable; import org.apache.xerces.util.XMLGrammarPoolImpl; import org.apache.xerces.xni.grammars.XMLGrammarDescription; @@ -72,12 +72,12 @@ import at.gv.egovernment.moaspss.logging.Logger; /** * Various utility functions for handling XML DOM trees. - * + * * The parsing methods in this class make use of some features internal to the - * Xerces DOM parser, mainly for performance reasons. As soon as JAXP - * (currently at version 1.2) is better at schema handling, it should be used as - * the parser interface. - * + * Xerces DOM parser, mainly for performance reasons. As soon as JAXP (currently + * at version 1.2) is better at schema handling, it should be used as the parser + * interface. + * * @author Patrick Peck * @version $Id$ */ @@ -85,54 +85,61 @@ public class DOMUtils { /** Feature URI for namespace aware parsing. */ private static final String NAMESPACES_FEATURE = - "http://xml.org/sax/features/namespaces"; + "http://xml.org/sax/features/namespaces"; /** Feature URI for validating parsing. */ private static final String VALIDATION_FEATURE = - "http://xml.org/sax/features/validation"; + "http://xml.org/sax/features/validation"; /** Feature URI for schema validating parsing. */ private static final String SCHEMA_VALIDATION_FEATURE = - "http://apache.org/xml/features/validation/schema"; + "http://apache.org/xml/features/validation/schema"; /** Feature URI for normalization of element/attribute values. */ private static final String NORMALIZED_VALUE_FEATURE = - "http://apache.org/xml/features/validation/schema/normalized-value"; + "http://apache.org/xml/features/validation/schema/normalized-value"; /** Feature URI for parsing ignorable whitespace. */ private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = - "http://apache.org/xml/features/dom/include-ignorable-whitespace"; + "http://apache.org/xml/features/dom/include-ignorable-whitespace"; /** Feature URI for creating EntityReference nodes in the DOM tree. */ private static final String CREATE_ENTITY_REF_NODES_FEATURE = - "http://apache.org/xml/features/dom/create-entity-ref-nodes"; + "http://apache.org/xml/features/dom/create-entity-ref-nodes"; /** Property URI for providing external schema locations. */ private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-schemaLocation"; - /** Property URI for providing the external schema location for elements - * without a namespace. */ + "http://apache.org/xml/properties/schema/external-schemaLocation"; + /** + * Property URI for providing the external schema location for elements without + * a namespace. + */ private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; - + "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; + private static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = - "http://xml.org/sax/features/external-general-entities"; - + "http://xml.org/sax/features/external-general-entities"; + private static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = - "http://xml.org/sax/features/external-parameter-entities"; - + "http://xml.org/sax/features/external-parameter-entities"; + private static final String DISALLOW_DOCTYPE_FEATURE = - "http://apache.org/xml/features/disallow-doctype-decl"; - - - + "http://apache.org/xml/features/disallow-doctype-decl"; + + // Security Manager feature for XERCES XML parser + private static final String SECURITY_MANAGER = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.SECURITY_MANAGER_PROPERTY; + /** Property URI for the Xerces grammar pool. */ private static final String GRAMMAR_POOL = - org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; /** A prime number for initializing the symbol table. */ private static final int BIG_PRIME = 2039; /** Symbol table for the grammar pool. */ private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); /** Xerces schema grammar pool. */ private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple - * entries of same grammars to the pool */ - private static Set grammarNamespaces; + /** + * Set holding the NamespaceURIs of the grammarPool, to prevent multiple entries + * of same grammars to the pool + */ + private static Set grammarNamespaces; static { grammarPool.lockPool(); @@ -140,38 +147,38 @@ public class DOMUtils { } /** - * Preparse a schema and add it to the schema pool. - * The method only adds the schema to the pool if a schema having the same - * <code>systemId</code> (namespace URI) is not already present in the pool. - * - * @param inputStream An <code>InputStream</code> providing the contents of - * the schema. - * @param systemId The systemId (namespace URI) to use for the schema. + * Preparse a schema and add it to the schema pool. The method only adds the + * schema to the pool if a schema having the same <code>systemId</code> + * (namespace URI) is not already present in the pool. + * + * @param inputStream An <code>InputStream</code> providing the contents of the + * schema. + * @param systemId The systemId (namespace URI) to use for the schema. * @throws IOException An error occurred reading the schema. */ public static void addSchemaToPool(InputStream inputStream, String systemId) - throws IOException { + throws IOException { XMLGrammarPreparser preparser; - if (!grammarNamespaces.contains(systemId)) { + if (!grammarNamespaces.contains(systemId)) { grammarNamespaces.add(systemId); - + // unlock the pool so that we can add another grammar grammarPool.unlockPool(); - + // prepare the preparser preparser = new XMLGrammarPreparser(symbolTable); preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); preparser.setProperty(GRAMMAR_POOL, grammarPool); preparser.setFeature(NAMESPACES_FEATURE, true); preparser.setFeature(VALIDATION_FEATURE, true); - + // add the grammar to the pool preparser.preparseGrammar( - XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, inputStream, null)); - + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, inputStream, null)); + // lock the pool again so that schemas are not added automatically grammarPool.lockPool(); } @@ -179,34 +186,43 @@ public class DOMUtils { /** * Parse an XML document from an <code>InputStream</code>. - * - * @param inputStream The <code>InputStream</code> containing the XML - * document. - * @param validating If <code>true</code>, parse validating. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. - * @param entityResolver An <code>EntityResolver</code> to resolve external - * entities (schemas and DTDs). If <code>null</code>, it will not be set. - * @param errorHandler An <code>ErrorHandler</code> to decide what to do - * with parsing errors. If <code>null</code>, it will not be set. + * + * @param inputStream The <code>InputStream</code> + * containing the XML document. + * @param validating If <code>true</code>, parse + * validating. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. + * @param entityResolver An <code>EntityResolver</code> to + * resolve external entities (schemas + * and DTDs). If <code>null</code>, it + * will not be set. + * @param errorHandler An <code>ErrorHandler</code> to + * decide what to do with parsing + * errors. If <code>null</code>, it + * will not be set. * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation, - EntityResolver entityResolver, - ErrorHandler errorHandler) - throws SAXException, IOException, ParserConfigurationException { + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver, + ErrorHandler errorHandler) + throws SAXException, IOException, ParserConfigurationException { DOMParser parser; @@ -218,72 +234,77 @@ public class DOMUtils { // } // } + // if Debug is enabled make a copy of inputStream to enable debug output in case + // of SAXException + byte buffer[] = null; + ByteArrayInputStream baStream = null; + if (true == Logger.isDebugEnabled()) { + final int len = inputStream.available(); + buffer = new byte[len]; + inputStream.read(buffer); + baStream = new ByteArrayInputStream(buffer); + } - //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException - byte buffer [] = null; - ByteArrayInputStream baStream = null; - if(true == Logger.isDebugEnabled()) { - int len = inputStream.available(); - buffer = new byte[len]; - inputStream.read(buffer); - baStream = new ByteArrayInputStream(buffer); - } - // create the DOM parser if (symbolTable != null) { parser = new DOMParser(symbolTable, grammarPool); } else { parser = new DOMParser(); } - + // set parser features and properties try { - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, validating); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); - parser.setFeature(NORMALIZED_VALUE_FEATURE, false); - parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); - parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false); - - //fix XXE problem - //parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - - if (validating) { - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - externalNoNamespaceSchemaLocation); - } - } - - // set entity resolver and error handler - if (entityResolver != null) { - parser.setEntityResolver(entityResolver); - } - if (errorHandler != null) { - parser.setErrorHandler(errorHandler); - } - - // parse the document and return it - // if debug is enabled: use copy of strem (baStream) else use orig stream - - if(null != baStream) - parser.parse(new InputSource(baStream)); - else - parser.parse(new InputSource(inputStream)); - } catch(SAXException e) { - if(true == Logger.isDebugEnabled() && null != buffer) { - String xmlContent = new String(buffer); - Logger.debug("SAXException in:\n" + xmlContent); - } - throw(e); + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, validating); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); + parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false); + + final SecurityManager xmlParserSecManager = new org.apache.xerces.util.SecurityManager(); + parser.setProperty(SECURITY_MANAGER, xmlParserSecManager); + + // fix XXE problem + // parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", + // true); + + if (validating) { + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + externalNoNamespaceSchemaLocation); + } + } + + // set entity resolver and error handler + if (entityResolver != null) { + parser.setEntityResolver(entityResolver); + } + if (errorHandler != null) { + parser.setErrorHandler(errorHandler); + } + + // parse the document and return it + // if debug is enabled: use copy of strem (baStream) else use orig stream + + if (null != baStream) { + parser.parse(new InputSource(baStream)); + } else { + parser.parse(new InputSource(inputStream)); + } + } catch (final SAXException e) { + if (true == Logger.isDebugEnabled() && null != buffer) { + final String xmlContent = new String(buffer); + Logger.debug("SAXException in:\n" + xmlContent); + } + throw e; } return parser.getDocument(); @@ -291,31 +312,40 @@ public class DOMUtils { /** * Parse an XML document from an <code>InputStream</code>. - * - * @param inputStream The <code>InputStream</code> containing the XML - * document. - * @param validating If <code>true</code>, parse validating. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. - * @param entityResolver An <code>EntityResolver</code> to resolve external - * entities (schemas and DTDs). If <code>null</code>, it will not be set. - * @param errorHandler An <code>ErrorHandler</code> to decide what to do - * with parsing errors. If <code>null</code>, it will not be set. + * + * @param inputStream The <code>InputStream</code> + * containing the XML document. + * @param validating If <code>true</code>, parse + * validating. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. + * @param entityResolver An <code>EntityResolver</code> to + * resolve external entities (schemas + * and DTDs). If <code>null</code>, it + * will not be set. + * @param errorHandler An <code>ErrorHandler</code> to + * decide what to do with parsing + * errors. If <code>null</code>, it + * will not be set. * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Document parseDocumentSimple(InputStream inputStream) - throws SAXException, IOException, ParserConfigurationException { + throws SAXException, IOException, ParserConfigurationException { DOMParser parser; - + parser = new DOMParser(); // set parser features and properties parser.setFeature(NAMESPACES_FEATURE, true); @@ -324,181 +354,200 @@ public class DOMUtils { parser.setFeature(NORMALIZED_VALUE_FEATURE, false); parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - + + final SecurityManager xmlParserSecManager = new org.apache.xerces.util.SecurityManager(); + parser.setProperty(SECURITY_MANAGER, xmlParserSecManager); + parser.parse(new InputSource(inputStream)); - + return parser.getDocument(); } - /** * Parse an XML document from an <code>InputStream</code>. - * + * * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. - * - * @param inputStream The <code>InputStream</code> containing the XML - * document. - * @param validating If <code>true</code>, parse validating. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. + * + * @param inputStream The <code>InputStream</code> + * containing the XML document. + * @param validating If <code>true</code>, parse + * validating. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - - + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + return parseDocument( - inputStream, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation, - new MOAEntityResolver(), - new MOAErrorHandler()); + inputStream, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation, + new MOAEntityResolver(), + new MOAErrorHandler()); } /** * Parse an XML document from a <code>String</code>. - * + * * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. - * - * @param xmlString The <code>String</code> containing the XML document. - * @param encoding The encoding of the XML document. - * @param validating If <code>true</code>, parse validating. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. + * + * @param xmlString The <code>String</code> containing + * the XML document. + * @param encoding The encoding of the XML document. + * @param validating If <code>true</code>, parse + * validating. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Document parseDocument( - String xmlString, - String encoding, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); + String xmlString, + String encoding, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + final InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); return parseDocument( - in, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); + in, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); } /** * Parse an UTF-8 encoded XML document from a <code>String</code>. - * - * @param xmlString The <code>String</code> containing the XML document. - * @param validating If <code>true</code>, parse validating. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. + * + * @param xmlString The <code>String</code> containing + * the XML document. + * @param validating If <code>true</code>, parse + * validating. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Document parseDocument( - String xmlString, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { + String xmlString, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { return parseDocument( - xmlString, - "UTF-8", - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); + xmlString, + "UTF-8", + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); } /** * A convenience method to parse an XML document validating. - * - * @param inputStream The <code>InputStream</code> containing the XML - * document. + * + * @param inputStream The <code>InputStream</code> containing the XML document. * @return The root element of the parsed XML document. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Element parseXmlValidating(InputStream inputStream) - throws ParserConfigurationException, SAXException, IOException { + throws ParserConfigurationException, SAXException, IOException { return DOMUtils - .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) - .getDocumentElement(); + .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); } - + /** * A convenience method to parse an XML document non validating. - * - * @param inputStream The <code>InputStream</code> containing the XML - * document. + * + * @param inputStream The <code>InputStream</code> containing the XML document. * @return The root element of the parsed XML document. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. * @throws ParserConfigurationException An error occurred configuring the XML - * parser. + * parser. */ public static Element parseXmlNonValidating(InputStream inputStream) - throws ParserConfigurationException, SAXException, IOException { + throws ParserConfigurationException, SAXException, IOException { return DOMUtils - .parseDocument(inputStream, false, Constants.ALL_SCHEMA_LOCATIONS, null) - .getDocumentElement(); + .parseDocument(inputStream, false, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); } /** * Schema validate a given DOM element. - * - * @param element The element to validate. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. - * @return <code>true</code>, if the <code>element</code> validates against - * the schemas declared in it. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document from its - * serialized representation. + * + * @param element The element to validate. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. + * @return <code>true</code>, if the <code>element</code> validates against the + * schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document + * from its serialized representation. * @throws ParserConfigurationException An error occurred configuring the XML - * @throws TransformerException An error occurred serializing the element. + * @throws TransformerException An error occurred serializing the + * element. */ public static boolean validateElement( - Element element, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws - ParserConfigurationException, + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws ParserConfigurationException, IOException, SAXException, TransformerException { @@ -522,16 +571,16 @@ public class DOMUtils { parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); parser.setFeature(DISALLOW_DOCTYPE_FEATURE, true); - + if (externalSchemaLocations != null) { parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); } if (externalNoNamespaceSchemaLocation != null) { parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - "externalNoNamespaceSchemaLocation"); + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); } // set up entity resolver and error handler @@ -543,32 +592,35 @@ public class DOMUtils { return true; } - /** * Schema validate a given DOM element. - * - * @param element The element to validate. - * @param externalSchemaLocations A <code>String</code> containing namespace - * URI to schema location pairs, the same way it is accepted by the <code>xsi: - * schemaLocation</code> attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * <code>xsi:noNamespaceSchemaLocation</code> attribute. - * @return <code>true</code>, if the <code>element</code> validates against - * the schemas declared in it. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document from its - * serialized representation. + * + * @param element The element to validate. + * @param externalSchemaLocations A <code>String</code> containing + * namespace URI to schema location + * pairs, the same way it is accepted + * by the <code>xsi: + * schemaLocation</code> attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the schema + * for elements without a namespace, + * the same way it is accepted by the + * <code>xsi:noNamespaceSchemaLocation</code> + * attribute. + * @return <code>true</code>, if the <code>element</code> validates against the + * schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document + * from its serialized representation. * @throws ParserConfigurationException An error occurred configuring the XML - * @throws TransformerException An error occurred serializing the element. + * @throws TransformerException An error occurred serializing the + * element. */ public static boolean validateElement( - Element element, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation, - EntityResolver entityResolver) - throws - ParserConfigurationException, + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver) + throws ParserConfigurationException, IOException, SAXException, TransformerException { @@ -590,16 +642,19 @@ public class DOMUtils { parser.setFeature(NAMESPACES_FEATURE, true); parser.setFeature(VALIDATION_FEATURE, true); parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); - + + final SecurityManager xmlParserSecManager = new org.apache.xerces.util.SecurityManager(); + parser.setProperty(SECURITY_MANAGER, xmlParserSecManager); + if (externalSchemaLocations != null) { parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); } if (externalNoNamespaceSchemaLocation != null) { parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - "externalNoNamespaceSchemaLocation"); + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); } // set up entity resolver and error handler @@ -610,122 +665,127 @@ public class DOMUtils { parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); return true; } - + /** * Serialize the given DOM node. - * + * * The node will be serialized using the UTF-8 encoding. - * + * * @param node The node to serialize. - * @return String The <code>String</code> representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a <code>String</code>. - * @throws IOException An IO error occurred writing the node to a byte array. + * @return String The <code>String</code> representation of the given DOM node. + * @throws TransformerException An error occurred transforming the node to a + * <code>String</code>. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ public static String serializeNode(Node node) - throws TransformerException, IOException { + throws TransformerException, IOException { return new String(serializeNode(node, "UTF-8", false), "UTF-8"); } - /** * Serialize the given DOM node. - * + * * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. + * + * @param node The node to serialize. * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @return String The <code>String</code> representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a <code>String</code>. - * @throws IOException An IO error occurred writing the node to a byte array. + * @return String The <code>String</code> representation of the given DOM node. + * @throws TransformerException An error occurred transforming the node to a + * <code>String</code>. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ public static String serializeNode(Node node, boolean omitXmlDeclaration) - throws TransformerException, IOException { + throws TransformerException, IOException { return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); } /** * Serialize the given DOM node. - * + * * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. + * + * @param node The node to serialize. * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser - * @return String The <code>String</code> representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a <code>String</code>. - * @throws IOException An IO error occurred writing the node to a byte array. + * @param lineSeperator Sets the line seperator String of the parser + * @return String The <code>String</code> representation of the given DOM node. + * @throws TransformerException An error occurred transforming the node to a + * <code>String</code>. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) - throws TransformerException, IOException { + throws TransformerException, IOException { return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); } - + /** * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. + * + * @param node The node to serialize. * @param xmlEncoding The XML encoding to use. * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a <code>String</code>. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. + * this can easily be converted into a <code>String</code>. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ public static byte[] serializeNode(Node node, String xmlEncoding) - throws TransformerException, IOException { + throws TransformerException, IOException { return serializeNode(node, xmlEncoding, false); } - + /** * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. * @param omitDeclaration The boolean value for omitting the XML Declaration. * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a <code>String</code>. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. + * this can easily be converted into a <code>String</code>. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) - throws TransformerException, IOException { + throws TransformerException, IOException { return serializeNode(node, xmlEncoding, omitDeclaration, null); } - /** * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. * @param omitDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser + * @param lineSeperator Sets the line seperator String of the parser * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a <code>String</code>. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. + * this can easily be converted into a <code>String</code>. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte + * array. */ - public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) - throws TransformerException, IOException { + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, + String lineSeperator) + throws TransformerException, IOException { - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); + final TransformerFactory transformerFactory = TransformerFactory.newInstance(); + final Transformer transformer = transformerFactory.newTransformer(); + final ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); - String omit = omitDeclaration ? "yes" : "no"; + final String omit = omitDeclaration ? "yes" : "no"; transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); - if (null!=lineSeperator) { - transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 + if (null != lineSeperator) { + transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);// does not + // work for + // xalan <= + // 2.5.1 } transformer.transform(new DOMSource(node), new StreamResult(bos)); @@ -736,30 +796,30 @@ public class DOMUtils { } /** - * Return the text that a node contains. - * - * This routine: - * <ul> - * <li>Ignores comments and processing instructions.</li> - * <li>Concatenates TEXT nodes, CDATA nodes, and the results recursively - * processing EntityRef nodes.</li> - * <li>Ignores any element nodes in the sublist. (Other possible options are - * to recurse into element sublists or throw an exception.)</li> - * </ul> - * - * @param node A DOM node from which to extract text. - * @return A String representing its contents. - */ + * Return the text that a node contains. + * + * This routine: + * <ul> + * <li>Ignores comments and processing instructions.</li> + * <li>Concatenates TEXT nodes, CDATA nodes, and the results recursively + * processing EntityRef nodes.</li> + * <li>Ignores any element nodes in the sublist. (Other possible options are to + * recurse into element sublists or throw an exception.)</li> + * </ul> + * + * @param node A DOM node from which to extract text. + * @return A String representing its contents. + */ public static String getText(Node node) { if (!node.hasChildNodes()) { return ""; } - StringBuffer result = new StringBuffer(); - NodeList list = node.getChildNodes(); + final StringBuffer result = new StringBuffer(); + final NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { - Node subnode = list.item(i); + final Node subnode = list.item(i); if (subnode.getNodeType() == Node.TEXT_NODE) { result.append(subnode.getNodeValue()); } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { @@ -776,28 +836,28 @@ public class DOMUtils { /** * Build the namespace prefix to namespace URL mapping in effect for a given * node. - * + * * @param node The context node for which build the map. - * @return The namespace prefix to namespace URL mapping ( - * a <code>String</code> value to <code>String</code> value mapping). + * @return The namespace prefix to namespace URL mapping ( a <code>String</code> + * value to <code>String</code> value mapping). */ public static Map getNamespaceDeclarations(Node node) { - Map nsDecls = new HashMap(); + final Map nsDecls = new HashMap(); int i; do { if (node.hasAttributes()) { - NamedNodeMap attrs = node.getAttributes(); + final NamedNodeMap attrs = node.getAttributes(); for (i = 0; i < attrs.getLength(); i++) { - Attr attr = (Attr) attrs.item(i); + final Attr attr = (Attr) attrs.item(i); // add prefix mapping if none exists if ("xmlns".equals(attr.getPrefix()) - || "xmlns".equals(attr.getName())) { + || "xmlns".equals(attr.getName())) { - String nsPrefix = - attr.getPrefix() != null ? attr.getLocalName() : ""; + final String nsPrefix = + attr.getPrefix() != null ? attr.getLocalName() : ""; if (nsDecls.get(nsPrefix) == null) { nsDecls.put(nsPrefix, attr.getValue()); @@ -811,26 +871,26 @@ public class DOMUtils { } /** - * Add all namespace declarations declared in the parent(s) of a given - * element and used in the subtree of the given element to the given element. - * + * Add all namespace declarations declared in the parent(s) of a given element + * and used in the subtree of the given element to the given element. + * * @param context The element to which to add the namespaces. */ public static void localizeNamespaceDeclarations(Element context) { - Node parent = context.getParentNode(); + final Node parent = context.getParentNode(); if (parent != null) { - Map namespaces = getNamespaceDeclarations(context.getParentNode()); - Set nsUris = collectNamespaceURIs(context); + final Map namespaces = getNamespaceDeclarations(context.getParentNode()); + final Set nsUris = collectNamespaceURIs(context); Iterator iter; for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { - Map.Entry e = (Map.Entry) iter.next(); + final Map.Entry e = (Map.Entry) iter.next(); if (nsUris.contains(e.getValue())) { - String prefix = (String) e.getKey(); - String nsUri = (String) e.getValue(); - String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; + final String prefix = (String) e.getKey(); + final String nsUri = (String) e.getValue(); + final String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); } @@ -840,13 +900,13 @@ public class DOMUtils { /** * Collect all the namespace URIs used in the subtree of a given element. - * + * * @param context The element that should be searched for namespace URIs. * @return All namespace URIs used in the subtree of <code>context</code>, - * including the ones used in <code>context</code> itself. + * including the ones used in <code>context</code> itself. */ public static Set collectNamespaceURIs(Element context) { - Set result = new HashSet(); + final Set result = new HashSet(); collectNamespaceURIsImpl(context, result); return result; @@ -854,14 +914,14 @@ public class DOMUtils { /** * A recursive method to do the work of <code>collectNamespaceURIs</code>. - * + * * @param context The context element to evaluate. - * @param result The result, passed as a parameter to avoid unnecessary - * instantiations of <code>Set</code>. + * @param result The result, passed as a parameter to avoid unnecessary + * instantiations of <code>Set</code>. */ private static void collectNamespaceURIsImpl(Element context, Set result) { - NamedNodeMap attrs = context.getAttributes(); - NodeList childNodes = context.getChildNodes(); + final NamedNodeMap attrs = context.getAttributes(); + final NodeList childNodes = context.getChildNodes(); String nsUri; int i; @@ -881,7 +941,7 @@ public class DOMUtils { // add all namespaces from subelements for (i = 0; i < childNodes.getLength(); i++) { - Node node = childNodes.item(i); + final Node node = childNodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { collectNamespaceURIsImpl((Element) node, result); @@ -892,13 +952,13 @@ public class DOMUtils { /** * Check, that each attribute node in the given <code>NodeList</code> has its * parent in the <code>NodeList</code> as well. - * + * * @param nodes The <code>NodeList</code> to check. - * @return <code>true</code>, if each attribute node in <code>nodes</code> - * has its parent in <code>nodes</code> as well. + * @return <code>true</code>, if each attribute node in <code>nodes</code> has + * its parent in <code>nodes</code> as well. */ public static boolean checkAttributeParentsInNodeList(NodeList nodes) { - Set nodeSet = new HashSet(); + final Set nodeSet = new HashSet(); int i; // put the nodes into the nodeSet @@ -908,11 +968,11 @@ public class DOMUtils { // check that each attribute node's parent is in the node list for (i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); + final Node n = nodes.item(i); if (n.getNodeType() == Node.ATTRIBUTE_NODE) { - Attr attr = (Attr) n; - Element owner = attr.getOwnerElement(); + final Attr attr = (Attr) n; + final Element owner = attr.getOwnerElement(); if (owner == null) { if (!isNamespaceDeclaration(attr)) { @@ -930,29 +990,28 @@ public class DOMUtils { } /** - * Convert an unstructured <code>NodeList</code> into a + * Convert an unstructured <code>NodeList</code> into a * <code>DocumentFragment</code>. * - * @param nodeList Contains the node list to be converted into a DOM - * DocumentFragment. - * @return the resulting DocumentFragment. The DocumentFragment will be - * backed by a new DOM Document, i.e. all noded of the node list will be - * cloned. + * @param nodeList Contains the node list to be converted into a DOM + * DocumentFragment. + * @return the resulting DocumentFragment. The DocumentFragment will be backed + * by a new DOM Document, i.e. all noded of the node list will be + * cloned. * @throws ParserConfigurationException An error occurred creating the - * DocumentFragment. + * DocumentFragment. * @precondition The nodes in the node list appear in document order - * @precondition for each Attr node in the node list, the owning Element is - * in the node list as well. - * @precondition each Element or Attr node in the node list is namespace - * aware. + * @precondition for each Attr node in the node list, the owning Element is in + * the node list as well. + * @precondition each Element or Attr node in the node list is namespace aware. */ public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) - throws ParserConfigurationException { + throws ParserConfigurationException { - DocumentBuilder builder = - DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = builder.newDocument(); - DocumentFragment result = doc.createDocumentFragment(); + final DocumentBuilder builder = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + final Document doc = builder.newDocument(); + final DocumentFragment result = doc.createDocumentFragment(); if (null == nodeList || nodeList.getLength() == 0) { return result; @@ -960,116 +1019,114 @@ public class DOMUtils { int currPos = 0; currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; while (currPos < nodeList.getLength()) { currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; } return result; } /** * Helper method for the <code>nodeList2DocumentFragment</code>. - * - * @param nodeList The <code>NodeList</code> to convert. - * @param currPos The current position in the <code>nodeList</code>. - * @param result The resulting <code>DocumentFragment</code>. - * @param currOrgElem The current original element. + * + * @param nodeList The <code>NodeList</code> to convert. + * @param currPos The current position in the <code>nodeList</code>. + * @param result The resulting <code>DocumentFragment</code>. + * @param currOrgElem The current original element. * @param currClonedElem The current cloned element. * @return The current position. */ private static int nodeList2DocumentFragment( - NodeList nodeList, - int currPos, - DocumentFragment result, - Element currOrgElem, - Element currClonedElem) { + NodeList nodeList, + int currPos, + DocumentFragment result, + Element currOrgElem, + Element currClonedElem) { while (currPos < nodeList.getLength()) { - Node currentNode = nodeList.item(currPos); + final Node currentNode = nodeList.item(currPos); switch (currentNode.getNodeType()) { - case Node.COMMENT_NODE : - case Node.PROCESSING_INSTRUCTION_NODE : - case Node.TEXT_NODE : - { - // Append current node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild( - result.getOwnerDocument().importNode(currentNode, false)); - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild( + case Node.COMMENT_NODE: + case Node.PROCESSING_INSTRUCTION_NODE: + case Node.TEXT_NODE: { + // Append current node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild( result.getOwnerDocument().importNode(currentNode, false)); + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; } - break; + + currClonedElem.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); } + break; + } - case Node.ELEMENT_NODE : - { - Element nextCurrOrgElem = (Element) currentNode; - Element nextCurrClonedElem = + case Node.ELEMENT_NODE: { + final Element nextCurrOrgElem = (Element) currentNode; + final Element nextCurrClonedElem = result.getOwnerDocument().createElementNS( - nextCurrOrgElem.getNamespaceURI(), - nextCurrOrgElem.getNodeName()); - - // Append current Node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild(nextCurrClonedElem); - currOrgElem = nextCurrOrgElem; - currClonedElem = nextCurrClonedElem; - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild(nextCurrClonedElem); + nextCurrOrgElem.getNamespaceURI(), + nextCurrOrgElem.getNodeName()); + + // Append current Node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild(nextCurrClonedElem); + currOrgElem = nextCurrOrgElem; + currClonedElem = nextCurrClonedElem; + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; } - // Process current Node (of type Element) recursively - currPos = + currClonedElem.appendChild(nextCurrClonedElem); + } + + // Process current Node (of type Element) recursively + currPos = nodeList2DocumentFragment( - nodeList, - ++currPos, - result, - nextCurrOrgElem, - nextCurrClonedElem); + nodeList, + ++currPos, + result, + nextCurrOrgElem, + nextCurrClonedElem); - break; - } + break; + } - case Node.ATTRIBUTE_NODE : - { - Attr currAttr = (Attr) currentNode; + case Node.ATTRIBUTE_NODE: { + final Attr currAttr = (Attr) currentNode; - // GK 20030411: Hack to overcome problems with IAIK IXSIL - if (currAttr.getOwnerElement() == null) - break; - if (currClonedElem == null) - break; + // GK 20030411: Hack to overcome problems with IAIK IXSIL + if (currAttr.getOwnerElement() == null) { + break; + } + if (currClonedElem == null) { + break; + } - // currClonedElem must be the owner Element of currAttr if - // preconditions are met - currClonedElem.setAttributeNS( + // currClonedElem must be the owner Element of currAttr if + // preconditions are met + currClonedElem.setAttributeNS( currAttr.getNamespaceURI(), currAttr.getNodeName(), currAttr.getValue()); - break; - } + break; + } - default : - { - // All other nodes will be ignored - } + default: { + // All other nodes will be ignored + } } currPos++; @@ -1080,10 +1137,10 @@ public class DOMUtils { /** * Check, if the given attribute is a namespace declaration. - * + * * @param attr The attribute to check. * @return <code>true</code>, if the attribute is a namespace declaration, - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ private static boolean isNamespaceDeclaration(Attr attr) { return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); @@ -1091,81 +1148,82 @@ public class DOMUtils { /** * Check, if a given DOM element is an ancestor of a given node. - * + * * @param candAnc The DOM element to check for being the ancestor. - * @param cand The node to check for being the child. - * @return <code>true</code>, if <code>candAnc</code> is an (indirect) - * ancestor of <code>cand</code>; <code>false</code> otherwise. + * @param cand The node to check for being the child. + * @return <code>true</code>, if <code>candAnc</code> is an (indirect) ancestor + * of <code>cand</code>; <code>false</code> otherwise. */ public static boolean isAncestor(Element candAnc, Node cand) { Node currPar = cand.getParentNode(); while (currPar != null) { - if (candAnc == currPar) + if (candAnc == currPar) { return true; + } currPar = currPar.getParentNode(); } 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 <code>null</code> - * if the node list is <code>null</code> or empty or no element is - * included in the list. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or <code>null</code> if + * the node list is <code>null</code> or empty or no element is included + * in the list. */ - public static Element getElementFromNodeList (NodeList nl) { - if ((nl == null) || (nl.getLength() == 0)) { + public static Element getElementFromNodeList(NodeList nl) { + if (nl == null || nl.getLength() == 0) { return null; } - for (int i=0; i<nl.getLength(); i++) { - Node node = nl.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - return (Element)node; + for (int i = 0; i < nl.getLength(); i++) { + final Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + return (Element) node; } } return null; } - + /** * Returns all child elements of the given element. - * - * @param parent The element to get the child elements from. - * - * @return A list including all child elements of the given element. - * Maybe empty if the parent element has no child elements. + * + * @param parent The element to get the child elements from. + * + * @return A list including all child elements of the given element. Maybe empty + * if the parent element has no child elements. */ - public static List getChildElements (Element parent) { - Vector v = new Vector(); - NodeList nl = parent.getChildNodes(); - int length = nl.getLength(); - for (int i=0; i < length; i++) { - Node node = nl.item(i); + public static List getChildElements(Element parent) { + final Vector v = new Vector(); + final NodeList nl = parent.getChildNodes(); + final int length = nl.getLength(); + for (int i = 0; i < length; i++) { + final Node node = nl.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { - v.add((Element)node); + v.add(node); } } return v; } - + /** * Returns a byte array from given node. + * * @param node * @return * @throws TransformerException */ public static byte[] nodeToByteArray(Node node) throws TransformerException { - Source source = new DOMSource(node); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - //StringWriter stringWriter = new StringWriter(); - Result result = new StreamResult(out); - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - transformer.transform(source, result); - return out.toByteArray(); + final Source source = new DOMSource(node); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + // StringWriter stringWriter = new StringWriter(); + final Result result = new StreamResult(out); + final TransformerFactory factory = TransformerFactory.newInstance(); + final Transformer transformer = factory.newTransformer(); + transformer.transform(source, result); + return out.toByteArray(); } - } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DateTimeUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DateTimeUtils.java index c199c29..a874bd5 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DateTimeUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/DateTimeUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.StringWriter; @@ -38,9 +37,9 @@ import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; /** - * Utility for parsing and building XML type <code>dateTime</code>, - * according to ISO 8601. - * + * Utility for parsing and building XML type <code>dateTime</code>, according to + * ISO 8601. + * * @author Patrick Peck * @version $Id$ * @see <code>http://www.w3.org/2001/XMLSchema-datatypes"</code> @@ -55,7 +54,7 @@ public class DateTimeUtils { // * @return the <code>dateTime</code> value // */ // public static String buildDateTime(Calendar cal, boolean useUTC) { -// +// // if (useUTC) // return buildDateTimeUTC(cal); // else { @@ -92,41 +91,46 @@ public class DateTimeUtils { // return out.toString(); // } // } - + /** - * Builds a <code>dateTime</code> value in UTC from a <code>Calendar</code> value. + * Builds a <code>dateTime</code> value in UTC from a <code>Calendar</code> + * value. + * * @param cal the <code>Calendar</code> value * @return the <code>dateTime</code> value */ public static String buildDateTimeUTC(Calendar cal) { - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); - f.setTimeZone(TimeZone.getTimeZone("UTC")); - - return f.format(cal.getTime()); + + final SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal.getTime()); } - + /** - * Builds a <code>dateTime</code> value in UTC from a <code>Calendar</code> value. + * Builds a <code>dateTime</code> value in UTC from a <code>Calendar</code> + * value. + * * @param cal the <code>Calendar</code> value * @return the <code>dateTime</code> value */ public static String buildDateTimeUTC(Date cal) { - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); - f.setTimeZone(TimeZone.getTimeZone("UTC")); - - return f.format(cal); - + + final SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal); + } - + /** * Builds a <code>dateTime</code> value from a <code>Calendar</code> value. + * * @param cal the <code>Calendar</code> value * @return the <code>dateTime</code> value */ public static String buildDate(Calendar cal) { - StringWriter out = new StringWriter(); + final StringWriter out = new StringWriter(); out.write("" + cal.get(Calendar.YEAR)); out.write("-"); out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); @@ -134,43 +138,45 @@ public class DateTimeUtils { out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); return out.toString(); } - + /** * Builds a <code>dateTime</code> value from a <code>Calendar</code> value. + * * @param cal the <code>Calendar</code> value * @return the <code>dateTime</code> value */ public static String buildTime(Calendar cal) { - StringWriter out = new StringWriter(); - out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.MINUTE))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.SECOND))); - - return out.toString(); + final StringWriter out = new StringWriter(); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + + return out.toString(); } - + /** - * Converts month, day, hour, minute, or second value - * to a 2 digit String. + * Converts month, day, hour, minute, or second value to a 2 digit String. + * * @param number the month, day, hour, minute, or second value * @return 2 digit String */ private static String to2DigitString(int number) { - if (number < 10) + if (number < 10) { return "0" + number; - else + } else { return "" + number; + } } /** - * Parse a <code>String</code> containing a date and time instant, given in - * ISO 8601 format. - * + * Parse a <code>String</code> containing a date and time instant, given in ISO + * 8601 format. + * * @param dateTime The <code>String</code> to parse. * @return The <code>Date</code> representation of the contents of - * <code>dateTime</code>. + * <code>dateTime</code>. * @throws ParseException Parsing the <code>dateTime</code> failed. */ public static Date parseDateTime(String dateTime) throws ParseException { @@ -247,8 +253,7 @@ public class DateTimeUtils { curPos++; ensureDigits(dateTime, curPos, 1); fractStr = "0."; - fractStr - += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); + fractStr += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); fraction = Double.parseDouble(fractStr); curPos += countDigits(dateTime, curPos); } @@ -294,12 +299,12 @@ public class DateTimeUtils { calendar.set(Calendar.MILLISECOND, 0); time = calendar.getTime().getTime(); time += (long) (fraction * 1000.0); - time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; + time -= tzSign * (tzHour * 60 + tzMinute) * 60 * 1000; if (localTime) { - time -= TimeZone.getDefault().getRawOffset(); + time -= TimeZone.getDefault().getRawOffset(); } return new Date(time); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { throw new ParseException(msg.getMessage("datetime.00", null), curPos); } @@ -307,16 +312,16 @@ public class DateTimeUtils { /** * Parse an integer value. - * - * @param str The <code>String</code> containing the digits. + * + * @param str The <code>String</code> containing the digits. * @param curPos The starting position. * @param digits The number of digist making up the integer value. * @return int The integer representation of the digits contained in - * <code>str</code>. + * <code>str</code>. * @throws ParseException Parsing the integer value failed. */ private static int parseInt(String str, int curPos, int digits) - throws ParseException { + throws ParseException { ensureDigits(str, curPos, digits); return Integer.parseInt(str.substring(curPos, curPos + digits)); @@ -324,31 +329,33 @@ public class DateTimeUtils { /** * Count the number of digits following <code>curPos</code>. - * - * @param str The <code>String</code> in which to count digits. + * + * @param str The <code>String</code> in which to count digits. * @param curPos The starting position. * @return int The number of digits. */ private static int countDigits(String str, int curPos) { int i; - for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); + for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++) { + ; + } return i - curPos; } /** * Ensure that a value falls in a given min/max range. - * - * @param value The value to check. - * @param min The minimum allowed value. - * @param max The maximum allowed value. + * + * @param value The value to check. + * @param min The minimum allowed value. + * @param max The maximum allowed value. * @param curPos To indicate the parsing position in the - * <code>ParseException</code>. + * <code>ParseException</code>. * @throws ParseException Thrown, if <code>value < min || value > * max</code> */ private static void ensureValue(int value, int min, int max, int curPos) - throws ParseException { + throws ParseException { if (value < min || value > max) { throw new ParseException(msg.getMessage("datetime.00", null), curPos); @@ -357,16 +364,16 @@ public class DateTimeUtils { /** * Ensure that the given <code>String</code> has a number of characters left. - * - * @param str The <code>String</code> to check for its length. + * + * @param str The <code>String</code> to check for its length. * @param curPos The starting position. - * @param count The minimum number of characters that <code>str</code> must - * contain, starting at from <code>curPos</code>. - * @throws ParseException Thrown, if - * <code>curPos + count > str.length()</code>. + * @param count The minimum number of characters that <code>str</code> must + * contain, starting at from <code>curPos</code>. + * @throws ParseException Thrown, if + * <code>curPos + count > str.length()</code>. */ private static void ensureChars(String str, int curPos, int count) - throws ParseException { + throws ParseException { if (curPos + count > str.length()) { throw new ParseException(msg.getMessage("datetime.00", null), curPos); } @@ -375,17 +382,17 @@ public class DateTimeUtils { /** * Ensure that a given <code>String</code> contains a certain character at a * certain position. - * - * @param str The <code>String</code> in which to look up the character. + * + * @param str The <code>String</code> in which to look up the character. * @param curPos The position in <code>str</code> that must contain the - * character. - * @param c The character value that must be contained at position - * <code>curPos</code>. + * character. + * @param c The character value that must be contained at position + * <code>curPos</code>. * @throws ParseException Thrown, if the characters do not match or - * <code>curPos</code> is out of range. + * <code>curPos</code> is out of range. */ private static void ensureChar(String str, int curPos, char c) - throws ParseException { + throws ParseException { ensureChars(str, curPos, 1); if (str.charAt(curPos) != c) { @@ -394,19 +401,19 @@ public class DateTimeUtils { } /** - * Ensure that a given <code>String</code> contains a number of digits, - * starting at a given position. - * - * @param str The <code>String</code> to scan for digits. + * Ensure that a given <code>String</code> contains a number of digits, starting + * at a given position. + * + * @param str The <code>String</code> to scan for digits. * @param curPos The starting postion. - * @param count The number of digits that must be contained in - * <code>str</code>, starting at <code>curPos</code>. - * @throws ParseException Thrown, if <code>str</code> is not long enough, or - * one of the characters following <code>curPos</code> in <code>str</code> is - * not a digit. + * @param count The number of digits that must be contained in + * <code>str</code>, starting at <code>curPos</code>. + * @throws ParseException Thrown, if <code>str</code> is not long enough, or one + * of the characters following <code>curPos</code> in + * <code>str</code> is not a digit. */ private static void ensureDigits(String str, int curPos, int count) - throws ParseException { + throws ParseException { ensureChars(str, curPos, count); for (int i = curPos; i < curPos + count; i++) { @@ -415,101 +422,108 @@ public class DateTimeUtils { } } } - + /** * Calculates the age if date of birth is given (for a calendar time stamp) + * * @param dateOfBirth Date of Birth - * @param now Calendar time stamp at which the age needs to be calculated for + * @param now Calendar time stamp at which the age needs to be + * calculated for * @return Age of a person */ public static int calcAge(Calendar dateOfBirth, Calendar now) { - int age = now.get(Calendar.YEAR) - dateOfBirth.get(Calendar.YEAR); - - int nowM = now.get(Calendar.MONTH); - int dobM = dateOfBirth.get(Calendar.MONTH); - int nowDOM = now.get(Calendar.DAY_OF_MONTH); - int dobDOM = dateOfBirth.get(Calendar.DAY_OF_MONTH); - - if ((nowM < dobM) || ((nowM == dobM) && (nowDOM < dobDOM))) { - age--; - } - - if (age < 0) { - throw new IllegalArgumentException("Calculated age results in negative value."); - } - return age; - } + int age = now.get(Calendar.YEAR) - dateOfBirth.get(Calendar.YEAR); + + final int nowM = now.get(Calendar.MONTH); + final int dobM = dateOfBirth.get(Calendar.MONTH); + final int nowDOM = now.get(Calendar.DAY_OF_MONTH); + final int dobDOM = dateOfBirth.get(Calendar.DAY_OF_MONTH); + + if (nowM < dobM || nowM == dobM && nowDOM < dobDOM) { + age--; + } + + if (age < 0) { + throw new IllegalArgumentException("Calculated age results in negative value."); + } + return age; + } /** * Calculates the age if date of birth is given as Calendar object + * * @param dateOfBirth Date of Birth as Calendar object * @return Age of a person */ - public static int calcAge(Calendar dateOfBirth) { - return calcAge(dateOfBirth, Calendar.getInstance()); - } - - /** - * Calculates the age if date of birth is given (for a date time stamp) - * @param dateOfBirth Date of Birth - * @param now Date time stamp at which the age needs to be calculated for - * @return Age of a person - */ - public static int calcAge(Date dateOfBirth, Date now) { - Calendar dob = Calendar.getInstance(); - dob.setTime(dateOfBirth); - Calendar nowCal = Calendar.getInstance(); - nowCal.setTime(now); - return calcAge(dob, nowCal); - } - - /** - * Calculates the age if date of birth is given as Date object - * @param dateOfBirth Date of Birth as Date object - * @return Age of a person - */ - public static int calcAge(Date dateOfBirth) { - return calcAge(dateOfBirth, new Date()); - } - - public static String formatPEPSDateToMOADate(String pepsDate) { - - if (StringUtils.isEmpty(pepsDate)) { - return null; - } - - DateTimeFormatter fmt = null; - - switch (pepsDate.length()) { - case 4: - fmt = DateTimeFormat.forPattern("yyyy"); - break; - case 6: - fmt = DateTimeFormat.forPattern("yyyyMM"); - break; - case 8: - fmt = DateTimeFormat.forPattern("yyyyMMdd"); - break; - default: - fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); - break; - } - - DateTime dt = fmt.parseDateTime(pepsDate); - DateTimeFormatter fmt2 = DateTimeFormat.forPattern("yyyy-MM-dd"); - return fmt2.print(dt); - - } - - /** - * Returns a date as String using a provided format - * @param format Format the date/time should be returned - * @return Date/Time as String formatted according the provided format - */ - public static String getDateTimeWithFormat(String format) { - DateFormat dateFormat = new SimpleDateFormat(format); - Date date = new Date(); - return dateFormat.format(date); + public static int calcAge(Calendar dateOfBirth) { + return calcAge(dateOfBirth, Calendar.getInstance()); + } + + /** + * Calculates the age if date of birth is given (for a date time stamp) + * + * @param dateOfBirth Date of Birth + * @param now Date time stamp at which the age needs to be calculated + * for + * @return Age of a person + */ + public static int calcAge(Date dateOfBirth, Date now) { + final Calendar dob = Calendar.getInstance(); + dob.setTime(dateOfBirth); + final Calendar nowCal = Calendar.getInstance(); + nowCal.setTime(now); + return calcAge(dob, nowCal); + } + + /** + * Calculates the age if date of birth is given as Date object + * + * @param dateOfBirth Date of Birth as Date object + * @return Age of a person + */ + public static int calcAge(Date dateOfBirth) { + return calcAge(dateOfBirth, new Date()); + } + + public static String formatPEPSDateToMOADate(String pepsDate) { + + if (StringUtils.isEmpty(pepsDate)) { + return null; } + DateTimeFormatter fmt = null; + + switch (pepsDate.length()) { + case 4: + fmt = DateTimeFormat.forPattern("yyyy"); + break; + case 6: + fmt = DateTimeFormat.forPattern("yyyyMM"); + break; + case 8: + fmt = DateTimeFormat.forPattern("yyyyMMdd"); + break; + default: + fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); + break; + } + + final DateTime dt = fmt.parseDateTime(pepsDate); + final DateTimeFormatter fmt2 = DateTimeFormat.forPattern("yyyy-MM-dd"); + return fmt2.print(dt); + + } + + /** + * Returns a date as String using a provided format + * + * @param format Format the date/time should be returned + * @return Date/Time as String formatted according the provided format + */ + public static String getDateTimeWithFormat(String format) { + final DateFormat dateFormat = new SimpleDateFormat(format); + final Date date = new Date(); + return dateFormat.format(date); + } + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java index 9c678d4..8b16a97 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Empty.java @@ -1,13 +1,13 @@ /* * Copyright 2011 Federal Chancellery Austria and * Graz University of Technology - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,11 +21,11 @@ package at.gv.egovernment.moaspss.util; */ public interface Empty { - /** - * Returns {@code true} if underlying object is empty. - * - * @return {@code true} if empty, {@code false} if not empty. - */ - boolean isEmpty(); + /** + * Returns {@code true} if underlying object is empty. + * + * @return {@code true} if empty, {@code false} if not empty. + */ + boolean isEmpty(); } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java index 487c6a4..6f61517 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/EntityResolverChain.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.IOException; @@ -34,39 +33,41 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * Implementation of the <code>org.xml.sax.EntityResolver</code>, - * for use by a <code>org.apache.xerces.parsers.DOMParser</code>. - * + * Implementation of the <code>org.xml.sax.EntityResolver</code>, for use by a + * <code>org.apache.xerces.parsers.DOMParser</code>. + * * @author Patrick Peck * @version $Id$ */ public class EntityResolverChain implements EntityResolver { /** The <code>EntityResolver</code>s in the chain. */ - private List resolvers = new ArrayList(); + private final List resolvers = new ArrayList(); /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, + * java.lang.String) */ + @Override public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - + throws SAXException, IOException { + Iterator iter; - - for (iter = resolvers.iterator(); iter.hasNext(); ) { - EntityResolver resolver = (EntityResolver) iter.next(); - InputSource is = resolver.resolveEntity(publicId, systemId); - + + for (iter = resolvers.iterator(); iter.hasNext();) { + final EntityResolver resolver = (EntityResolver) iter.next(); + final InputSource is = resolver.resolveEntity(publicId, systemId); + if (is != null) { return is; } } - + return null; } - + /** * Add an <code>EntityResolver</code> to the chain. - * + * * @param entityResolver The <code>EntityResolver</code> to add. */ public void addEntityResolver(EntityResolver entityResolver) { diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java index 309e01a..d64cda0 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/FileUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.BufferedInputStream; @@ -34,146 +33,167 @@ import java.io.OutputStream; import java.net.URL; /** - * Utility for accessing files on the file system, and for reading from input streams. + * Utility for accessing files on the file system, and for reading from input + * streams. + * * @author Paul Ivancsics * @version $Id$ */ public class FileUtils { - + /** * Reads a file, given by URL, into a byte array. + * * @param urlString file URL * @return file content * @throws IOException on any exception thrown */ - public static byte[] readURL(String urlString) throws IOException { - URL url = new URL(urlString); - InputStream in = new BufferedInputStream(url.openStream()); - byte[] content = StreamUtils.readStream(in); + public static byte[] readURL(String urlString) throws IOException { + final URL url = new URL(urlString); + final InputStream in = new BufferedInputStream(url.openStream()); + final byte[] content = StreamUtils.readStream(in); in.close(); return content; } + /** * Reads a file, given by URL, into a String. + * * @param urlString file URL - * @param encoding character encoding + * @param encoding character encoding * @return file content * @throws IOException on any exception thrown */ public static String readURL(String urlString, String encoding) throws IOException { - byte[] content = readURL(urlString); + final byte[] content = readURL(urlString); return new String(content, encoding); } + /** * Reads a file, given by filename, into a byte array. + * * @param filename filename * @return file content * @throws IOException on any exception thrown */ public static byte[] readFile(String filename) throws IOException { - BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); - byte[] content = StreamUtils.readStream(in); + final BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); + final byte[] content = StreamUtils.readStream(in); in.close(); return content; } + /** * Reads a file, given by filename, into a String. + * * @param filename filename * @param encoding character encoding * @return file content * @throws IOException on any exception thrown */ public static String readFile(String filename, String encoding) throws IOException { - byte[] content = readFile(filename); + final byte[] content = readFile(filename); return new String(content, encoding); } + /** * Reads a file from a resource. + * * @param name resource name * @return file content as a byte array * @throws IOException on any exception thrown */ public static byte[] readResource(String name) throws IOException { - ClassLoader cl = FileUtils.class.getClassLoader(); - BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); - byte[] content = StreamUtils.readStream(in); + final ClassLoader cl = FileUtils.class.getClassLoader(); + final BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); + final byte[] content = StreamUtils.readStream(in); in.close(); return content; } + /** * Reads a file from a resource. - * @param name filename + * + * @param name filename * @param encoding character encoding * @return file content * @throws IOException on any exception thrown */ public static String readResource(String name, String encoding) throws IOException { - byte[] content = readResource(name); + final byte[] content = readResource(name); return new String(content, encoding); } - - /** - * Returns the absolute URL of a given url which is relative to the parameter root - * @param url - * @param root - * @return String - */ - public static String makeAbsoluteURL(String url, String root) { - //if url is relative to rootConfigFileDirName make it absolute - + + /** + * Returns the absolute URL of a given url which is relative to the parameter + * root + * + * @param url + * @param root + * @return String + */ + public static String makeAbsoluteURL(String url, String root) { + // if url is relative to rootConfigFileDirName make it absolute + File keyFile; String newURL = url; - if(null == url) return null; - - if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { - return url; + if (null == url) { + return null; + } + + if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith( + "ftp:/")) { + return url; } else { // check if absolute - if not make it absolute keyFile = new File(url); if (!keyFile.isAbsolute()) { keyFile = new File(root, url); - if (keyFile.toString().startsWith("file:")) - newURL = keyFile.toString(); - - else - newURL = keyFile.toURI().toString(); - + if (keyFile.toString().startsWith("file:")) { + newURL = keyFile.toString(); + } else { + newURL = keyFile.toURI().toString(); + } + } return newURL; } - } - - - private static void copy( InputStream fis, OutputStream fos ) - { - try - { - byte[] buffer = new byte[ 0xFFFF ]; - for ( int len; (len = fis.read(buffer)) != -1; ) - fos.write( buffer, 0, len ); - } - catch( IOException e ) { - System.err.println( e ); - } - finally { - if ( fis != null ) - try { fis.close(); } catch ( IOException e ) { e.printStackTrace(); } - if ( fos != null ) - try { fos.close(); } catch ( IOException e ) { e.printStackTrace(); } - } - } - - public static void copyFile(File src, File dest) - { - try - { - copy( new FileInputStream( src ), new FileOutputStream( dest ) ); - } - catch( IOException e ) { - e.printStackTrace(); - } - } - + } + + private static void copy(InputStream fis, OutputStream fos) { + try { + final byte[] buffer = new byte[0xFFFF]; + for (int len; (len = fis.read(buffer)) != -1;) { + fos.write(buffer, 0, len); + } + } catch (final IOException e) { + System.err.println(e); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (final IOException e) { + e.printStackTrace(); + } + } + if (fos != null) { + try { + fos.close(); + } catch (final IOException e) { + e.printStackTrace(); + } + } + } + } + + public static void copyFile(File src, File dest) { + try { + copy(new FileInputStream(src), new FileOutputStream(dest)); + } catch (final IOException e) { + e.printStackTrace(); + } + } + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java index b4d7b02..f62b82a 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/KeyStoreUtils.java @@ -21,11 +21,8 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; -import iaik.x509.X509Certificate; - import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -38,116 +35,125 @@ import java.security.KeyStore; import java.security.KeyStoreException; import java.security.cert.Certificate; +import iaik.x509.X509Certificate; + /** * Utility for creating and loading key stores. - * + * * @author Paul Ivancsics * @version $Id$ */ public class KeyStoreUtils { - - /** - * JAVA KeyStore - */ - private static final String KEYSTORE_TYPE_JKS = "JKS"; - - /** - * PKCS12 KeyStore - */ - private static final String KEYSTORE_TYPE_PKCS12 = "PKCS12"; - - + + /** + * JAVA KeyStore + */ + private static final String KEYSTORE_TYPE_JKS = "JKS"; + + /** + * PKCS12 KeyStore + */ + private static final String KEYSTORE_TYPE_PKCS12 = "PKCS12"; /** * Loads a key store from file. - * + * * @param keystoreType key store type - * @param urlString URL of key store - * @param password password protecting the key store + * @param urlString URL of key store + * @param password password protecting the key store * @return key store loaded - * @throws IOException thrown while reading the key store from file + * @throws IOException thrown while reading the key store from file * @throws GeneralSecurityException thrown while creating the key store */ public static KeyStore loadKeyStore( - String keystoreType, - String urlString, - String password) - throws IOException, GeneralSecurityException { + String keystoreType, + String urlString, + String password) + throws IOException, GeneralSecurityException { - URL keystoreURL = new URL(urlString); - InputStream in = keystoreURL.openStream(); + final URL keystoreURL = new URL(urlString); + final InputStream in = keystoreURL.openStream(); return loadKeyStore(keystoreType, in, password); } + /** - * Loads a key store from an <code>InputStream</code>, and - * closes the <code>InputStream</code>. - * + * Loads a key store from an <code>InputStream</code>, and closes the + * <code>InputStream</code>. + * * @param keystoreType key store type - * @param in input stream - * @param password password protecting the key store + * @param in input stream + * @param password password protecting the key store * @return key store loaded - * @throws IOException thrown while reading the key store from the stream + * @throws IOException thrown while reading the key store from the + * stream * @throws GeneralSecurityException thrown while creating the key store */ public static KeyStore loadKeyStore( - String keystoreType, - InputStream in, - String password) - throws IOException, GeneralSecurityException { + String keystoreType, + InputStream in, + String password) + throws IOException, GeneralSecurityException { char[] chPassword = null; - if (password != null) + if (password != null) { chPassword = password.toCharArray(); - KeyStore ks = KeyStore.getInstance(keystoreType); + } + final KeyStore ks = KeyStore.getInstance(keystoreType); ks.load(in, chPassword); in.close(); return ks; } + /** - * Creates a key store from X509 certificate files, aliasing them with - * the index in the <code>String[]</code>, starting with <code>"0"</code>. - * - * @param keyStoreType key store type + * Creates a key store from X509 certificate files, aliasing them with the index + * in the <code>String[]</code>, starting with <code>"0"</code>. + * + * @param keyStoreType key store type * @param certFilenames certificate filenames * @return key store created - * @throws IOException thrown while reading the certificates from file + * @throws IOException thrown while reading the certificates from + * file * @throws GeneralSecurityException thrown while creating the key store */ public static KeyStore createKeyStore( - String keyStoreType, - String[] certFilenames) - throws IOException, GeneralSecurityException { + String keyStoreType, + String[] certFilenames) + throws IOException, GeneralSecurityException { - KeyStore ks = KeyStore.getInstance(keyStoreType); + final KeyStore ks = KeyStore.getInstance(keyStoreType); ks.load(null, null); for (int i = 0; i < certFilenames.length; i++) { - Certificate cert = loadCertificate(certFilenames[i]); + final Certificate cert = loadCertificate(certFilenames[i]); ks.setCertificateEntry("" + i, cert); } return ks; } + /** - * Creates a key store from a directory containg X509 certificate files, - * aliasing them with the index in the <code>String[]</code>, starting with <code>"0"</code>. - * All the files in the directory are considered to be certificates. - * - * @param keyStoreType key store type - * @param certDirURLString file URL of directory containing certificate filenames + * Creates a key store from a directory containg X509 certificate files, + * aliasing them with the index in the <code>String[]</code>, starting with + * <code>"0"</code>. All the files in the directory are considered to be + * certificates. + * + * @param keyStoreType key store type + * @param certDirURLString file URL of directory containing certificate + * filenames * @return key store created - * @throws IOException thrown while reading the certificates from file + * @throws IOException thrown while reading the certificates from + * file * @throws GeneralSecurityException thrown while creating the key store */ public static KeyStore createKeyStoreFromCertificateDirectory( - String keyStoreType, - String certDirURLString) - throws IOException, GeneralSecurityException { - - URL certDirURL = new URL(certDirURLString); - String certDirname = certDirURL.getFile(); - File certDir = new File(certDirname); - String[] certFilenames = certDir.list(); - String separator = - (certDirname.endsWith(File.separator) ? "" : File.separator); + String keyStoreType, + String certDirURLString) + throws IOException, GeneralSecurityException { + + final URL certDirURL = new URL(certDirURLString); + final String certDirname = certDirURL.getFile(); + final File certDir = new File(certDirname); + final String[] certFilenames = certDir.list(); + final String separator = + certDirname.endsWith(File.separator) ? "" : File.separator; for (int i = 0; i < certFilenames.length; i++) { certFilenames[i] = certDirname + separator + certFilenames[i]; } @@ -156,68 +162,69 @@ public class KeyStoreUtils { /** * Loads an X509 certificate from file. + * * @param certFilename filename * @return the certificate loaded - * @throws IOException thrown while reading the certificate from file + * @throws IOException thrown while reading the certificate from + * file * @throws GeneralSecurityException thrown while creating the certificate */ private static Certificate loadCertificate(String certFilename) - throws IOException, GeneralSecurityException { + throws IOException, GeneralSecurityException { - FileInputStream in = new FileInputStream(certFilename); - Certificate cert = new X509Certificate(in); + final FileInputStream in = new FileInputStream(certFilename); + final Certificate cert = new X509Certificate(in); in.close(); return cert; } - - - /** - * Loads a keyStore without knowing the keyStore type - * @param keyStorePath URL to the keyStore - * @param password Password protecting the keyStore - * @return keyStore loaded - * @throws KeyStoreException thrown if keyStore cannot be loaded - * @throws FileNotFoundException - * @throws IOException - */ - public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, IOException{ - - //InputStream is = new FileInputStream(keyStorePath); - URL keystoreURL = new URL(keyStorePath); - InputStream in = keystoreURL.openStream(); - InputStream isBuffered = new BufferedInputStream(in); - return loadKeyStore(isBuffered, password); - - } - - /** - * Loads a keyStore without knowing the keyStore type - * @param in input stream - * @param password Password protecting the keyStore - * @return keyStore loaded - * @throws KeyStoreException thrown if keyStore cannot be loaded - * @throws FileNotFoundException - * @throws IOException - */ -public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException{ - is.mark(1024*1024); - KeyStore ks = null; - try { - try { - ks = loadKeyStore(KEYSTORE_TYPE_PKCS12, is, password); - } catch (IOException e2) { - is.reset(); - ks = loadKeyStore(KEYSTORE_TYPE_JKS, is, password); - } - } catch(Exception e) { - e.printStackTrace(); - //throw new KeyStoreException(e); - } - return ks; - - } - - + /** + * Loads a keyStore without knowing the keyStore type + * + * @param keyStorePath URL to the keyStore + * @param password Password protecting the keyStore + * @return keyStore loaded + * @throws KeyStoreException thrown if keyStore cannot be loaded + * @throws FileNotFoundException + * @throws IOException + */ + public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, + IOException { + + // InputStream is = new FileInputStream(keyStorePath); + final URL keystoreURL = new URL(keyStorePath); + final InputStream in = keystoreURL.openStream(); + final InputStream isBuffered = new BufferedInputStream(in); + return loadKeyStore(isBuffered, password); + + } + + /** + * Loads a keyStore without knowing the keyStore type + * + * @param in input stream + * @param password Password protecting the keyStore + * @return keyStore loaded + * @throws KeyStoreException thrown if keyStore cannot be loaded + * @throws FileNotFoundException + * @throws IOException + */ + public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException { + is.mark(1024 * 1024); + KeyStore ks = null; + try { + try { + ks = loadKeyStore(KEYSTORE_TYPE_PKCS12, is, password); + } catch (final IOException e2) { + is.reset(); + ks = loadKeyStore(KEYSTORE_TYPE_JKS, is, password); + } + } catch (final Exception e) { + e.printStackTrace(); + // throw new KeyStoreException(e); + } + return ks; + + } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java index 3dde827..9d1f01f 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOADefaultHandler.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.IOException; @@ -36,15 +35,15 @@ import org.xml.sax.helpers.DefaultHandler; /** * A <code>DefaultHandler</code> that uses a <code>MOAEntityResolver</code> and * a <code>MOAErrorHandler</code>. - * + * * @author Patrick Peck * @version $Id$ */ public class MOADefaultHandler extends DefaultHandler { /** The <code>EntityResolver</code> to use. */ - private EntityResolver entityResolver; + private final EntityResolver entityResolver; /** The <code>ErrorHandler</code> to use. */ - private ErrorHandler errorHandler; + private final ErrorHandler errorHandler; /** * Create a new <code>MOADefaultHandler</code>. @@ -56,28 +55,30 @@ public class MOADefaultHandler extends DefaultHandler { /** * Create a new <code>MOADefaultHandler</code>. - * + * * @param entityResolver The <code>EntityResolver</code> to use for resolving - * external entities. - * @param errorHandler The <code>ErrorHandler</code> to use for reporting - * parsing errors. + * external entities. + * @param errorHandler The <code>ErrorHandler</code> to use for reporting + * parsing errors. */ public MOADefaultHandler( - EntityResolver entityResolver, - ErrorHandler errorHandler) { + EntityResolver entityResolver, + ErrorHandler errorHandler) { this.entityResolver = entityResolver; this.errorHandler = errorHandler; } /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, + * java.lang.String) */ + @Override public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { + throws SAXException { try { return entityResolver.resolveEntity(publicId, systemId); - } catch (IOException e) { + } catch (final IOException e) { return null; } } @@ -85,6 +86,7 @@ public class MOADefaultHandler extends DefaultHandler { /** * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) */ + @Override public void warning(SAXParseException exception) throws SAXException { errorHandler.warning(exception); } @@ -92,6 +94,7 @@ public class MOADefaultHandler extends DefaultHandler { /** * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) */ + @Override public void error(SAXParseException exception) throws SAXException { errorHandler.error(exception); } @@ -99,6 +102,7 @@ public class MOADefaultHandler extends DefaultHandler { /** * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) */ + @Override public void fatalError(SAXParseException exception) throws SAXException { errorHandler.fatalError(exception); } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java index 7f529ca..d7c6a5b 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.InputStream; @@ -35,18 +34,20 @@ import at.gv.egovernment.moaspss.logging.LogMsg; import at.gv.egovernment.moaspss.logging.Logger; /** - * An <code>EntityResolver</code> that looks up entities stored as - * local resources. - * - * <p>The following DTDs are mapped to local resources: + * An <code>EntityResolver</code> that looks up entities stored as local + * resources. + * + * <p> + * The following DTDs are mapped to local resources: * <ul> * <li>The XMLSchema.dtd</li> * <li>The datatypes.dtd</li> * </ul> * </p> - * <p>For all other resources, an attempt is made to resolve them as resources, + * <p> + * For all other resources, an attempt is made to resolve them as resources, * either absolute or relative to <code>Constants.SCHEMA_ROOT</code>. - * + * * @author Patrick Peck * @author Sven Aigner */ @@ -54,56 +55,58 @@ public class MOAEntityResolver implements EntityResolver { /** * Resolve an entity. - * + * * The <code>systemId</code> parameter is used to perform the lookup of the - * entity as a resource, either by interpreting the <code>systemId</code> as - * an absolute resource path, or by appending the last path component of + * entity as a resource, either by interpreting the <code>systemId</code> as an + * absolute resource path, or by appending the last path component of * <code>systemId</code> to <code>Constants.SCHEMA_ROOT</code>. - * + * * @param publicId The public ID of the resource. * @param systemId The system ID of the resource. * @return An <code>InputSource</code> from which the entity can be read, or - * <code>null</code>, if the entity could not be found. - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + * <code>null</code>, if the entity could not be found. + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, + * java.lang.String) */ + @Override public InputSource resolveEntity(String publicId, String systemId) { InputStream stream; int slashPos; if (Logger.isDebugEnabled()) { Logger.debug( - new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); + new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); } if (publicId != null) { // check if we can resolve some standard dtd's if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "XMLSchema.dtd")); + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "XMLSchema.dtd")); } else if (publicId.equalsIgnoreCase("datatypes")) { return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "datatypes.dtd")); + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "datatypes.dtd")); } } else if (systemId != null) { // get the URI path try { - URI uri = new URI(systemId); + final URI uri = new URI(systemId); systemId = uri.getPath(); - + if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { return null; } - - } catch (MalformedURIException e) { + + } catch (final MalformedURIException e) { return null; } - + // try to get the resource from the full path stream = getClass().getResourceAsStream(systemId); if (stream != null) { - InputSource source = new InputSource(stream); + final InputSource source = new InputSource(stream); source.setSystemId(systemId); return source; @@ -114,9 +117,9 @@ public class MOAEntityResolver implements EntityResolver { if (slashPos >= 0 && systemId.length() > slashPos) { systemId = systemId.substring(slashPos + 1, systemId.length()); stream = - getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); + getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); if (stream != null) { - InputSource source = new InputSource(stream); + final InputSource source = new InputSource(stream); source.setSystemId(systemId); return source; diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java index 1842d03..f4acabf 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import org.apache.xml.utils.DefaultErrorHandler; @@ -35,42 +34,48 @@ import at.gv.egovernment.moaspss.logging.Logger; * An <code>ErrorHandler</code> that logs a message and throws a * <code>SAXException</code> upon <code>error</code> and <code>fatal</code> * parsing errors. - * + * * @author Patrick Peck * @author Sven Aigner */ public class MOAErrorHandler extends DefaultErrorHandler { - /** * Logs a warning message. - * + * * @see org.xml.sax.ErrorHandler#warning(SAXParseException) */ + @Override public void warning(SAXParseException exception) throws SAXException { warn("parser.00", messageParams(exception), null); } /** * Logs a warning and rethrows the <code>exception</code>. - * + * * @see org.xml.sax.ErrorHandler#error(SAXParseException) */ + @Override public void error(SAXParseException exception) throws SAXException { - warn("parser.01", messageParams(exception), null); - - // if Target attribute is missing in QualifyingProperties - don't throw exception (bug fix for old MOCCA signatures) - if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) - warn("parser.04", new Object[] {"Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons."}, null); - else - throw exception; + warn("parser.01", messageParams(exception), null); + + // if Target attribute is missing in QualifyingProperties - don't throw + // exception (bug fix for old MOCCA signatures) + if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) { + warn("parser.04", new Object[] { + "Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons." }, + null); + } else { + throw exception; + } } /** * Logs a warning and rethrows the <code>exception</code>. - * + * * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) */ + @Override public void fatalError(SAXParseException exception) throws SAXException { warn("parser.02", messageParams(exception), null); throw exception; @@ -78,38 +83,38 @@ public class MOAErrorHandler extends DefaultErrorHandler { /** * Log a warning message. - * - * @param messageId The message ID to log. + * + * @param messageId The message ID to log. * @param parameters Additional message parameters. - * @param t The <code>Throwable</code> to log; usually the cause of this - * warning. + * @param t The <code>Throwable</code> to log; usually the cause of + * this warning. */ private static void warn( - String messageId, - Object[] parameters, - Throwable t) { + String messageId, + Object[] parameters, + Throwable t) { - MessageProvider msg = MessageProvider.getInstance(); + final MessageProvider msg = MessageProvider.getInstance(); Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); } /** - * Put the system id, line and column number information from the exception - * into an <code>Object</code> array, to provide it as a - * <code>MessageFormat</code> parameter. - * - * @param e The <code>SAXParseException</code> containing the - * source system id and line/column numbers. - * @return An array containing the system id (a <code>String</code>) as well - * as line/column numbers (2 <code>Integer</code> objects) from the - * <code>SAXParseException</code>. + * Put the system id, line and column number information from the exception into + * an <code>Object</code> array, to provide it as a <code>MessageFormat</code> + * parameter. + * + * @param e The <code>SAXParseException</code> containing the source system id + * and line/column numbers. + * @return An array containing the system id (a <code>String</code>) as well as + * line/column numbers (2 <code>Integer</code> objects) from the + * <code>SAXParseException</code>. */ private static Object[] messageParams(SAXParseException e) { return new Object[] { - e.getMessage(), - e.getSystemId(), - new Integer(e.getLineNumber()), - new Integer(e.getColumnNumber())}; + e.getMessage(), + e.getSystemId(), + new Integer(e.getLineNumber()), + new Integer(e.getColumnNumber()) }; } }
\ No newline at end of file diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java index 8542b58..591495a 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOATimer.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.Map; @@ -29,7 +28,7 @@ import java.util.WeakHashMap; /** * A timer utility for named timers. - * + * * @author Sven Aigner */ public class MOATimer { @@ -43,7 +42,7 @@ public class MOATimer { /** * Return the single instance of this class. - * + * * @return The single instance of this class. */ public static MOATimer getInstance() { @@ -55,7 +54,7 @@ public class MOATimer { /** * Create a new <code>MOATimer</code>. - * + * * Protected to disallow multiple instances. */ protected MOATimer() { @@ -64,10 +63,10 @@ public class MOATimer { /** * Start timing a certain action. - * + * * The timing belonging to the action ID is garbage collected as soon as there * exists no other reference to the action ID. - * + * * @param id The action ID. */ public void startTiming(Object id) { @@ -76,7 +75,7 @@ public class MOATimer { /** * Stop timing an action. - * + * * @param id The action ID. */ public void stopTiming(Object id) { @@ -85,50 +84,53 @@ public class MOATimer { /** * Get the duration of an action. - * + * * @param id The action ID for which to compute the duration. * @return long The duration in milliseconds between calls to - * <code>startTiming()</code> and <code>stopTiming()</code>. If - * only <code>startTiming()</code> has been called for the action, then - * current difference to the system time is returned. If no timing exists for - * the action, <code>- 1</code> is returned. + * <code>startTiming()</code> and <code>stopTiming()</code>. If only + * <code>startTiming()</code> has been called for the action, then + * current difference to the system time is returned. If no timing + * exists for the action, <code>- 1</code> is returned. */ public long duration(Object id) { if (timemapstart.containsKey(id)) { - long start = ((Long) timemapstart.get(id)).longValue(); + final long start = ((Long) timemapstart.get(id)).longValue(); if (timemapend.containsKey(id)) { - long end = ((Long) timemapend.get(id)).longValue(); + final long end = ((Long) timemapend.get(id)).longValue(); return end - start; } else { return System.currentTimeMillis() - start; } - } else + } else { return -1; + } } /** * Get the duration of an action, as a nicely formatted <code>String</code>. - * + * * @param id The action ID. * @return String The <code>duration()</code> as a <code>String</code>. */ public String durationAsString(Object id) { - long dur = duration(id); - long second = dur / 1000; - long mil = (dur) - (second * 1000); + final long dur = duration(id); + final long second = dur / 1000; + final long mil = dur - second * 1000; return "Duration: " + second + "." + mil + " seconds"; } /** * Remove a timing. - * + * * @param id The action ID. */ public void clearTiming(String id) { - if (timemapstart.containsKey(id)) + if (timemapstart.containsKey(id)) { timemapstart.remove(id); - if (timemapend.containsKey(id)) + } + if (timemapend.containsKey(id)) { timemapend.remove(id); + } } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java index da97ea1..163e903 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MessageProvider.java @@ -21,53 +21,52 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.Locale; /** * A singleton wrapper around a <code>Message</code> object. - * + * * Provides the messages used in the common project. - * + * * @author Patrick Peck * @version $Id$ */ public class MessageProvider { /** The location of the default message resources. */ private static final String[] DEFAULT_MESSAGE_RESOURCES = - { "resources/properties/common_messages" }; + { "resources/properties/common_messages" }; /** The locale of the default message resources. */ private static final Locale[] DEFAULT_MESSAGE_LOCALES = - new Locale[] { new Locale("de", "AT") }; + new Locale[] { new Locale("de", "AT") }; /** The single instance of this class. */ private static MessageProvider instance; - + /** The messages provided by this <code>MessageProvider</code>. */ - private Messages messages; - + private final Messages messages; + /** * Return the single instance of the <code>MessageProvider</code>. - * + * * Intialilizes the <code>MessageProvider</code> with the default message * locations: <code>/resources/properties/common_messages</code>. - * + * * @return The single <code>MessageProvider</code>. */ public static synchronized MessageProvider getInstance() { if (instance == null) { instance = - new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); + new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); } return instance; } /** * Create a <code>MessageProvider</code>. - * + * * @param resourceNames The names of the resources containing the messages. - * @param locales The corresponding locales. + * @param locales The corresponding locales. */ protected MessageProvider(String[] resourceNames, Locale[] locales) { this.messages = new Messages(resourceNames, locales); @@ -76,9 +75,9 @@ public class MessageProvider { /** * Get the message corresponding to a given message ID. * - * @param messageId The ID of the message. + * @param messageId The ID of the message. * @param parameters The parameters to fill in into the message arguments. - * @return The formatted message. + * @return The formatted message. */ public String getMessage(String messageId, Object[] parameters) { return messages.getMessage(messageId, parameters); diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java index 6e324b7..61d9b65 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Messages.java @@ -21,47 +21,46 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; import at.gv.egovernment.moaspss.logging.Logger; /** * Provides access to the system messages resource used for exception handling * and logging messages. - * + * * Messages must be provided as a resource bundle at the path. - * + * * @author Patrick Peck * @version $Id$ */ public class Messages { /** Error message indicating that no messages are avaiable. */ private static final String ERROR_MESSAGES_UNAVAILABLE = - "Fehler in der Server-Konfiguration. " - + "Die Fehlertexte konnten nicht geladen werden."; + "Fehler in der Server-Konfiguration. " + + "Die Fehlertexte konnten nicht geladen werden."; /** Error message indicating that the message is not available. */ private static final String ERROR_NO_MESSAGE = - "No errormesseage for error with number.={0}"; + "No errormesseage for error with number.={0}"; /** The names of the resources containing the messages. */ - private String[] resourceNames; + private final String[] resourceNames; /** The corresponding <code>Locale</code>s of the resources. */ - private Locale[] locales; + private final Locale[] locales; /** The <code>ResourceBundle</code>s containing the messages. */ private ResourceBundleChain messages; /** - * Create a new <code>Message</code> object containing the messages - * in the given resources. - * + * Create a new <code>Message</code> object containing the messages in the given + * resources. + * * @param resourceNames The names of the resources containing the messages. - * @param locales The corresponding locales. + * @param locales The corresponding locales. */ public Messages(String[] resourceNames, Locale[] locales) { this.resourceNames = resourceNames; @@ -72,9 +71,9 @@ public class Messages { /** * Get the message corresponding to a given message ID. * - * @param messageId The ID of the message. + * @param messageId The ID of the message. * @param parameters The parameters to fill in into the message arguments. - * @return The formatted message. + * @return The formatted message. */ public String getMessage(String messageId, Object[] parameters) { // initialize messages @@ -87,20 +86,20 @@ public class Messages { return ERROR_MESSAGES_UNAVAILABLE; } else { try { - String rawMessage = messages.getString(messageId); + final String rawMessage = messages.getString(messageId); return MessageFormat.format(rawMessage, parameters); - } catch (MissingResourceException e2) { - // couldn't find any message -> set to default error message + } catch (final MissingResourceException e2) { + // couldn't find any message -> set to default error message return MessageFormat.format( - ERROR_NO_MESSAGE, - new Object[] { messageId }); + ERROR_NO_MESSAGE, + new Object[] { messageId }); } } } /** * Return the names of the resources containing the messages. - * + * * @return String[] The names of the resource bundles containing the messages. */ private String[] getResourceNames() { @@ -109,9 +108,9 @@ public class Messages { /** * Return the <code>Locale</code>s of the resources containing the messages. - * - * @return Locale[] The <code>Locale</code>s of the resource bundles - * containing the messages. + * + * @return Locale[] The <code>Locale</code>s of the resource bundles containing + * the messages. */ private Locale[] getLocales() { return locales; @@ -129,10 +128,10 @@ public class Messages { for (i = 0; i < resourceNames.length; i++) { try { messages.addResourceBundle( - PropertyResourceBundle.getBundle( - getResourceNames()[i], - getLocales()[i])); - } catch (MissingResourceException e) { + ResourceBundle.getBundle( + getResourceNames()[i], + getLocales()[i])); + } catch (final MissingResourceException e) { Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java index 5510ac8..d2431e4 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MiscUtil.java @@ -1,13 +1,13 @@ /* * Copyright 2011 Federal Chancellery Austria and * Graz University of Technology - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,7 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.GregorianCalendar; @@ -44,91 +45,89 @@ import javax.xml.transform.stream.StreamResult; import at.gv.egovernment.moaspss.logging.Logger; import at.gv.egovernment.moaspss.util.ex.EgovUtilException; - - /** * Class providing several utility methods. - * + * * @author <a href="mailto:Arne.Tauber@egiz.gv.at">Arne Tauber</a> - * + * */ public class MiscUtil { - public static final String DEFAULT_SLASH = "/"; - - private static final int IO_BUFFER_SIZE = 4 * 1024; - - public static void copyStream(InputStream is, OutputStream os) throws IOException { - byte[] b = new byte[IO_BUFFER_SIZE]; - int read; - while ((read = is.read(b)) != -1) { - os.write(b, 0, read); - } - } - - public static void assertNotNull(Object param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - } - - public static boolean areAllNull(Object... objects) { - for (Object o : objects) { - if (o != null) { - return false; - } - } - return true; - } - - public static String extractContentType(String contentTypeString) { - if (contentTypeString == null) { - return ""; - } - if (contentTypeString.indexOf(";") != -1) { - return contentTypeString.substring(0, contentTypeString.indexOf(";")); - } - return contentTypeString; - } - - public static XMLGregorianCalendar getXMLGregorianCalendar(Date date) - throws DatatypeConfigurationException { - GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); - cal.setTime(date); - return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); - } - - public static XMLGregorianCalendar getXMLGregorianCalendar(String str) - throws DatatypeConfigurationException { - return DatatypeFactory.newInstance().newXMLGregorianCalendar(str); - } - - public static X509Certificate readCertificate(InputStream certStream) - throws CertificateException { - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - return (X509Certificate) cf.generateCertificate(certStream); - } - - public static boolean isEmpty(String str) { - return str == null || "".equals(str); - } - - public static boolean isNotEmpty(String str) { - return str != null && !"".equals(str); - } - - public static byte[] sourceToByteArray(Source result) - throws TransformerException { - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - StreamResult streamResult = new StreamResult(); - streamResult.setOutputStream(out); - transformer.transform(result, streamResult); - return out.toByteArray(); - } + public static final String DEFAULT_SLASH = "/"; + + private static final int IO_BUFFER_SIZE = 4 * 1024; + + public static void copyStream(InputStream is, OutputStream os) throws IOException { + final byte[] b = new byte[IO_BUFFER_SIZE]; + int read; + while ((read = is.read(b)) != -1) { + os.write(b, 0, read); + } + } + + public static void assertNotNull(Object param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + } + + public static boolean areAllNull(Object... objects) { + for (final Object o : objects) { + if (o != null) { + return false; + } + } + return true; + } + + public static String extractContentType(String contentTypeString) { + if (contentTypeString == null) { + return ""; + } + if (contentTypeString.indexOf(";") != -1) { + return contentTypeString.substring(0, contentTypeString.indexOf(";")); + } + return contentTypeString; + } + + public static XMLGregorianCalendar getXMLGregorianCalendar(Date date) + throws DatatypeConfigurationException { + final GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance(); + cal.setTime(date); + return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); + } + + public static XMLGregorianCalendar getXMLGregorianCalendar(String str) + throws DatatypeConfigurationException { + return DatatypeFactory.newInstance().newXMLGregorianCalendar(str); + } + + public static X509Certificate readCertificate(InputStream certStream) + throws CertificateException { + final CertificateFactory cf = CertificateFactory.getInstance("X.509"); + return (X509Certificate) cf.generateCertificate(certStream); + } + + public static boolean isEmpty(String str) { + return str == null || "".equals(str); + } + + public static boolean isNotEmpty(String str) { + return str != null && !"".equals(str); + } + + public static byte[] sourceToByteArray(Source result) + throws TransformerException { + final TransformerFactory factory = TransformerFactory.newInstance(); + final Transformer transformer = factory.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + final StreamResult streamResult = new StreamResult(); + streamResult.setOutputStream(out); + transformer.transform(result, streamResult); + return out.toByteArray(); + } // public static Document parseDocument(InputStream inputStream) // throws IOException { @@ -145,159 +144,159 @@ public class MiscUtil { // } // } - public static String removePrecedingSlash(String path, String slash) { - assertNotEmpty(slash, "Shash"); - if (!isEmpty(path)) { - while (path.startsWith(slash)) { - path = path.substring(slash.length(), path.length()); - } - } - return path; - } - - public static String removePrecedingSlash(String path) { - return removePrecedingSlash(path, DEFAULT_SLASH); - } - - public static void assertNotEmpty(String param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length() == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - @SuppressWarnings("rawtypes") + public static String removePrecedingSlash(String path, String slash) { + assertNotEmpty(slash, "Shash"); + if (!isEmpty(path)) { + while (path.startsWith(slash)) { + path = path.substring(slash.length(), path.length()); + } + } + return path; + } + + public static String removePrecedingSlash(String path) { + return removePrecedingSlash(path, DEFAULT_SLASH); + } + + public static void assertNotEmpty(String param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length() == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + @SuppressWarnings("rawtypes") public static boolean isEmpty(Properties props) { - if (props == null || props.isEmpty()) { - return true; - } - Iterator it = props.values().iterator(); - while (it.hasNext()) { - if (MiscUtil.isNotEmpty((String) it.next())) { - return false; - } - } - return true; - } - - public static boolean isEmpty(Empty empty) { - return empty == null || empty.isEmpty(); - } - - public static boolean isNotEmpty(Empty empty) { - return !isEmpty(empty); - } - - public static boolean isEmpty(byte[] data) { - return data == null || data.length == 0; - } - - public static boolean isNotEmpty(byte[] data) { - return !isEmpty(data); - } - - public static <T> boolean isEmpty(Collection<T> c) { - return c == null || c.isEmpty(); - } - - public static <T> boolean isNotEmpty(Collection<T> c) { - return !isEmpty(c); - } - - public static boolean areAllEmpty(String... strings) { - for (String s : strings) { - if (s != null && s.trim().length() != 0) { - return false; - } - } - return true; - } - - public static boolean areAllEmpty(Empty... empties) { - if (empties != null) { - for (Empty e : empties) { - if (e != null && !e.isEmpty()) { - return false; - } - } - } - return true; - } - - public static <T> void assertNotEmpty(T[] param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static void assertNotEmpty(Empty empty, String name) { - if (empty == null) { - throw new NullPointerException(name + " must not be null."); - } - if (empty.isEmpty()) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static void assertNotEmpty(byte[] param, String name) { - if (param == null) { - throw new NullPointerException(name + " must not be null."); - } - if (param.length == 0) { - throw new IllegalArgumentException(name + " must not be empty."); - } - } - - public static Date parseXMLDate(String xmlDate) throws EgovUtilException { - if (xmlDate == null) { - return null; - } - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - return sdf.parse(xmlDate); - } catch (ParseException e) { - throw new EgovUtilException(e); - } - } - - public static <T> boolean isEmpty(T[] array) { - return array == null || array.length == 0; - } - - public static <T> boolean isNotEmpty(T[] array) { - return !isEmpty(array); - } - - public static String convertDateFromStandardToXML(String dateString) { - MiscUtil.assertNotNull(dateString, "dateString"); - Date date = parseDate(dateString); - return formatDate(date, "yyyy-MM-dd"); - } - - public static Date parseDate(String dateString) { - return parseDate(dateString, "dd.MM.yyyy"); - } - - public static Date parseDate(String dateString, String pattern) { - MiscUtil.assertNotNull(dateString, "dateString"); - MiscUtil.assertNotNull(pattern, "pattern"); - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - try { - return sdf.parse(dateString); - } catch (ParseException e) { - Logger.warn("Error parsing date.", e); - return null; + if (props == null || props.isEmpty()) { + return true; } - } - - public static String formatDate(Date date, String format) { - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(date); - } - + final Iterator it = props.values().iterator(); + while (it.hasNext()) { + if (MiscUtil.isNotEmpty((String) it.next())) { + return false; + } + } + return true; + } + + public static boolean isEmpty(Empty empty) { + return empty == null || empty.isEmpty(); + } + + public static boolean isNotEmpty(Empty empty) { + return !isEmpty(empty); + } + + public static boolean isEmpty(byte[] data) { + return data == null || data.length == 0; + } + + public static boolean isNotEmpty(byte[] data) { + return !isEmpty(data); + } + + public static <T> boolean isEmpty(Collection<T> c) { + return c == null || c.isEmpty(); + } + + public static <T> boolean isNotEmpty(Collection<T> c) { + return !isEmpty(c); + } + + public static boolean areAllEmpty(String... strings) { + for (final String s : strings) { + if (s != null && s.trim().length() != 0) { + return false; + } + } + return true; + } + + public static boolean areAllEmpty(Empty... empties) { + if (empties != null) { + for (final Empty e : empties) { + if (e != null && !e.isEmpty()) { + return false; + } + } + } + return true; + } + + public static <T> void assertNotEmpty(T[] param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static void assertNotEmpty(Empty empty, String name) { + if (empty == null) { + throw new NullPointerException(name + " must not be null."); + } + if (empty.isEmpty()) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static void assertNotEmpty(byte[] param, String name) { + if (param == null) { + throw new NullPointerException(name + " must not be null."); + } + if (param.length == 0) { + throw new IllegalArgumentException(name + " must not be empty."); + } + } + + public static Date parseXMLDate(String xmlDate) throws EgovUtilException { + if (xmlDate == null) { + return null; + } + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + return sdf.parse(xmlDate); + } catch (final ParseException e) { + throw new EgovUtilException(e); + } + } + + public static <T> boolean isEmpty(T[] array) { + return array == null || array.length == 0; + } + + public static <T> boolean isNotEmpty(T[] array) { + return !isEmpty(array); + } + + public static String convertDateFromStandardToXML(String dateString) { + MiscUtil.assertNotNull(dateString, "dateString"); + final Date date = parseDate(dateString); + return formatDate(date, "yyyy-MM-dd"); + } + + public static Date parseDate(String dateString) { + return parseDate(dateString, "dd.MM.yyyy"); + } + + public static Date parseDate(String dateString, String pattern) { + MiscUtil.assertNotNull(dateString, "dateString"); + MiscUtil.assertNotNull(pattern, "pattern"); + final SimpleDateFormat sdf = new SimpleDateFormat(pattern); + try { + return sdf.parse(dateString); + } catch (final ParseException e) { + Logger.warn("Error parsing date.", e); + return null; + } + } + + public static String formatDate(Date date, String format) { + final SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java index 998edb4..66907d2 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeIteratorAdapter.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.ListIterator; @@ -34,20 +33,21 @@ import org.w3c.dom.traversal.NodeIterator; /** * A <code>NodeIterator</code> implementation based on a * <code>ListIterator</code>. - * + * * @see java.util.ListIterator * @see org.w3c.dom.traversal.NodeIterator - * + * * @author Patrick Peck * @version $Id$ */ public class NodeIteratorAdapter implements NodeIterator { /** The <code>ListIterator</code> to wrap. */ - private ListIterator nodeIterator; + private final ListIterator nodeIterator; /** * Create a new <code>NodeIteratorAdapter</code>. + * * @param nodeIterator The <code>ListIterator</code> to iterate over. */ public NodeIteratorAdapter(ListIterator nodeIterator) { @@ -57,6 +57,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#getRoot() */ + @Override public Node getRoot() { return null; } @@ -64,6 +65,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() */ + @Override public int getWhatToShow() { return NodeFilter.SHOW_ALL; } @@ -71,6 +73,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#getFilter() */ + @Override public NodeFilter getFilter() { return null; } @@ -78,6 +81,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() */ + @Override public boolean getExpandEntityReferences() { return false; } @@ -85,6 +89,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#nextNode() */ + @Override public Node nextNode() throws DOMException { if (nodeIterator.hasNext()) { return (Node) nodeIterator.next(); @@ -95,6 +100,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#previousNode() */ + @Override public Node previousNode() throws DOMException { if (nodeIterator.hasPrevious()) { return (Node) nodeIterator.previous(); @@ -105,6 +111,7 @@ public class NodeIteratorAdapter implements NodeIterator { /** * @see org.w3c.dom.traversal.NodeIterator#detach() */ + @Override public void detach() { } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java index d88ef4b..d569516 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/NodeListAdapter.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.List; @@ -31,21 +30,21 @@ import org.w3c.dom.NodeList; /** * A <code>NodeList</code> implementation based on a <code>List</code>. - * + * * @see java.util.List * @see org.w3c.dom.NodeList - * + * * @author Patrick Peck * @version $Id$ */ public class NodeListAdapter implements NodeList { /** The <code>List</code> to wrap. */ - private List nodeList; - + private final List nodeList; + /** * Create a new <code>NodeListAdapter</code>. - * - * @param nodeList The <code>List</code> containing the nodes. + * + * @param nodeList The <code>List</code> containing the nodes. */ public NodeListAdapter(List nodeList) { this.nodeList = nodeList; @@ -54,6 +53,7 @@ public class NodeListAdapter implements NodeList { /** * @see org.w3c.dom.NodeList#item(int) */ + @Override public Node item(int index) { return (Node) nodeList.get(index); } @@ -61,6 +61,7 @@ public class NodeListAdapter implements NodeList { /** * @see org.w3c.dom.NodeList#getLength() */ + @Override public int getLength() { return nodeList.size(); } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java index e4e6cc5..6ce951d 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/OutputXML2File.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - /* * Created on 26.04.2004 * @@ -36,67 +35,70 @@ import at.gv.egovernment.moaspss.logging.Logger; /** * utility functions to write XML data to files + * * @author rschamberger * @version $Id$ */ public class OutputXML2File { - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, rootElem); - } - } - - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, xmlString); - } - } + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: + * UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, rootElem); + } + } + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: + * UTF-8) + * + * @param filename file name + * @param xmlString XML string + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, xmlString); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + */ + public static void outputXML2File(String filename, Element rootElem) { + try { + final String xmlString = new String(DOMUtils.serializeNode(rootElem)); + outputXML2File(filename, xmlString); + } catch (final Exception ex) { + ex.printStackTrace(); + } + } - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - */ - public static void outputXML2File(String filename, Element rootElem) { - try { - String xmlString = new String(DOMUtils.serializeNode(rootElem)); - outputXML2File(filename, xmlString); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - */ - public static void outputXML2File(String filename, String xmlString) { - try { - java.io.OutputStream fout = new java.io.FileOutputStream(filename); - byte[] xmlData = xmlString.getBytes("UTF-8"); - fout.write(xmlData); - fout.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + */ + public static void outputXML2File(String filename, String xmlString) { + try { + final java.io.OutputStream fout = new java.io.FileOutputStream(filename); + final byte[] xmlData = xmlString.getBytes("UTF-8"); + fout.write(xmlData); + fout.close(); + } catch (final Exception ex) { + ex.printStackTrace(); + } + } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java index 1edad95..a5c7ecc 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ResourceBundleChain.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.ArrayList; @@ -32,7 +31,7 @@ import java.util.ResourceBundle; /** * A class to chain <code>ResourceBundle</code>s. - * + * * @author Patrick Peck * @version $Id$ */ @@ -40,11 +39,11 @@ public class ResourceBundleChain { /** Error message indicating the resource is not available. */ private static final String ERROR_MISSING_RESOURCE = "Missing resource"; /** The <code>ResourceBundle</code>s contained in this chain. */ - private List resourceBundles = new ArrayList(); + private final List resourceBundles = new ArrayList(); /** * Add a <code>ResourceBundle</code> to the chain. - * + * * @param resourceBundle The <code>ResourceBundle</code> to add. */ public void addResourceBundle(ResourceBundle resourceBundle) { @@ -53,13 +52,13 @@ public class ResourceBundleChain { /** * Return the value of the resource. - * + * * @param key The key to access the <code>String</code> resource. * @return The resource value. All the registered <code>ResourceBundle</code>s - * are searched in the order in which they have previously been added to this - * <code>ResourceBundleChain</code>. + * are searched in the order in which they have previously been added to + * this <code>ResourceBundleChain</code>. * @throws MissingResourceException The resource coult not be found in any of - * the bundles. + * the bundles. */ public String getString(String key) throws MissingResourceException { MissingResourceException lastException = null; @@ -68,19 +67,19 @@ public class ResourceBundleChain { // handle case where no resource bundles have been added if (resourceBundles.size() == 0) { throw new MissingResourceException( - ERROR_MISSING_RESOURCE, - this.getClass().getName(), - key); + ERROR_MISSING_RESOURCE, + this.getClass().getName(), + key); } // try to find the resource in one of the bundles; if it cannot be found, // return the exception thrown by the last bundle in the list for (iter = resourceBundles.iterator(); iter.hasNext();) { - ResourceBundle resourceBundle = (ResourceBundle) iter.next(); + final ResourceBundle resourceBundle = (ResourceBundle) iter.next(); try { - String value = resourceBundle.getString(key); + final String value = resourceBundle.getString(key); return value; - } catch (MissingResourceException e) { + } catch (final MissingResourceException e) { lastException = e; } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java index 5078f01..d2d63cb 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/SSLUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.IOException; @@ -38,207 +37,239 @@ import javax.net.ssl.TrustManagerFactory; /** * Utility for connecting to server applications via SSL. - * + * * @author Paul Ivancsics * @version $Id$ */ public class SSLUtils { - - /** - * Creates an <code>SSLSocketFactory</code> which utilizes the given trust store. - * - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if <code>null</code>, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return <code>SSLSocketFactory</code> to be used by an <code>HttpsURLConnection</code> - * @throws IOException thrown while reading from the input stream + + /** + * Creates an <code>SSLSocketFactory</code> which utilizes the given trust + * store. + * + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store + * containing trusted server certificates; if + * <code>null</code>, the default trust store will + * be utilized + * @param trustStorePassword if provided, it will be used to check the + * integrity of the trust store; if omitted, it + * will not be checked + * @return <code>SSLSocketFactory</code> to be used by an + * <code>HttpsURLConnection</code> + * @throws IOException thrown while reading from the input stream * @throws GeneralSecurityException thrown while creating the socket factory - */ + */ public static SSLSocketFactory getSSLSocketFactory( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(null, tms, null); - - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + final TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); + final SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(null, tms, null); + + final SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; } - /** - * Creates an <code>SSLSocketFactory</code> which utilizes the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if <code>null</code>, the default trust store will be utilized - * @param clientKeyStoreType key store type of <code>clientKeyStore</code> - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if <code>null</code>, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return <code>SSLSocketFactory</code> to be used by an <code>HttpsURLConnection</code> - * @throws IOException thrown while reading key store file + + /** + * Creates an <code>SSLSocketFactory</code> which utilizes the given trust store + * and keystore. + * + * @param trustStore trust store containing trusted server + * certificates; if <code>null</code>, the default + * trust store will be utilized + * @param clientKeyStoreType key store type of <code>clientKeyStore</code> + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if <code>null</code>, + * the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check the + * integrity of the client key store; if omitted, + * it will not be checked + * @return <code>SSLSocketFactory</code> to be used by an + * <code>HttpsURLConnection</code> + * @throws IOException thrown while reading key store file * @throws GeneralSecurityException thrown while creating the socket factory - */ + */ public static SSLSocketFactory getSSLSocketFactory( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - SSLContext ctx = getSSLContext( - trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + final SSLContext ctx = getSSLContext( + trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + final SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; } - /** - * Creates an <code>SSLContext</code> initialized for the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if <code>null</code>, the default trust store will be utilized - * @param clientKeyStoreType key store type of <code>clientKeyStore</code> - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if <code>null</code>, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return <code>SSLContext</code> to be used for creating an <code>SSLSocketFactory</code> - * @throws IOException thrown while reading key store file + + /** + * Creates an <code>SSLContext</code> initialized for the given trust store and + * keystore. + * + * @param trustStore trust store containing trusted server + * certificates; if <code>null</code>, the default + * trust store will be utilized + * @param clientKeyStoreType key store type of <code>clientKeyStore</code> + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if <code>null</code>, + * the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check the + * integrity of the client key store; if omitted, + * it will not be checked + * @return <code>SSLContext</code> to be used for creating an + * <code>SSLSocketFactory</code> + * @throws IOException thrown while reading key store file * @throws GeneralSecurityException thrown while creating the SSL context - */ + */ public static SSLContext getSSLContext( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - TrustManager[] tms = getTrustManagers(trustStore); - KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(kms, tms, null); - return ctx; + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + final TrustManager[] tms = getTrustManagers(trustStore); + final KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + final SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(kms, tms, null); + return ctx; } + /** - * Loads the trust store from an input stream and gets the + * Loads the trust store from an input stream and gets the * <code>TrustManager</code>s from a default <code>TrustManagerFactory</code>, - * initialized from the given trust store. - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if <code>null</code>, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return <code>TrustManager</code>s to be used for creating an - * <code>SSLSocketFactory</code> utilizing the given trust store - * @throws IOException thrown while reading from the input stream - * @throws GeneralSecurityException thrown while initializing the - * default <code>TrustManagerFactory</code> + * initialized from the given trust store. + * + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store + * containing trusted server certificates; if + * <code>null</code>, the default trust store will + * be utilized + * @param trustStorePassword if provided, it will be used to check the + * integrity of the trust store; if omitted, it + * will not be checked + * @return <code>TrustManager</code>s to be used for creating an + * <code>SSLSocketFactory</code> utilizing the given trust store + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while initializing the default + * <code>TrustManagerFactory</code> */ - protected static TrustManager[] getTrustManagers( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - if (trustStoreInputStream == null) - return null; - - // Set up the TrustStore to use. We need to load the file into - // a KeyStore instance. - KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); - return getTrustManagers(trustStore); - } - /** - * Gets the <code>TrustManager</code>s from a default <code>TrustManagerFactory</code>, - * initialized from the given trust store. - * - * @param trustStore the trust store to use - * @return <code>TrustManager</code>s to be used for creating an - * <code>SSLSocketFactory</code> utilizing the given trust store - * @throws GeneralSecurityException thrown while initializing the - * default <code>TrustManagerFactory</code> - */ - protected static TrustManager[] getTrustManagers(KeyStore trustStore) - throws GeneralSecurityException { - - if (trustStore == null) - return null; - - // Initialize the default TrustManagerFactory with this KeyStore - String alg=TrustManagerFactory.getDefaultAlgorithm(); - TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); - tmFact.init(trustStore); - - // And now get the TrustManagers - TrustManager[] tms=tmFact.getTrustManagers(); - return tms; - } + protected static TrustManager[] getTrustManagers( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + if (trustStoreInputStream == null) { + return null; + } + + // Set up the TrustStore to use. We need to load the file into + // a KeyStore instance. + final KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, + trustStorePassword); + return getTrustManagers(trustStore); + } + /** - * Loads the client key store from file and gets the - * <code>KeyManager</code>s from a default <code>KeyManagerFactory</code>, - * initialized from the given client key store. - * @param clientKeyStoreType key store type of <code>clientKeyStore</code> - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if <code>null</code>, the default key store will be utilized - * @param clientKeyStorePassword password used to check the integrity of the client key store; - * if <code>null</code>, it will not be checked - * @return <code>KeyManager</code>s to be used for creating an - * <code>SSLSocketFactory</code> utilizing the given client key store - * @throws IOException thrown while reading from the key store file - * @throws GeneralSecurityException thrown while initializing the - * default <code>KeyManagerFactory</code> + * Gets the <code>TrustManager</code>s from a default + * <code>TrustManagerFactory</code>, initialized from the given trust store. + * + * @param trustStore the trust store to use + * @return <code>TrustManager</code>s to be used for creating an + * <code>SSLSocketFactory</code> utilizing the given trust store + * @throws GeneralSecurityException thrown while initializing the default + * <code>TrustManagerFactory</code> */ - public static KeyManager[] getKeyManagers ( - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - if (clientKeyStoreURL == null) - return null; - - // Set up the KeyStore to use. We need to load the file into - // a KeyStore instance. - KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( - clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - return getKeyManagers(clientKeyStore, clientKeyStorePassword); - } + protected static TrustManager[] getTrustManagers(KeyStore trustStore) + throws GeneralSecurityException { + + if (trustStore == null) { + return null; + } + + // Initialize the default TrustManagerFactory with this KeyStore + final String alg = TrustManagerFactory.getDefaultAlgorithm(); + final TrustManagerFactory tmFact = TrustManagerFactory.getInstance(alg); + tmFact.init(trustStore); + + // And now get the TrustManagers + final TrustManager[] tms = tmFact.getTrustManagers(); + return tms; + } + /** - * Gets the <code>KeyManager</code>s from a default <code>KeyManagerFactory</code>, - * initialized from the given client key store. - * @param clientKeyStore client key store - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return <code>KeyManager</code>s to be used for creating an - * <code>SSLSocketFactory</code> utilizing the given client key store - * @throws GeneralSecurityException thrown while initializing the - * default <code>KeyManagerFactory</code> + * Loads the client key store from file and gets the <code>KeyManager</code>s + * from a default <code>KeyManagerFactory</code>, initialized from the given + * client key store. + * + * @param clientKeyStoreType key store type of <code>clientKeyStore</code> + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if <code>null</code>, + * the default key store will be utilized + * @param clientKeyStorePassword password used to check the integrity of the + * client key store; if <code>null</code>, it will + * not be checked + * @return <code>KeyManager</code>s to be used for creating an + * <code>SSLSocketFactory</code> utilizing the given client key store + * @throws IOException thrown while reading from the key store file + * @throws GeneralSecurityException thrown while initializing the default + * <code>KeyManagerFactory</code> */ - public static KeyManager[] getKeyManagers ( - KeyStore clientKeyStore, - String clientKeyStorePassword) - throws GeneralSecurityException { - - if (clientKeyStore == null) - return null; - - // Now we initialize the default KeyManagerFactory with this KeyStore - String alg=KeyManagerFactory.getDefaultAlgorithm(); - KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); - char[] password = null; - if (clientKeyStorePassword != null) - password = clientKeyStorePassword.toCharArray(); - kmFact.init(clientKeyStore, password); - - // And now get the KeyManagers - KeyManager[] kms=kmFact.getKeyManagers(); - return kms; - } + public static KeyManager[] getKeyManagers( + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + if (clientKeyStoreURL == null) { + return null; + } + + // Set up the KeyStore to use. We need to load the file into + // a KeyStore instance. + final KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( + clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + return getKeyManagers(clientKeyStore, clientKeyStorePassword); + } + + /** + * Gets the <code>KeyManager</code>s from a default + * <code>KeyManagerFactory</code>, initialized from the given client key store. + * + * @param clientKeyStore client key store + * @param clientKeyStorePassword if provided, it will be used to check the + * integrity of the client key store; if omitted, + * it will not be checked + * @return <code>KeyManager</code>s to be used for creating an + * <code>SSLSocketFactory</code> utilizing the given client key store + * @throws GeneralSecurityException thrown while initializing the default + * <code>KeyManagerFactory</code> + */ + public static KeyManager[] getKeyManagers( + KeyStore clientKeyStore, + String clientKeyStorePassword) + throws GeneralSecurityException { + + if (clientKeyStore == null) { + return null; + } + + // Now we initialize the default KeyManagerFactory with this KeyStore + final String alg = KeyManagerFactory.getDefaultAlgorithm(); + final KeyManagerFactory kmFact = KeyManagerFactory.getInstance(alg); + char[] password = null; + if (clientKeyStorePassword != null) { + password = clientKeyStorePassword.toCharArray(); + } + kmFact.init(clientKeyStore, password); + + // And now get the KeyManagers + final KeyManager[] kms = kmFact.getKeyManagers(); + return kms; + } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java index 5d328cf..06efdda 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamEntityResolver.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.IOException; @@ -33,23 +32,26 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * An <code>EntityResolver</code> that maps system IDs to + * An <code>EntityResolver</code> that maps system IDs to * <code>InputStream</code>s. - * + * * @author Patrick Peck * @version $Id$ */ public class StreamEntityResolver implements EntityResolver { - - /** A mapping from Public ID or System ID to an <code>InputStream</code> - * containing the entity. */ - private Map mappedEntities; - + + /** + * A mapping from Public ID or System ID to an <code>InputStream</code> + * containing the entity. + */ + private final Map mappedEntities; + /** * Create a <code>StreamEntityResolver</code>. - * - * @param mappedEntities A mapping from public or system IDs - * (<code>String</code> objects) to <code>InputStream</code>s. + * + * @param mappedEntities A mapping from public or system IDs + * (<code>String</code> objects) to + * <code>InputStream</code>s. */ public StreamEntityResolver(Map mappedEntities) { this.mappedEntities = mappedEntities; @@ -57,32 +59,33 @@ public class StreamEntityResolver implements EntityResolver { /** * Resolve an entity by looking it up in the mapped entities. - * + * * First, the public ID is looked up in the mapping, then the system ID. - * + * * @param publicId The public ID of the entity. * @param systemId The system ID of the entity. - * @return An <code>InputStream</code> containing the entity or - * <code>null</code> if no entity could be found. + * @return An <code>InputStream</code> containing the entity or + * <code>null</code> if no entity could be found. * @throws SAXException Signalling a parsing exception. - * @throws IOException Error reading the entity. + * @throws IOException Error reading the entity. */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - + @Override + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + InputSource src = null; - + if (publicId != null && mappedEntities.get(publicId) != null) { src = new InputSource((InputStream) mappedEntities.get(publicId)); } else if (systemId != null && mappedEntities.get(systemId) != null) { src = new InputSource((InputStream) mappedEntities.get(systemId)); } - + if (src != null) { src.setPublicId(publicId); src.setSystemId(systemId); } - + return src; } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java index f3abe9c..41eae87 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StreamUtils.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.ByteArrayOutputStream; @@ -32,34 +31,34 @@ import java.io.PrintStream; /** * Utility methods for streams. - * + * * @author Patrick Peck * @version $Id$ */ public class StreamUtils { - + /** * Compare the contents of two <code>InputStream</code>s. - * + * * @param is1 The 1st <code>InputStream</code> to compare. * @param is2 The 2nd <code>InputStream</code> to compare. * @return boolean <code>true</code>, if both streams contain the exactly the - * same content, <code>false</code> otherwise. + * same content, <code>false</code> otherwise. * @throws IOException An error occurred reading one of the streams. */ - public static boolean compareStreams(InputStream is1, InputStream is2) - throws IOException { - - byte[] buf1 = new byte[256]; - byte[] buf2 = new byte[256]; + public static boolean compareStreams(InputStream is1, InputStream is2) + throws IOException { + + final byte[] buf1 = new byte[256]; + final byte[] buf2 = new byte[256]; int length1; int length2; - + try { while (true) { length1 = is1.read(buf1); length2 = is2.read(buf2); - + if (length1 != length2) { return false; } @@ -70,127 +69,128 @@ public class StreamUtils { return false; } } - } catch (IOException e) { + } catch (final IOException e) { throw e; } finally { // close both streams try { is1.close(); is2.close(); - } catch (IOException e) { + } catch (final IOException e) { // ignore this } } } - + /** * Compare two byte arrays, up to a given maximum length. - * - * @param b1 1st byte array to compare. - * @param b2 2nd byte array to compare. + * + * @param b1 1st byte array to compare. + * @param b2 2nd byte array to compare. * @param length The maximum number of bytes to compare. * @return <code>true</code>, if the byte arrays are equal, <code>false</code> - * otherwise. + * otherwise. */ private static boolean compareBytes(byte[] b1, byte[] b2, int length) { if (b1.length != b2.length) { return false; } - + for (int i = 0; i < b1.length && i < length; i++) { if (b1[i] != b2[i]) { return false; } } - + return true; } /** * Reads a byte array from a stream. + * * @param in The <code>InputStream</code> to read. * @return The bytes contained in the given <code>InputStream</code>. * @throws IOException on any exception thrown */ public static byte[] readStream(InputStream in) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); copyStream(in, out, null); - - /* - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - - */ + + /* + * ByteArrayOutputStream out = new ByteArrayOutputStream(); int b; while ((b = + * in.read()) >= 0) out.write(b); + * + */ in.close(); return out.toByteArray(); } /** * Reads a <code>String</code> from a stream, using given encoding. - * @param in The <code>InputStream</code> to read. - * @param encoding The character encoding to use for converting the bytes - * of the <code>InputStream</code> into a <code>String</code>. - * @return The content of the given <code>InputStream</code> converted into - * a <code>String</code>. + * + * @param in The <code>InputStream</code> to read. + * @param encoding The character encoding to use for converting the bytes of the + * <code>InputStream</code> into a <code>String</code>. + * @return The content of the given <code>InputStream</code> converted into a + * <code>String</code>. * @throws IOException on any exception thrown */ public static String readStream(InputStream in, String encoding) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); copyStream(in, out, null); /* - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - */ + * ByteArrayOutputStream out = new ByteArrayOutputStream(); int b; while ((b = + * in.read()) >= 0) out.write(b); + */ in.close(); return out.toString(encoding); } - + /** - * Reads all data (until EOF is reached) from the given source to the + * Reads all data (until EOF is reached) from the given source to the * destination stream. If the destination stream is null, all data is dropped. - * It uses the given buffer to read data and forward it. If the buffer is - * null, this method allocates a buffer. + * It uses the given buffer to read data and forward it. If the buffer is null, + * this method allocates a buffer. * - * @param source The stream providing the data. - * @param destination The stream that takes the data. If this is null, all - * data from source will be read and discarded. - * @param buffer The buffer to use for forwarding. If it is null, the method - * allocates a buffer. - * @exception IOException If reading from the source or writing to the + * @param source The stream providing the data. + * @param destination The stream that takes the data. If this is null, all data + * from source will be read and discarded. + * @param buffer The buffer to use for forwarding. If it is null, the + * method allocates a buffer. + * @exception IOException If reading from the source or writing to the * destination fails. */ - private static void copyStream(InputStream source, OutputStream destination, byte[] buffer) throws IOException { + private static void copyStream(InputStream source, OutputStream destination, byte[] buffer) + throws IOException { if (source == null) { throw new NullPointerException("Argument \"source\" must not be null."); } if (buffer == null) { buffer = new byte[8192]; } - + if (destination != null) { int bytesRead; while ((bytesRead = source.read(buffer)) >= 0) { destination.write(buffer, 0, bytesRead); } } else { - while (source.read(buffer) >= 0); - } + while (source.read(buffer) >= 0) { + ; + } + } } - + /** * Gets the stack trace of the <code>Throwable</code> passed in as a string. + * * @param t The <code>Throwable</code>. * @return a String representing the stack trace of the <code>Throwable</code>. */ - public static String getStackTraceAsString(Throwable t) - { - ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); + public static String getStackTraceAsString(Throwable t) { + final ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(stackTraceBIS)); return new String(stackTraceBIS.toByteArray()); } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java index 695be18..4c22340 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/StringUtils.java @@ -21,59 +21,59 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.StringTokenizer; /** * Utitility functions for string manipulations. - * + * * @author Harald Bratko */ public class StringUtils { /** * Removes all blanks and tabs from the given string. - * + * * @param s The string to remove all blanks and tabs from. - * @return The input string with all blanks and tabs removed from. + * @return The input string with all blanks and tabs removed from. */ public static String removeBlanks(String s) { - StringTokenizer st = new StringTokenizer(s); - StringBuffer sb = new StringBuffer(s.length()); + final StringTokenizer st = new StringTokenizer(s); + final StringBuffer sb = new StringBuffer(s.length()); while (st.hasMoreTokens()) { sb.append(st.nextToken()); } return sb.toString(); } - + /** * Removes all occurences of the specified token from the the given string. - * + * * @param s The string to remove all occurences of the specified token from. - * @return The input string with all occurences of the specified token removed from. + * @return The input string with all occurences of the specified token removed + * from. */ public static String removeToken(String s, String token) { - StringTokenizer st = new StringTokenizer(s, token); - StringBuffer sb = new StringBuffer(s.length()); + final StringTokenizer st = new StringTokenizer(s, token); + final StringBuffer sb = new StringBuffer(s.length()); while (st.hasMoreTokens()) { sb.append(st.nextToken()); } return sb.toString(); } - + /** * Removes all leading zeros from the input string. - * - * @param s The string remove the leading zeros from. - * @return The input string with the leading zeros removed from. + * + * @param s The string remove the leading zeros from. + * @return The input string with the leading zeros removed from. */ public static String deleteLeadingZeros(String s) { - StringBuffer sb = new StringBuffer(s); - int l = sb.length(); + final StringBuffer sb = new StringBuffer(s); + final int l = sb.length(); int j = 0; - for (int i=0; i<l; i++) { + for (int i = 0; i < l; i++) { if (sb.charAt(i) == '0') { j++; } else { @@ -82,97 +82,94 @@ public class StringUtils { } return sb.substring(j, l); } - + /** * Replaces each substring of string <code>s</code> that matches the given * <code>search</code> string by the given <code>replace</code> string. - * - * @param s The string where the replacement should take place. - * @param search The pattern that should be replaced. - * @param replace The string that should replace all each <code>search</code> - * string within <code>s</code>. - * @return A string where all occurrence of <code>search</code> are - * replaced with <code>replace</code>. + * + * @param s The string where the replacement should take place. + * @param search The pattern that should be replaced. + * @param replace The string that should replace all each <code>search</code> + * string within <code>s</code>. + * @return A string where all occurrence of <code>search</code> are replaced + * with <code>replace</code>. */ - public static String replaceAll (String s, String search, String replace) - { - StringBuffer sb = new StringBuffer(); - int i = 0, j = 0; - int len = search.length(); - while (j > -1) - { - j = s.indexOf(search, i); + public static String replaceAll(String s, String search, String replace) { + final StringBuffer sb = new StringBuffer(); + int i = 0, j = 0; + final int len = search.length(); + while (j > -1) { + j = s.indexOf(search, i); + + if (j > -1) { + sb.append(s.substring(i, j)); + sb.append(replace); + i = j + len; + } + } - if (j > -1) - { - sb.append(s.substring(i,j)); - sb.append(replace); - i = j + len; - } - } - - sb.append(s.substring(i, s.length())); + sb.append(s.substring(i, s.length())); - return sb.toString(); + return sb.toString(); } - + /** - * Changes the SecurityLayer version in the given string. - * This method usually takes as input an XML structure represented in a string - * format and changes the SecurityLayer namespaces prefixes and URIs from - * one SecurityLayer version to another. - * e.g.: code>sl10</code> to <code>sl</code> and - * <code>http://www.buergerkarte.at/namespaces/securitylayer/20020225#</code> - * to - * <code>http://www.buergerkarte.at/namespaces/securitylayer/1.2#</code> - * - * @param s The string (usally an XML structure) where the - * SecurityLayer version should be changed. - * @param slPrefixOld The SecurityLayer namespace prefix that should be - * replaced by the new one. - * @param slPrefixNew The new SecurityLayer namespace prefix that should - * replace the old one. - * @param slNSUriOld The SecurityLayer namespace URI that should be - * replaced by the new one. - * @param slNSUriNew The new SecurityLayer namespace URI that should - * replace the old one. - * @return A string where the SecurityLayer namespace prefixes - * and URIs are replaced by new ones. + * Changes the SecurityLayer version in the given string. This method usually + * takes as input an XML structure represented in a string format and changes + * the SecurityLayer namespaces prefixes and URIs from one SecurityLayer version + * to another. e.g.: code>sl10</code> to <code>sl</code> and + * <code>http://www.buergerkarte.at/namespaces/securitylayer/20020225#</code> to + * <code>http://www.buergerkarte.at/namespaces/securitylayer/1.2#</code> + * + * @param s The string (usally an XML structure) where the + * SecurityLayer version should be changed. + * @param slPrefixOld The SecurityLayer namespace prefix that should be replaced + * by the new one. + * @param slPrefixNew The new SecurityLayer namespace prefix that should replace + * the old one. + * @param slNSUriOld The SecurityLayer namespace URI that should be replaced by + * the new one. + * @param slNSUriNew The new SecurityLayer namespace URI that should replace + * the old one. + * @return A string where the SecurityLayer namespace prefixes and URIs are + * replaced by new ones. */ - public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { + public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, + String slNSUriNew) { String retString = replaceAll(s, slPrefixOld, slPrefixNew); retString = replaceAll(retString, slNSUriOld, slNSUriNew); - return retString ; + return retString; } - + /** * Removes the XML declaration from an XML expression. - * + * * @param xmlString XML expression as String - * + * * @return XML expression, XML declaration removed */ public static String removeXMLDeclaration(String xmlString) { - if (xmlString!=null && xmlString.startsWith("<?xml")) { - int firstElement = xmlString.indexOf("<", 1); + if (xmlString != null && xmlString.startsWith("<?xml")) { + final int firstElement = xmlString.indexOf("<", 1); return xmlString.substring(firstElement); } else { return xmlString; } } - + /** * Checks if String is empty + * * @param s String to be checked if empty * @return True if String is empty, false otherwise */ public static boolean isEmpty(String s) { - if (s == null || s.length() == 0) - return true; - else - return false; - + if (s == null || s.length() == 0) { + return true; + } else { + return false; + } + } - - + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLDecoder.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLDecoder.java index af71e2d..cfebbb2 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLDecoder.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLDecoder.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.ByteArrayOutputStream; @@ -30,55 +29,60 @@ import java.io.StringReader; import java.io.UnsupportedEncodingException; /** - * Decodes an URL encoded String using a specified character encoding. - * Provides a function missing in JDK 1.3. + * Decodes an URL encoded String using a specified character encoding. Provides + * a function missing in JDK 1.3. + * * @author Paul Ivancsics * @version $Id$ */ public class URLDecoder { /** - * Decodes an <code>application/x-www-form-urlencoded</code> string using a specific encoding scheme. - * @param s the string to decode + * Decodes an <code>application/x-www-form-urlencoded</code> string using a + * specific encoding scheme. + * + * @param s the string to decode * @param encoding name of character encoding * @return the newly decoded string * @throws UnsupportedEncodingException if the encoding is not supported */ public static String decode(String s, String encoding) throws UnsupportedEncodingException { - StringReader in = new StringReader(s); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - for (int b = read(in); b >= 0; b = read(in)) + final StringReader in = new StringReader(s); + final ByteArrayOutputStream bout = new ByteArrayOutputStream(); + for (int b = read(in); b >= 0; b = read(in)) { bout.write(b); + } return bout.toString(encoding); } + /** * Decodes the next byte from the string reader. + * * @param in string reader - * @return the next byte decoded; - * -1 upon end of string, on erroneous data, and on any exception caught + * @return the next byte decoded; -1 upon end of string, on erroneous data, and + * on any exception caught * @todo syntax check on string */ private static int read(StringReader in) { - try { - int b = in.read(); - if (b == '+') + try { + final int b = in.read(); + if (b == '+') { return ' '; + } if (b == '%') { - char[] hex = new char[2]; + final char[] hex = new char[2]; if (in.read(hex, 0, 2) >= 0) { - String hexString = new String(hex); + final String hexString = new String(hex); return Integer.valueOf(hexString, 16).intValue(); - } - else + } else { return -1; + } } return b; - } - catch (IOException ex) { - return -1; - } - catch (NumberFormatException ex) { - return -1; + } catch (final IOException ex) { + return -1; + } catch (final NumberFormatException ex) { + return -1; } } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java index 2aa7e22..5eaece3 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/URLEncoder.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.ByteArrayInputStream; @@ -29,60 +28,68 @@ import java.io.StringWriter; import java.io.UnsupportedEncodingException; /** - * Translates a string into mime format "x-www-form-urlencoded". - * Provides a function missing in JDK 1.3. + * Translates a string into mime format "x-www-form-urlencoded". Provides a + * function missing in JDK 1.3. + * * @author Paul Ivancsics * @version $Id$ */ public class URLEncoder { - + /** * Translates a string into x-www-form-urlencoded format. - * @param s the string to be translated + * + * @param s the string to be translated * @param encoding the encoding to use * @return the translated string - * @throws UnsupportedEncodingException when the desired encoding is not supported + * @throws UnsupportedEncodingException when the desired encoding is not + * supported */ public static String encode(String s, String encoding) throws UnsupportedEncodingException { // if (MiscUtil.isEmpty(s)) // return null; - byte[] barr = s.getBytes(encoding); - ByteArrayInputStream bin = new ByteArrayInputStream(barr); - StringWriter out = new StringWriter(); - for (int b = bin.read(); b >= 0; b = bin.read()) + final byte[] barr = s.getBytes(encoding); + final ByteArrayInputStream bin = new ByteArrayInputStream(barr); + final StringWriter out = new StringWriter(); + for (int b = bin.read(); b >= 0; b = bin.read()) { encode(b, out); + } return out.toString(); } - + /** * Encode a character. - * @param ch The character to encode. + * + * @param ch The character to encode. * @param out The <code>StringWriter</code> containing the result. */ private static void encode(int ch, StringWriter out) { - if ((ch >= 'a' && ch <= 'z') - || (ch >= 'A' && ch <= 'Z') - || (ch >= '0' && ch <= '9') - || ch == '.' || ch == '-' || ch == '*' || ch == '_') + if (ch >= 'a' && ch <= 'z' + || ch >= 'A' && ch <= 'Z' + || ch >= '0' && ch <= '9' + || ch == '.' || ch == '-' || ch == '*' || ch == '_') { out.write(ch); - else if (ch == ' ') + } else if (ch == ' ') { out.write('+'); - else + } else { encodeHex(ch, out); + } } - + /** - * Encode a character as an escaped hex value. - * @param ch The character to encode. + * Encode a character as an escaped hex value. + * + * @param ch The character to encode. * @param out The <code>StringWriter</code> containing the result. */ private static void encodeHex(int ch, StringWriter out) { out.write('%'); - String hex = Integer.toHexString(ch).toUpperCase(); - if (hex.length() < 2) + final String hex = Integer.toHexString(ch).toUpperCase(); + if (hex.length() < 2) { out.write('0'); - else + } else { out.write(hex.charAt(hex.length() - 2)); + } out.write(hex.charAt(hex.length() - 1)); } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java index cbf3e4e..9a60bd2 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathException.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.io.PrintStream; @@ -29,33 +28,33 @@ import java.io.PrintWriter; /** * An exception occurred evaluating an XPath. - * + * * @author Patrick Peck * @version $Id$ */ public class XPathException extends RuntimeException { /** - * - */ - private static final long serialVersionUID = 1736311265333034392L; -/** The wrapped exception. */ - private Throwable wrapped; - + * + */ + private static final long serialVersionUID = 1736311265333034392L; + /** The wrapped exception. */ + private final Throwable wrapped; + /** * Create a <code>XPathException</code>. - * + * * @param message The exception message. * @param wrapped The exception being the likely cause of this exception. */ public XPathException(String message, Throwable wrapped) { // TODO: remove wrapped from super cstr. again - super(message, wrapped); - this.wrapped = wrapped; + super(message, wrapped); + this.wrapped = wrapped; } - + /** * Return the wrapped exception. - * + * * @return The wrapped exception being the likely cause of this exception. */ public Throwable getWrapped() { @@ -65,6 +64,7 @@ public class XPathException extends RuntimeException { /** * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) */ + @Override public void printStackTrace(PrintStream s) { super.printStackTrace(s); if (getWrapped() != null) { @@ -76,6 +76,7 @@ public class XPathException extends RuntimeException { /** * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) */ + @Override public void printStackTrace(PrintWriter s) { super.printStackTrace(s); if (getWrapped() != null) { @@ -83,5 +84,5 @@ public class XPathException extends RuntimeException { getWrapped().printStackTrace(s); } } - + } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java index 2604c20..3bc3bb9 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/XPathUtils.java @@ -21,28 +21,26 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moaspss.util; import java.util.List; import java.util.Map; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.traversal.NodeIterator; - import org.jaxen.JaxenException; import org.jaxen.NamespaceContext; import org.jaxen.Navigator; import org.jaxen.SimpleNamespaceContext; import org.jaxen.dom.DOMXPath; import org.jaxen.dom.DocumentNavigator; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.traversal.NodeIterator; /** * Utility methods to evaluate XPath expressions on DOM nodes. - * + * * @author Patrick Peck * @version $Id$ */ @@ -53,16 +51,16 @@ public class XPathUtils { * root node itself). */ public static final String ALL_NODES_XPATH = - "(.//. | .//@* | .//namespace::*)"; + "(.//. | .//@* | .//namespace::*)"; /** The <code>DocumentNavigator</code> to use for navigating the document. */ private static Navigator documentNavigator = - DocumentNavigator.getInstance(); + DocumentNavigator.getInstance(); /** The default namespace prefix to namespace URI mappings. */ private static NamespaceContext NS_CONTEXT; static { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(); ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); @@ -95,18 +93,17 @@ public class XPathUtils { /** * Return a <code>NodeIterator</code> over the nodes matching the XPath * expression. - * + * * All namespace URIs and prefixes declared in the <code>Constants</code> * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param exp The XPath expression to evaluate. * @return An iterator over the resulting nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeIterator selectNodeIterator(Node contextNode, String exp) - throws XPathException { + throws XPathException { return selectNodeIterator(contextNode, NS_CONTEXT, exp); } @@ -114,28 +111,28 @@ public class XPathUtils { /** * Return a <code>NodeIterator</code> over the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the namespace mapping + * for evaluating the XPath expression + * @param exp The XPath expression to evaluate. * @return An iterator over the resulting nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeIterator selectNodeIterator( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(); ctx.addElementNamespaces(documentNavigator, namespaceElement); return selectNodeIterator(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } @@ -143,23 +140,23 @@ public class XPathUtils { /** * Return a <code>NodeIterator</code> over the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. * @param namespaceMapping A namespace prefix to namespace URI mapping - * (<code>String</code> to <code>String</code>) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. + * (<code>String</code> to <code>String</code>) for + * evaluating the XPath expression. + * @param exp The XPath expression to evaluate. * @return An iterator over the resulting nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeIterator selectNodeIterator( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); return selectNodeIterator(contextNode, ctx, exp); } @@ -167,31 +164,31 @@ public class XPathUtils { /** * Return a <code>NodeIterator</code> over the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The <code>NamespaceContext</code> for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param nsContext The <code>NamespaceContext</code> for resolving namespace + * prefixes to namespace URIs for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. * @return An iterator over the resulting nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ private static NodeIterator selectNodeIterator( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { try { - DOMXPath xpath = new DOMXPath(exp); + final DOMXPath xpath = new DOMXPath(exp); List nodes; xpath.setNamespaceContext(nsContext); nodes = xpath.selectNodes(contextNode); return new NodeIteratorAdapter(nodes.listIterator()); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } @@ -199,18 +196,17 @@ public class XPathUtils { /** * Return a <code>NodeList</code> of all the nodes matching the XPath * expression. - * + * * All namespace URIs and prefixes declared in the <code>Constants</code> * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param exp The XPath expression to evaluate. * @return A <code>NodeList</code> containing the matching nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeList selectNodeList(Node contextNode, String exp) - throws XPathException { + throws XPathException { return selectNodeList(contextNode, NS_CONTEXT, exp); } @@ -218,29 +214,29 @@ public class XPathUtils { /** * Return a <code>NodeList</code> of all the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the namespace mapping + * for evaluating the XPath expression + * @param exp The XPath expression to evaluate. * @return A <code>NodeList</code> containing the matching nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeList selectNodeList( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(); ctx.addElementNamespaces(documentNavigator, namespaceElement); return selectNodeList(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } @@ -248,23 +244,23 @@ public class XPathUtils { /** * Return a <code>NodeList</code> of all the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. * @param namespaceMapping A namespace prefix to namespace URI mapping - * (<code>String</code> to <code>String</code>) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. + * (<code>String</code> to <code>String</code>) for + * evaluating the XPath expression. + * @param exp The XPath expression to evaluate. * @return A <code>NodeList</code> containing the matching nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ public static NodeList selectNodeList( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); return selectNodeList(contextNode, ctx, exp); } @@ -272,133 +268,132 @@ public class XPathUtils { /** * Return a <code>NodeList</code> of all the nodes matching the XPath * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The <code>NamespaceContext</code> for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param nsContext The <code>NamespaceContext</code> for resolving namespace + * prefixes to namespace URIs for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. * @return A <code>NodeList</code> containing the matching nodes. * @throws XPathException An error occurred evaluating the XPath expression. */ private static NodeList selectNodeList( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { try { - DOMXPath xpath = new DOMXPath(exp); + final DOMXPath xpath = new DOMXPath(exp); List nodes; xpath.setNamespaceContext(nsContext); nodes = xpath.selectNodes(contextNode); return new NodeListAdapter(nodes); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } /** * Select the first node matching an XPath expression. - * + * * All namespace URIs and prefixes declared in the <code>Constants</code> * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param exp The XPath expression to evaluate. * @return Node The first node matching the XPath expression, or - * <code>null</code>, if no node matched. + * <code>null</code>, if no node matched. * @throws XPathException An error occurred evaluating the XPath expression. */ public static Node selectSingleNode(Node contextNode, String exp) - throws XPathException { + throws XPathException { return selectSingleNode(contextNode, NS_CONTEXT, exp); } /** * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the namespace mapping + * for evaluating the XPath expression + * @param exp The XPath expression to evaluate. * @return Node The first node matching the XPath expression, or - * <code>null</code>, if no node matched. + * <code>null</code>, if no node matched. * @throws XPathException An error occurred evaluating the XPath expression. */ public static Node selectSingleNode( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(); ctx.addElementNamespaces(documentNavigator, namespaceElement); return selectSingleNode(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } /** * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. * @param namespaceMapping A namespace prefix to namespace URI mapping - * (<code>String</code> to <code>String</code>) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. + * (<code>String</code> to <code>String</code>) for + * evaluating the XPath expression. + * @param exp The XPath expression to evaluate. * @return Node The first node matching the XPath expression, or - * <code>null</code>, if no node matched. + * <code>null</code>, if no node matched. * @throws XPathException An error occurred evaluating the XPath expression. */ public static Node selectSingleNode( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + final SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); return selectSingleNode(contextNode, ctx, exp); } /** * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The <code>NamespaceContext</code> for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. + * + * @param contextNode The root node from which to evaluate the XPath expression. + * @param nsContext The <code>NamespaceContext</code> for resolving namespace + * prefixes to namespace URIs for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. * @return Node The first node matching the XPath expression, or - * <code>null</code>, if no node matched. + * <code>null</code>, if no node matched. * @throws XPathException An error occurred evaluating the XPath expression. */ public static Node selectSingleNode( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { try { - DOMXPath xpath = new DOMXPath(exp); + final DOMXPath xpath = new DOMXPath(exp); xpath.setNamespaceContext(nsContext); return (Node) xpath.selectSingleNode(contextNode); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); + } catch (final JaxenException e) { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { exp }); throw new XPathException(message, e); } } @@ -406,140 +401,137 @@ public class XPathUtils { /** * Return the value of a DOM element whose location is given by an XPath * expression. - * - * @param root The root element from which to evaluate the XPath. - * @param xpath The XPath expression pointing to the element whose value - * to return. - * @param def The default value to return, if no element can be found using - * the given <code>xpath</code>. - * @return The element value, if it can be located using the - * <code>xpath</code>. Otherwise, <code>def</code> is returned. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the element whose value to + * return. + * @param def The default value to return, if no element can be found using + * the given <code>xpath</code>. + * @return The element value, if it can be located using the <code>xpath</code>. + * Otherwise, <code>def</code> is returned. */ public static String getElementValue( - Element root, - String xpath, - String def) { + Element root, + String xpath, + String def) { - Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); + final Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); return elem != null ? DOMUtils.getText(elem) : def; } /** * Return the value of a DOM attribute whose location is given by an XPath * expression. - * - * @param root The root element from which to evaluate the XPath. + * + * @param root The root element from which to evaluate the XPath. * @param xpath The XPath expression pointing to the attribute whose value to - * return. - * @param def The default value to return, if no attribute can be found using - * the given <code>xpath</code>. - * @return The element value, if it can be located using the - * <code>xpath</code>. Otherwise, <code>def</code> is returned. + * return. + * @param def The default value to return, if no attribute can be found using + * the given <code>xpath</code>. + * @return The element value, if it can be located using the <code>xpath</code>. + * Otherwise, <code>def</code> is returned. */ public static String getAttributeValue( - Element root, - String xpath, - String def) { + Element root, + String xpath, + String def) { - Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); + final Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); return attr != null ? attr.getValue() : def; } - + /** - * Returns the namespace prefix used within <code>XPathUtils</code> for referring to - * the namespace of the specified (Security Layer command) element. + * Returns the namespace prefix used within <code>XPathUtils</code> for + * referring to the namespace of the specified (Security Layer command) element. + * + * This namespace prefix can be used in various XPath expression evaluation + * methods within <code> XPathUtils</code> without explicitely binding it to the + * particular namespace. + * + * @param contextElement The (Security Layer command) element. * - * This namespace prefix can be used in various XPath expression evaluation methods - * within <code> XPathUtils</code> without explicitely binding it to the particular - * namespace. - * - * @param contextElement The (Security Layer command) element. - * - * @return the namespace prefix used within <code>XPathUtils</code> for referring to - * the namespace of the specified (Security Layer command) element. - * - * throws XpathException If the specified element has a namespace other than the ones - * known by this implementation as valid Security Layer namespaces (cf. - * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). + * @return the namespace prefix used within <code>XPathUtils</code> for + * referring to the namespace of the specified (Security Layer command) + * element. + * + * throws XpathException If the specified element has a namespace other + * than the ones known by this implementation as valid Security Layer + * namespaces (cf. + * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link + * Constants#SL12_NS_URI). */ - public static String getSlPrefix (Element contextElement) throws XPathException - { - String sLNamespace = contextElement.getNamespaceURI(); + public static String getSlPrefix(Element contextElement) throws XPathException { + final String sLNamespace = contextElement.getNamespaceURI(); String sLPrefix = null; - if (sLNamespace.equals(Constants.SL10_NS_URI)) - { + if (sLNamespace.equals(Constants.SL10_NS_URI)) { sLPrefix = Constants.SL10_PREFIX; - } - else if (sLNamespace.equals(Constants.SL12_NS_URI)) - { + } else if (sLNamespace.equals(Constants.SL12_NS_URI)) { sLPrefix = Constants.SL12_PREFIX; - } - else if (sLNamespace.equals(Constants.SL11_NS_URI)) - { + } else if (sLNamespace.equals(Constants.SL11_NS_URI)) { sLPrefix = Constants.SL11_PREFIX; - } - else - { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger Security Layer Namespace: \"" + sLNamespace + "\"."}); + } else { + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { + "Ung�ltiger Security Layer Namespace: \"" + sLNamespace + "\"." }); throw new XPathException(message, null); } - + return sLPrefix; } - - + /** - * Return the SecurityLayer namespace prefix of the context element. - * If the context element is not the element that lies within the - * SecurityLayer namespace. The Securitylayer namespace is derived from - * the <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code> - * attribute of the context element. - * + * Return the SecurityLayer namespace prefix of the context element. If the + * context element is not the element that lies within the SecurityLayer + * namespace. The Securitylayer namespace is derived from the + * <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code> attribute of + * the context element. + * * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix for the Securitylayer + * namespace, that is used within the corresponding + * document. * - * @param contextElement The element to get a prefix for the Securitylayer namespace, - * that is used within the corresponding document. - * - * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>, - * depending on the SecurityLayer namespace of the contextElement. - * - * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace - * is defined. + * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XPathException If no (vlalid) SecurityLayer namespace prefix + * or namespace is defined. */ - public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { - + public static String getSlPrefixFromNoRoot(Element contextElement) throws XPathException { + String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); if (slPrefix == null) { slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); } if (slPrefix == null) { slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); - } - + } + return slPrefix; - + } - + /** - * Checks if the context element has an attribute <code>xmlns:slPrefix</code> and - * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. + * Checks if the context element has an attribute <code>xmlns:slPrefix</code> + * and if the prefix of that attribute corresponds with a valid SecurityLayer + * namespace. + * + * @param contextElement The element to be checked. + * @param slPrefix The prefix which should be checked. Must be a valid + * SecurityLayer namespace prefix. + * @param slNameSpace The SecurityLayer namespace that corresponds to the + * specified prefix. * - * @param contextElement The element to be checked. - * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer - * namespace prefix. - * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. - * - * @return The valid SecurityLayer prefix or <code>null</code> if this prefix is - * not used. + * @return The valid SecurityLayer prefix or <code>null</code> if this prefix is + * not used. * @throws XPathException */ private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) - throws XPathException - { - String nsAtt = "xmlns:" + slPrefix; - String nameSpace = contextElement.getAttribute(nsAtt); + throws XPathException { + final String nsAtt = "xmlns:" + slPrefix; + final String nameSpace = contextElement.getAttribute(nsAtt); if (nameSpace == "") { return null; } else { @@ -547,8 +539,9 @@ public class XPathUtils { if (nameSpace.equals(slNameSpace)) { return slPrefix; } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ung�ltiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + final MessageProvider msg = MessageProvider.getInstance(); + final String message = msg.getMessage("xpath.00", new Object[] { + "Ung�ltiger SecurityLayer Namespace: \"" + nameSpace + "\"." }); throw new XPathException(message, null); } } diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java index 27169b4..5960fce 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/ex/EgovUtilException.java @@ -1,13 +1,13 @@ /* * Copyright 2011 Federal Chancellery Austria and * Graz University of Technology - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,24 +18,24 @@ package at.gv.egovernment.moaspss.util.ex; public class EgovUtilException extends Exception { - /** - * + /** + * */ private static final long serialVersionUID = 1L; - public EgovUtilException() { - } + public EgovUtilException() { + } - public EgovUtilException(String message) { - super(message); - } + public EgovUtilException(String message) { + super(message); + } - public EgovUtilException(Throwable cause) { - super(cause); - } + public EgovUtilException(Throwable cause) { + super(cause); + } - public EgovUtilException(String message, Throwable cause) { - super(message, cause); - } + public EgovUtilException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.0.xsd b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.0.xsd new file mode 100644 index 0000000..9a2836e --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.0.xsd @@ -0,0 +1,814 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- MOA SP/SS 2.0.0 Schema --> +<xsd:schema xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://reference.e-government.gv.at/namespace/moa/20020822#" targetNamespace="http://reference.e-government.gv.at/namespace/moa/20020822#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.2"> + <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> + <!--########## Create CMS Signature ### --> + <!--### Create CMS Signature Request ### --> + <xsd:element name="CreateCMSSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreateCMSSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreateCMSSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="DataObjectInfo"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CMSDataObjectInfoType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="SecurityLayerConformity" type="xsd:boolean" use="optional" default="true"/> + <xsd:attribute name="PAdESConformity" type="xsd:boolean" use="optional" default="false"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create CMS Signature Response ### --> + <xsd:element name="CreateCMSSignatureResponse" type="CreateCMSSignatureResponseType"/> + <xsd:complexType name="CreateCMSSignatureResponseType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Kardinalität 1..oo erlaubt die Antwort auf eine + Stapelsignatur-Anfrage</xsd:documentation> + </xsd:annotation> + <xsd:element name="CMSSignature" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:complexType> + <!--########## Create XML Signature ### --> + <!--### Create XML Signature Request ### --> + <xsd:element name="CreateXMLSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreateXMLSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreateXMLSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="DataObjectInfo" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="DataObjectInfoType"> + <xsd:attribute name="ChildOfManifest" type="xsd:boolean" use="optional" default="false"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:element name="CreateSignatureInfo" minOccurs="0"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateSignatureEnvironment" type="ContentOptionalRefType"/> + <xsd:choice> + <xsd:annotation> + <xsd:documentation>Auswahl: Entweder explizite Angabe des + Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit + der Signaturumgebung, oder Verweis auf ein benanntes Profil + </xsd:documentation> + </xsd:annotation> + <xsd:element ref="CreateSignatureEnvironmentProfile"/> + <xsd:element name="CreateSignatureEnvironmentProfileID" type="ProfileIdentifierType"/> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="SecurityLayerConformity" type="xsd:boolean" use="optional" default="true"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create XML Signature Response ### --> + <xsd:complexType name="CreateXMLSignatureResponseType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Kardinalität 1..oo erlaubt die Antwort auf eine + Stapelsignatur-Anfrage</xsd:documentation> + </xsd:annotation> + <xsd:element name="SignatureEnvironment"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:any namespace="##any" processContents="lax"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:complexType> + <xsd:element name="CreateXMLSignatureResponse" type="CreateXMLSignatureResponseType"/> + <!--########## Create PDF Signature ### --> + <!--### Create PDF Signature Request ### --> + <xsd:element name="CreatePDFSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreatePDFSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreatePDFSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="PDFDocument" type="xsd:base64Binary"/> + <xsd:element name="SignatureProfile" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignaturePosition" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureID" type="xsd:string" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create PDF Signature Response ### --> + <xsd:element name="CreatePDFSignatureResponse" type="CreatePDFSignatureResponseType"/> + <xsd:complexType name="CreatePDFSignatureResponseType"> + <xsd:sequence> + <xsd:element name="PDFSignature" type="PDFSignedRepsonse" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify CMS Signature ### --> + <!--### Verifiy CMS Signature Request ### --> + <xsd:element name="VerifyCMSSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyCMSSignatureRequestType"> + <xsd:attribute name="Signatories" type="SignatoriesType" use="optional" default="1"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyCMSSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="CMSSignature" type="xsd:base64Binary"/> + <xsd:element name="DataObject" type="CMSDataObjectOptionalMetaType" minOccurs="0"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify CMS Signature Response ### --> + <xsd:element name="VerifyCMSSignatureResponse" type="VerifyCMSSignatureResponseType"/> + <xsd:complexType name="VerifyCMSSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="VerifyASICCMSSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any, + TSLInformation is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify PDF Signature ### --> + <!--### Verifiy PDF Signature Request ### --> + <xsd:element name="VerifyPDFSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyPDFSignatureRequestType"> + <xsd:attribute name="Signatories" type="SignatoriesType" use="optional" default="1"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyPDFSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="PDFSignature" type="xsd:base64Binary"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify PDF Signature ### --> + <!--### Verifiy ASIC Signature Request ### --> + <xsd:element name="VerifyASICSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyASICSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyASICSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="ASICSignature" type="xsd:base64Binary"/> + <xsd:element name="ASICExtension" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>asics or asice</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify ASIC Signature Response ### --> + <xsd:element name="VerifyASICSignatureResponse" type="VerifyASICSignatureResponseType"/> + <xsd:complexType name="VerifyASICSignatureResponseType"> + <xsd:sequence> + <xsd:element name="ASiCSignatureResult" type="ASICResultType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ASICResultType"> + <xsd:sequence> + <xsd:element name="signedFiles" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="XMLSignatureResult" type="VerifyASICXMLSignatureResponseType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CMSSignatureResult" type="VerifyASICCMSSignatureResponseType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!--### Verify CMS Signature Response ### --> + <xsd:element name="VerifyPDFSignatureResponse" type="VerifyPDFSignatureResponseType"/> + <xsd:complexType name="VerifyPDFSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignatureResult" type="PDFSignatureResultType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="PDFSignatureResultType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify XML Signature ### --> + <!--### Verify XML Signature Request ### --> + <xsd:element name="VerifyXMLSignatureRequest" type="VerifyXMLSignatureRequestType"/> + <xsd:complexType name="VerifyXMLSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="VerifySignatureInfo"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="VerifySignatureEnvironment" type="ContentOptionalRefType"/> + <xsd:element name="VerifySignatureLocation" type="xsd:token"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="SupplementProfile"/> + <xsd:element name="SupplementProfileID" type="xsd:string"/> + </xsd:choice> + <xsd:element name="SignatureManifestCheckParams" minOccurs="0"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="ReferenceInfo" type="VerifyTransformsDataType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Pro dsig:Reference-Element in der zu + überprüfenden XML-Signatur muss hier ein + ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen + ReferenceInfo Elemente entspricht jener der dsig:Reference + Elemente in der XML-Signatur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="ReturnReferenceInputData" type="xsd:boolean" use="optional" default="true"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="ReturnHashInputData" minOccurs="0"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify XML Signature Response ### --> + <xsd:element name="VerifyXMLSignatureResponse" type="VerifyXMLSignatureResponseType"/> + <xsd:complexType name="VerifyXMLSignatureResponseType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and ds:RetrievalMethod is + supported; QualifiedCertificate is included as X509Data/any; + PublicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="HashInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferenceInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="SignatureCheck" type="ReferencesCheckResultType"/> + <xsd:element name="SignatureManifestCheck" type="ReferencesCheckResultType" minOccurs="0"/> + <xsd:element name="XMLDSIGManifestCheck" type="ManifestRefsCheckResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="VerifyASICXMLSignatureResponseType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and ds:RetrievalMethod is + supported; QualifiedCertificate is included as X509Data/any; + PublicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="HashInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferenceInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="SignatureCheck" type="ReferencesCheckResultType"/> + <xsd:element name="SignatureManifestCheck" type="ReferencesCheckResultType" minOccurs="0"/> + <xsd:element name="XMLDSIGManifestCheck" type="ManifestRefsCheckResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="ProfileIdentifierType"> + <xsd:restriction base="xsd:token"/> + </xsd:simpleType> + <xsd:complexType name="InputDataType"> + <xsd:complexContent> + <xsd:extension base="ContentExLocRefBaseType"> + <xsd:attribute name="PartOf" use="optional" default="SignedInfo"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="SignedInfo"/> + <xsd:enumeration value="XMLDSIGManifest"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="ReferringSigReference" type="xsd:nonNegativeInteger" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="MetaInfoType"> + <xsd:sequence> + <xsd:element name="MimeType" type="MimeTypeType"/> + <xsd:element name="Description" type="xsd:anyURI" minOccurs="0"/> + <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FinalDataMetaInfoType"> + <xsd:complexContent> + <xsd:extension base="MetaInfoType"> + <xsd:sequence> + <xsd:element name="Type" type="xsd:anyURI" minOccurs="0"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="DataObjectInfoType"> + <xsd:sequence> + <xsd:element name="DataObject"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="ContentOptionalRefType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:choice> + <xsd:annotation> + <xsd:documentation>Auswahl: Entweder explizite Angabe EINER + Transformationskette inklusive ggf. sinnvoller Supplements oder + Verweis auf ein benanntes Profil</xsd:documentation> + </xsd:annotation> + <xsd:element ref="CreateTransformsInfoProfile"/> + <xsd:element name="CreateTransformsInfoProfileID" type="ProfileIdentifierType"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Structure" use="required"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="detached"/> + <xsd:enumeration value="enveloping"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectInfoType"> + <xsd:sequence> + <xsd:element name="DataObject"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CMSDataObjectRequiredMetaType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Structure" use="required"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="detached"/> + <xsd:enumeration value="enveloping"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + <xsd:complexType name="TransformsInfoType"> + <xsd:sequence> + <xsd:element ref="dsig:Transforms" minOccurs="0"/> + <xsd:element name="FinalDataMetaInfo" type="FinalDataMetaInfoType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="XMLDataObjectAssociationType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType" minOccurs="0"/> + <xsd:element name="Content" type="ContentRequiredRefType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="PDFSignedRepsonse"> + <xsd:sequence> + <xsd:element name="SignatureID" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:choice maxOccurs="1"> + <xsd:element name="PDFSignature" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectOptionalMetaType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType" minOccurs="0"/> + <xsd:element name="Content" type="CMSContentBaseType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectRequiredMetaType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType"/> + <xsd:element name="Content" type="CMSContentBaseType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSContentBaseType"> + <xsd:complexContent> + <xsd:restriction base="ContentOptionalRefType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + </xsd:choice> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="AnyChildrenType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FormResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="IndicationResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ExtendedCertificateCheckResultType"> + <xsd:sequence> + <xsd:element name="Major" type="IndicationResultType" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Minor" type="IndicationResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ReferencesCheckResultType"> + <xsd:complexContent> + <xsd:restriction base="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="ReferencesCheckResultInfoType" minOccurs="0"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ReferencesCheckResultInfoType" mixed="true"> + <xsd:complexContent> + <xsd:restriction base="AnyChildrenType"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="FailedReference" type="xsd:positiveInteger" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ManifestRefsCheckResultType"> + <xsd:complexContent> + <xsd:restriction base="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="ManifestRefsCheckResultInfoType"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ManifestRefsCheckResultInfoType" mixed="true"> + <xsd:complexContent> + <xsd:restriction base="AnyChildrenType"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="FailedReference" type="xsd:positiveInteger" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferringSigReference" type="xsd:positiveInteger"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <!--########## Error Response ### --> + <xsd:element name="ErrorResponse" type="ErrorResponseType"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung gescheitert + ist</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ErrorResponseType"> + <xsd:sequence> + <xsd:element name="ErrorCode" type="xsd:integer"/> + <xsd:element name="Info" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Auxiliary Types ### --> + <xsd:simpleType name="KeyIdentifierType"> + <xsd:restriction base="xsd:string"/> + </xsd:simpleType> + <xsd:simpleType name="KeyStorageType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="Software"/> + <xsd:enumeration value="Hardware"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="MimeTypeType"> + <xsd:restriction base="xsd:token"/> + </xsd:simpleType> + <xsd:complexType name="AnyChildrenType" mixed="true"> + <xsd:sequence> + <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="XMLContentType" mixed="true"> + <xsd:complexContent> + <xsd:extension base="AnyChildrenType"> + <xsd:attribute ref="xml:space" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentBaseType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + <xsd:element name="LocRefContent" type="xsd:anyURI"/> + </xsd:choice> + </xsd:complexType> + <xsd:complexType name="ContentExLocRefBaseType"> + <xsd:complexContent> + <xsd:restriction base="ContentBaseType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + </xsd:choice> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentOptionalRefType"> + <xsd:complexContent> + <xsd:extension base="ContentBaseType"> + <xsd:attribute name="Reference" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentRequiredRefType"> + <xsd:complexContent> + <xsd:restriction base="ContentOptionalRefType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + <xsd:element name="LocRefContent" type="xsd:anyURI"/> + </xsd:choice> + <xsd:attribute name="Reference" type="xsd:anyURI" use="required"/> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="VerifyTransformsDataType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ein oder mehrere Transformationswege können von + der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur + hat zumindest einem dieser Transformationswege zu entsprechen. Die + Angabe kann explizit oder als Profilbezeichner erfolgen. + </xsd:documentation> + </xsd:annotation> + <xsd:element ref="VerifyTransformsInfoProfile"/> + <xsd:element name="VerifyTransformsInfoProfileID" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Profilbezeichner für einen Transformationsweg + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:complexType> + <xsd:element name="QualifiedCertificate"> + <xsd:complexType> + <xsd:attribute name="source" use="optional"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="TSL"/> + <xsd:enumeration value="Certificate"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="SecureSignatureCreationDevice"> + <xsd:complexType> + <xsd:attribute name="source" use="optional"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="TSL"/> + <xsd:enumeration value="Certificate"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="IssuingCountry" type="xsd:token"/> + <xsd:element name="PublicAuthority" type="PublicAuthorityType"/> + <xsd:complexType name="PublicAuthorityType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="SignatoriesType"> + <xsd:union memberTypes="AllSignatoriesType"> + <xsd:simpleType> + <xsd:list itemType="xsd:positiveInteger"/> + </xsd:simpleType> + </xsd:union> + </xsd:simpleType> + <xsd:simpleType name="AllSignatoriesType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="all"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="CreateSignatureLocationType"> + <xsd:simpleContent> + <xsd:extension base="xsd:token"> + <xsd:attribute name="Index" type="xsd:integer" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:complexType name="TransformParameterType"> + <xsd:choice minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Die Angabe des Transformationsparameters + (explizit oder als Hashwert) kann unterlassen werden, wenn die + Applikation von der Unveränderlichkeit des Inhalts der in + "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen + kann.</xsd:documentation> + </xsd:annotation> + <xsd:element name="Base64Content" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Der Transformationsparameter explizit angegeben. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Hash"> + <xsd:annotation> + <xsd:documentation>Der Hashwert des Transformationsparameters. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="dsig:DigestMethod"/> + <xsd:element ref="dsig:DigestValue"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:choice> + <xsd:attribute name="URI" type="xsd:anyURI" use="required"/> + </xsd:complexType> + <xsd:element name="CreateSignatureEnvironmentProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateSignatureLocation" type="CreateSignatureLocationType"/> + <xsd:element name="Supplement" type="XMLDataObjectAssociationType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="VerifyTransformsInfoProfile"> + <xsd:annotation> + <xsd:documentation>Explizite Angabe des Transformationswegs + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="dsig:Transforms" minOccurs="0"/> + <xsd:element name="TransformParameter" type="TransformParameterType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Alle impliziten Transformationsparameter, die + zum Durchlaufen der oben angeführten Transformationskette + bekannt sein müssen, müssen hier angeführt werden. Das + Attribut "URI" bezeichnet den Transformationsparameter in exakt + jener Weise, wie er in der zu überprüfenden Signatur gebraucht + wird.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="Supplement" type="XMLDataObjectAssociationType"/> + <xsd:element name="SupplementProfile" type="XMLDataObjectAssociationType"/> + <xsd:element name="CreateTransformsInfoProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateTransformsInfo" type="TransformsInfoType"/> + <xsd:element ref="Supplement" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> +</xsd:schema> diff --git a/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.2.xsd b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.2.xsd new file mode 100644 index 0000000..69834b2 --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-3.1.2.xsd @@ -0,0 +1,839 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- MOA SP/SS 2.0.0 Schema --> +<xsd:schema xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://reference.e-government.gv.at/namespace/moa/20020822#" targetNamespace="http://reference.e-government.gv.at/namespace/moa/20020822#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.2"> + <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> + <!--########## Create CMS Signature ### --> + <!--### Create CMS Signature Request ### --> + <xsd:element name="CreateCMSSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreateCMSSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreateCMSSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="DataObjectInfo"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CMSDataObjectInfoType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="SecurityLayerConformity" type="xsd:boolean" use="optional" default="true"/> + <xsd:attribute name="PAdESConformity" type="xsd:boolean" use="optional" default="false"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create CMS Signature Response ### --> + <xsd:element name="CreateCMSSignatureResponse" type="CreateCMSSignatureResponseType"/> + <xsd:complexType name="CreateCMSSignatureResponseType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Kardinalität 1..oo erlaubt die Antwort auf eine + Stapelsignatur-Anfrage</xsd:documentation> + </xsd:annotation> + <xsd:element name="CMSSignature" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:complexType> + <!--########## Create XML Signature ### --> + <!--### Create XML Signature Request ### --> + <xsd:element name="CreateXMLSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreateXMLSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreateXMLSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="DataObjectInfo" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="DataObjectInfoType"> + <xsd:attribute name="ChildOfManifest" type="xsd:boolean" use="optional" default="false"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:element name="CreateSignatureInfo" minOccurs="0"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateSignatureEnvironment" type="ContentOptionalRefType"/> + <xsd:choice> + <xsd:annotation> + <xsd:documentation>Auswahl: Entweder explizite Angabe des + Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit + der Signaturumgebung, oder Verweis auf ein benanntes Profil + </xsd:documentation> + </xsd:annotation> + <xsd:element ref="CreateSignatureEnvironmentProfile"/> + <xsd:element name="CreateSignatureEnvironmentProfileID" type="ProfileIdentifierType"/> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="SecurityLayerConformity" type="xsd:boolean" use="optional" default="true"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create XML Signature Response ### --> + <xsd:complexType name="CreateXMLSignatureResponseType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Kardinalität 1..oo erlaubt die Antwort auf eine + Stapelsignatur-Anfrage</xsd:documentation> + </xsd:annotation> + <xsd:element name="SignatureEnvironment"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:any namespace="##any" processContents="lax"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:complexType> + <xsd:element name="CreateXMLSignatureResponse" type="CreateXMLSignatureResponseType"/> + <!--########## Create PDF Signature ### --> + <!--### Create PDF Signature Request ### --> + <xsd:element name="CreatePDFSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CreatePDFSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="CreatePDFSignatureRequestType"> + <xsd:sequence> + <xsd:element name="KeyIdentifier" type="KeyIdentifierType"/> + <xsd:element name="SingleSignatureInfo" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ermöglichung der Stapelsignatur durch + wiederholte Angabe dieses Elements</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="PDFDocument" type="xsd:base64Binary"/> + <xsd:element name="SignatureProfile" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignaturePosition" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureID" type="xsd:string" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Create PDF Signature Response ### --> + <xsd:element name="CreatePDFSignatureResponse" type="CreatePDFSignatureResponseType"/> + <xsd:complexType name="CreatePDFSignatureResponseType"> + <xsd:sequence> + <xsd:element name="PDFSignature" type="PDFSignedRepsonse" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify CMS Signature ### --> + <!--### Verifiy CMS Signature Request ### --> + <xsd:element name="VerifyCMSSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyCMSSignatureRequestType"> + <xsd:attribute name="Signatories" type="SignatoriesType" use="optional" default="1"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyCMSSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="CMSSignature" type="xsd:base64Binary"/> + <xsd:element name="DataObject" type="CMSDataObjectOptionalMetaType" minOccurs="0"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify CMS Signature Response ### --> + <xsd:element name="VerifyCMSSignatureResponse" type="VerifyCMSSignatureResponseType"/> + <xsd:complexType name="VerifyCMSSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SignatureAlgorithm" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="VerifyASICCMSSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any, + TSLInformation is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify PDF Signature ### --> + <!--### Verifiy PDF Signature Request ### --> + <xsd:element name="VerifyPDFSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyPDFSignatureRequestType"> + <xsd:attribute name="Signatories" type="SignatoriesType" use="optional" default="1"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyPDFSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="PDFSignature" type="xsd:base64Binary"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify PDF Signature ### --> + <!--### Verifiy ASIC Signature Request ### --> + <xsd:element name="VerifyASICSignatureRequest"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="VerifyASICSignatureRequestType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:complexType name="VerifyASICSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="ASICSignature" type="xsd:base64Binary"/> + <xsd:element name="ASICExtension" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>asics or asice</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify ASIC Signature Response ### --> + <xsd:element name="VerifyASICSignatureResponse" type="VerifyASICSignatureResponseType"/> + <xsd:complexType name="VerifyASICSignatureResponseType"> + <xsd:sequence> + <xsd:element name="ASiCSignatureResult" type="ASICResultType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!--xsd:complexType name="signedFilesType"> + <xsd:sequence> + <xsd:element name="signedFiles" type="xsd:string"> + </xsd:sequence> + <xsd:attribute name="hashAlgorithm" type="xsd:string" use="optional"/> + </xsd:complexType--> + <xsd:complexType name="ASICResultType"> + <xsd:sequence> + <xsd:element name="signedFiles" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="hashAlgorithm" type="xsd:string" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + </xsd:element> + <xsd:element name="XMLSignatureResult" type="VerifyASICXMLSignatureResponseType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CMSSignatureResult" type="VerifyASICCMSSignatureResponseType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!--### Verify CMS Signature Response ### --> + <xsd:element name="VerifyPDFSignatureResponse" type="VerifyPDFSignatureResponseType"/> + <xsd:complexType name="VerifyPDFSignatureResponseType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="SignatureResult" type="PDFSignatureResultType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="PDFSignatureResultType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and RetrievalMethod is + supported; QualifiedCertificate is included as + X509Data/any;publicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="SignatureAlgorithm" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureCheck" type="CheckResultType"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureProperties" type="PDFSignatureProperties" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="PDFSignatureProperties"> + <xsd:sequence> + <xsd:element name="SignatureCoversFullPDF" type="xsd:boolean" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureByteRange" type="xsd:string" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Verify XML Signature ### --> + <!--### Verify XML Signature Request ### --> + <xsd:element name="VerifyXMLSignatureRequest" type="VerifyXMLSignatureRequestType"/> + <xsd:complexType name="VerifyXMLSignatureRequestType"> + <xsd:sequence> + <xsd:element name="DateTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="ExtendedValidation" type="xsd:boolean" default="false" minOccurs="0"/> + <xsd:element name="VerifySignatureInfo"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="VerifySignatureEnvironment" type="ContentOptionalRefType"/> + <xsd:element name="VerifySignatureLocation" type="xsd:token"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="SupplementProfile"/> + <xsd:element name="SupplementProfileID" type="xsd:string"/> + </xsd:choice> + <xsd:element name="SignatureManifestCheckParams" minOccurs="0"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="ReferenceInfo" type="VerifyTransformsDataType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Pro dsig:Reference-Element in der zu + überprüfenden XML-Signatur muss hier ein + ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen + ReferenceInfo Elemente entspricht jener der dsig:Reference + Elemente in der XML-Signatur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="ReturnReferenceInputData" type="xsd:boolean" use="optional" default="true"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="ReturnHashInputData" minOccurs="0"/> + <xsd:element name="TrustProfileID" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>mit diesem Profil wird eine Menge von + vertrauenswürdigen Wurzelzertifikaten spezifiziert + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!--### Verify XML Signature Response ### --> + <xsd:element name="VerifyXMLSignatureResponse" type="VerifyXMLSignatureResponseType"/> + <xsd:complexType name="VerifyXMLSignatureResponseType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and ds:RetrievalMethod is + supported; QualifiedCertificate is included as X509Data/any; + PublicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="HashInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferenceInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="SignatureAlgorithm" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="SignatureCheck" type="ReferencesCheckResultType"/> + <xsd:element name="SignatureManifestCheck" type="ReferencesCheckResultType" minOccurs="0"/> + <xsd:element name="XMLDSIGManifestCheck" type="ManifestRefsCheckResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="VerifyASICXMLSignatureResponseType"> + <xsd:sequence> + <xsd:element name="SignerInfo" type="dsig:KeyInfoType"> + <xsd:annotation> + <xsd:documentation>only ds:X509Data and ds:RetrievalMethod is + supported; QualifiedCertificate is included as X509Data/any; + PublicAuthority is included as X509Data/any; + SecureSignatureCreationDevice is included as X509Data/any, + IssuingCountry is included as X509Data/any</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/> + <xsd:element name="HashInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferenceInputData" type="InputDataType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="SignatureCheck" type="ReferencesCheckResultType"/> + <xsd:element name="SignatureManifestCheck" type="ReferencesCheckResultType" minOccurs="0"/> + <xsd:element name="XMLDSIGManifestCheck" type="ManifestRefsCheckResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="CertificateCheck" type="CheckResultType"/> + <xsd:element name="FormCheckResult" type="FormResultType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ExtendedCertificateCheck" type="ExtendedCertificateCheckResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="ProfileIdentifierType"> + <xsd:restriction base="xsd:token"/> + </xsd:simpleType> + <xsd:complexType name="InputDataType"> + <xsd:complexContent> + <xsd:extension base="ContentExLocRefBaseType"> + <xsd:attribute name="PartOf" use="optional" default="SignedInfo"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="SignedInfo"/> + <xsd:enumeration value="XMLDSIGManifest"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="ReferringSigReference" type="xsd:nonNegativeInteger" use="optional"/> + <xsd:attribute name="HashAlgorithm" type="xsd:string" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="MetaInfoType"> + <xsd:sequence> + <xsd:element name="MimeType" type="MimeTypeType"/> + <xsd:element name="Description" type="xsd:anyURI" minOccurs="0"/> + <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FinalDataMetaInfoType"> + <xsd:complexContent> + <xsd:extension base="MetaInfoType"> + <xsd:sequence> + <xsd:element name="Type" type="xsd:anyURI" minOccurs="0"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="DataObjectInfoType"> + <xsd:sequence> + <xsd:element name="DataObject"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="ContentOptionalRefType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:choice> + <xsd:annotation> + <xsd:documentation>Auswahl: Entweder explizite Angabe EINER + Transformationskette inklusive ggf. sinnvoller Supplements oder + Verweis auf ein benanntes Profil</xsd:documentation> + </xsd:annotation> + <xsd:element ref="CreateTransformsInfoProfile"/> + <xsd:element name="CreateTransformsInfoProfileID" type="ProfileIdentifierType"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Structure" use="required"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="detached"/> + <xsd:enumeration value="enveloping"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectInfoType"> + <xsd:sequence> + <xsd:element name="DataObject"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="CMSDataObjectRequiredMetaType"/> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Structure" use="required"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="detached"/> + <xsd:enumeration value="enveloping"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + <xsd:complexType name="TransformsInfoType"> + <xsd:sequence> + <xsd:element ref="dsig:Transforms" minOccurs="0"/> + <xsd:element name="FinalDataMetaInfo" type="FinalDataMetaInfoType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="XMLDataObjectAssociationType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType" minOccurs="0"/> + <xsd:element name="Content" type="ContentRequiredRefType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="PDFSignedRepsonse"> + <xsd:sequence> + <xsd:element name="SignatureID" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:choice maxOccurs="1"> + <xsd:element name="PDFSignature" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung + erfolgreich war</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="ErrorResponse"/> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectOptionalMetaType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType" minOccurs="0"/> + <xsd:element name="Content" type="CMSContentBaseType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSDataObjectRequiredMetaType"> + <xsd:sequence> + <xsd:element name="MetaInfo" type="MetaInfoType"/> + <xsd:element name="Content" type="CMSContentBaseType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CMSContentBaseType"> + <xsd:complexContent> + <xsd:restriction base="ContentOptionalRefType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + </xsd:choice> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="AnyChildrenType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FormResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="IndicationResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ExtendedCertificateCheckResultType"> + <xsd:sequence> + <xsd:element name="Major" type="IndicationResultType" minOccurs="1" maxOccurs="1"/> + <xsd:element name="Minor" type="IndicationResultType" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ReferencesCheckResultType"> + <xsd:complexContent> + <xsd:restriction base="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="ReferencesCheckResultInfoType" minOccurs="0"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ReferencesCheckResultInfoType" mixed="true"> + <xsd:complexContent> + <xsd:restriction base="AnyChildrenType"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="FailedReference" type="xsd:positiveInteger" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ManifestRefsCheckResultType"> + <xsd:complexContent> + <xsd:restriction base="CheckResultType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:nonNegativeInteger"/> + <xsd:element name="Info" type="ManifestRefsCheckResultInfoType"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ManifestRefsCheckResultInfoType" mixed="true"> + <xsd:complexContent> + <xsd:restriction base="AnyChildrenType"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="FailedReference" type="xsd:positiveInteger" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ReferringSigReference" type="xsd:positiveInteger"/> + </xsd:sequence> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <!--########## Error Response ### --> + <xsd:element name="ErrorResponse" type="ErrorResponseType"> + <xsd:annotation> + <xsd:documentation>Resultat, falls die Signaturerstellung gescheitert + ist</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ErrorResponseType"> + <xsd:sequence> + <xsd:element name="ErrorCode" type="xsd:integer"/> + <xsd:element name="Info" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + <!--########## Auxiliary Types ### --> + <xsd:simpleType name="KeyIdentifierType"> + <xsd:restriction base="xsd:string"/> + </xsd:simpleType> + <xsd:simpleType name="KeyStorageType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="Software"/> + <xsd:enumeration value="Hardware"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="MimeTypeType"> + <xsd:restriction base="xsd:token"/> + </xsd:simpleType> + <xsd:complexType name="AnyChildrenType" mixed="true"> + <xsd:sequence> + <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="XMLContentType" mixed="true"> + <xsd:complexContent> + <xsd:extension base="AnyChildrenType"> + <xsd:attribute ref="xml:space" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentBaseType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + <xsd:element name="LocRefContent" type="xsd:anyURI"/> + </xsd:choice> + </xsd:complexType> + <xsd:complexType name="ContentExLocRefBaseType"> + <xsd:complexContent> + <xsd:restriction base="ContentBaseType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + </xsd:choice> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentOptionalRefType"> + <xsd:complexContent> + <xsd:extension base="ContentBaseType"> + <xsd:attribute name="Reference" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ContentRequiredRefType"> + <xsd:complexContent> + <xsd:restriction base="ContentOptionalRefType"> + <xsd:choice minOccurs="0"> + <xsd:element name="Base64Content" type="xsd:base64Binary"/> + <xsd:element name="XMLContent" type="XMLContentType"/> + <xsd:element name="LocRefContent" type="xsd:anyURI"/> + </xsd:choice> + <xsd:attribute name="Reference" type="xsd:anyURI" use="required"/> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="VerifyTransformsDataType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Ein oder mehrere Transformationswege können von + der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur + hat zumindest einem dieser Transformationswege zu entsprechen. Die + Angabe kann explizit oder als Profilbezeichner erfolgen. + </xsd:documentation> + </xsd:annotation> + <xsd:element ref="VerifyTransformsInfoProfile"/> + <xsd:element name="VerifyTransformsInfoProfileID" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Profilbezeichner für einen Transformationsweg + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:complexType> + <xsd:element name="QualifiedCertificate"> + <xsd:complexType> + <xsd:attribute name="source" use="optional"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="TSL"/> + <xsd:enumeration value="Certificate"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="SecureSignatureCreationDevice"> + <xsd:complexType> + <xsd:attribute name="source" use="optional"> + <xsd:simpleType> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="TSL"/> + <xsd:enumeration value="Certificate"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="IssuingCountry" type="xsd:token"/> + <xsd:element name="PublicAuthority" type="PublicAuthorityType"/> + <xsd:complexType name="PublicAuthorityType"> + <xsd:sequence> + <xsd:element name="Code" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="SignatoriesType"> + <xsd:union memberTypes="AllSignatoriesType"> + <xsd:simpleType> + <xsd:list itemType="xsd:positiveInteger"/> + </xsd:simpleType> + </xsd:union> + </xsd:simpleType> + <xsd:simpleType name="AllSignatoriesType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="all"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="CreateSignatureLocationType"> + <xsd:simpleContent> + <xsd:extension base="xsd:token"> + <xsd:attribute name="Index" type="xsd:integer" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:complexType name="TransformParameterType"> + <xsd:choice minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Die Angabe des Transformationsparameters + (explizit oder als Hashwert) kann unterlassen werden, wenn die + Applikation von der Unveränderlichkeit des Inhalts der in + "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen + kann.</xsd:documentation> + </xsd:annotation> + <xsd:element name="Base64Content" type="xsd:base64Binary"> + <xsd:annotation> + <xsd:documentation>Der Transformationsparameter explizit angegeben. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Hash"> + <xsd:annotation> + <xsd:documentation>Der Hashwert des Transformationsparameters. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="dsig:DigestMethod"/> + <xsd:element ref="dsig:DigestValue"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:choice> + <xsd:attribute name="URI" type="xsd:anyURI" use="required"/> + </xsd:complexType> + <xsd:element name="CreateSignatureEnvironmentProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateSignatureLocation" type="CreateSignatureLocationType"/> + <xsd:element name="Supplement" type="XMLDataObjectAssociationType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="VerifyTransformsInfoProfile"> + <xsd:annotation> + <xsd:documentation>Explizite Angabe des Transformationswegs + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="dsig:Transforms" minOccurs="0"/> + <xsd:element name="TransformParameter" type="TransformParameterType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Alle impliziten Transformationsparameter, die + zum Durchlaufen der oben angeführten Transformationskette + bekannt sein müssen, müssen hier angeführt werden. Das + Attribut "URI" bezeichnet den Transformationsparameter in exakt + jener Weise, wie er in der zu überprüfenden Signatur gebraucht + wird.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="Supplement" type="XMLDataObjectAssociationType"/> + <xsd:element name="SupplementProfile" type="XMLDataObjectAssociationType"/> + <xsd:element name="CreateTransformsInfoProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreateTransformsInfo" type="TransformsInfoType"/> + <xsd:element ref="Supplement" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> +</xsd:schema> diff --git a/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.0.0.xsd b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.0.0.xsd index 1a1b74b..c9739d3 100644 --- a/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.0.0.xsd +++ b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.0.0.xsd @@ -145,6 +145,7 @@ <xs:complexType> <xs:sequence> <xs:element name="AutoAddCertificates" type="xs:boolean"/> + <xs:element name="AutoAddEECertificates" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="UseAuthorityInformationAccess" type="xs:boolean"/> <xs:element name="CertificateStore"> <xs:complexType> diff --git a/moaSig/common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd b/moaSig/common/src/main/resources/resources/schemas/XAdES01903v132-201601.xsd index 4aa67aa..e7a5f3a 100644 --- a/moaSig/common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd +++ b/moaSig/common/src/main/resources/resources/schemas/XAdES01903v132-201601.xsd @@ -1,533 +1,533 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.3.2#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified">
- <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
- <!-- Start auxiliary types definitions: AnyType, ObjectIdentifierType,
-EncapsulatedPKIDataType and containers for time-stamp tokens -->
- <!-- Start AnyType -->
- <xsd:element name="Any" type="AnyType"/>
- <xsd:complexType name="AnyType" mixed="true">
- <xsd:sequence minOccurs="0" maxOccurs="unbounded">
- <xsd:any namespace="##any" processContents="lax"/>
- </xsd:sequence>
- <xsd:anyAttribute namespace="##any"/>
- </xsd:complexType>
- <!-- End AnyType -->
- <!-- Start ObjectIdentifierType-->
- <xsd:element name="ObjectIdentifier" type="ObjectIdentifierType"/>
- <xsd:complexType name="ObjectIdentifierType">
- <xsd:sequence>
- <xsd:element name="Identifier" type="IdentifierType"/>
- <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
- <xsd:element name="DocumentationReferences" type="DocumentationReferencesType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="IdentifierType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:anyURI">
- <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- <xsd:simpleType name="QualifierType">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="OIDAsURI"/>
- <xsd:enumeration value="OIDAsURN"/>
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:complexType name="DocumentationReferencesType">
- <xsd:sequence maxOccurs="unbounded">
- <xsd:element name="DocumentationReference" type="xsd:anyURI"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End ObjectIdentifierType-->
- <!-- Start EncapsulatedPKIDataType-->
- <xsd:element name="EncapsulatedPKIData" type="EncapsulatedPKIDataType"/>
- <xsd:complexType name="EncapsulatedPKIDataType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:base64Binary">
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- <xsd:attribute name="Encoding" type="xsd:anyURI" use="optional"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- <!-- End EncapsulatedPKIDataType -->
- <!-- Start time-stamp containers types -->
- <!-- Start GenericTimeStampType -->
- <xsd:element name="Include" type="IncludeType"/>
- <xsd:complexType name="IncludeType">
- <xsd:attribute name="URI" type="xsd:anyURI" use="required"/>
- <xsd:attribute name="referencedData" type="xsd:boolean" use="optional"/>
- </xsd:complexType>
- <xsd:element name="ReferenceInfo" type="ReferenceInfoType"/>
- <xsd:complexType name="ReferenceInfoType">
- <xsd:sequence>
- <xsd:element ref="ds:DigestMethod"/>
- <xsd:element ref="ds:DigestValue"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="GenericTimeStampType" abstract="true">
- <xsd:sequence>
- <xsd:choice minOccurs="0">
- <xsd:element ref="Include" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="ReferenceInfo" maxOccurs="unbounded"/>
- </xsd:choice>
- <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/>
- <xsd:element name="XMLTimeStamp" type="AnyType"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End GenericTimeStampType -->
- <!-- Start XAdESTimeStampType -->
- <xsd:element name="XAdESTimeStamp" type="XAdESTimeStampType"/>
- <xsd:complexType name="XAdESTimeStampType">
- <xsd:complexContent>
- <xsd:restriction base="GenericTimeStampType">
- <xsd:sequence>
- <xsd:element ref="Include" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/>
- <xsd:element name="XMLTimeStamp" type="AnyType"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- <!-- End XAdESTimeStampType -->
- <!-- Start OtherTimeStampType -->
- <xsd:element name="OtherTimeStamp" type="OtherTimeStampType"/>
- <xsd:complexType name="OtherTimeStampType">
- <xsd:complexContent>
- <xsd:restriction base="GenericTimeStampType">
- <xsd:sequence>
- <xsd:element ref="ReferenceInfo" maxOccurs="unbounded"/>
- <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/>
- <xsd:choice>
- <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/>
- <xsd:element name="XMLTimeStamp" type="AnyType"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- <!-- End OtherTimeStampType -->
- <!-- End time-stamp containers types -->
- <!-- End auxiliary types definitions-->
- <!-- Start container types -->
- <!-- Start QualifyingProperties -->
- <xsd:element name="QualifyingProperties" type="QualifyingPropertiesType"/>
- <xsd:complexType name="QualifyingPropertiesType">
- <xsd:sequence>
- <xsd:element ref="SignedProperties" minOccurs="0"/>
- <xsd:element ref="UnsignedProperties" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Target" type="xsd:anyURI" use="required"/>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End QualifyingProperties -->
- <!-- Start SignedProperties-->
- <xsd:element name="SignedProperties" type="SignedPropertiesType"/>
- <xsd:complexType name="SignedPropertiesType">
- <xsd:sequence>
- <xsd:element ref="SignedSignatureProperties" minOccurs="0"/>
- <xsd:element ref="SignedDataObjectProperties" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End SignedProperties-->
- <!-- Start UnsignedProperties-->
- <xsd:element name="UnsignedProperties" type="UnsignedPropertiesType"/>
- <xsd:complexType name="UnsignedPropertiesType">
- <xsd:sequence>
- <xsd:element ref="UnsignedSignatureProperties" minOccurs="0"/>
- <xsd:element ref="UnsignedDataObjectProperties" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End UnsignedProperties-->
- <!-- Start SignedSignatureProperties-->
- <!-- Definition changed: added new optional children for EN -->
- <xsd:element name="SignedSignatureProperties" type="SignedSignaturePropertiesType"/>
- <xsd:complexType name="SignedSignaturePropertiesType">
- <xsd:sequence>
- <xsd:element ref="SigningTime" minOccurs="0"/>
- <xsd:element ref="SigningCertificate" minOccurs="0"/>
- <xsd:element ref="SigningCertificateV2" minOccurs="0"/>
- <xsd:element ref="SignaturePolicyIdentifier" minOccurs="0"/>
- <xsd:element ref="SignatureProductionPlace" minOccurs="0"/>
- <xsd:element ref="SignatureProductionPlaceV2" minOccurs="0"/>
- <xsd:element ref="SignerRole" minOccurs="0"/>
- <xsd:element ref="SignerRoleV2" minOccurs="0"/>
- <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End SignedSignatureProperties-->
- <!-- Start SignedDataObjectProperties-->
- <xsd:element name="SignedDataObjectProperties" type="SignedDataObjectPropertiesType"/>
- <xsd:complexType name="SignedDataObjectPropertiesType">
- <xsd:sequence>
- <xsd:element ref="DataObjectFormat" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="CommitmentTypeIndication" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="AllDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="IndividualDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End SignedDataObjectProperties-->
- <!-- Start UnsignedSignatureProperties-->
- <xsd:element name="UnsignedSignatureProperties" type="UnsignedSignaturePropertiesType"/>
- <xsd:complexType name="UnsignedSignaturePropertiesType">
- <xsd:choice maxOccurs="unbounded">
- <xsd:element ref="CounterSignature"/>
- <xsd:element ref="SignatureTimeStamp"/>
- <xsd:element ref="CompleteCertificateRefs"/>
- <xsd:element ref="CompleteRevocationRefs"/>
- <xsd:element ref="AttributeCertificateRefs"/>
- <xsd:element ref="AttributeRevocationRefs"/>
- <xsd:element ref="SigAndRefsTimeStamp"/>
- <xsd:element ref="RefsOnlyTimeStamp"/>
- <xsd:element ref="CertificateValues"/>
- <xsd:element ref="RevocationValues"/>
- <xsd:element ref="AttrAuthoritiesCertValues"/>
- <xsd:element ref="AttributeRevocationValues"/>
- <xsd:element ref="ArchiveTimeStamp"/>
- <xsd:any namespace="##other"/>
- </xsd:choice>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End UnsignedSignatureProperties-->
- <!-- Start UnsignedDataObjectProperties-->
- <xsd:element name="UnsignedDataObjectProperties" type="UnsignedDataObjectPropertiesType"/>
- <xsd:complexType name="UnsignedDataObjectPropertiesType">
- <xsd:sequence>
- <xsd:element name="UnsignedDataObjectProperty" type="AnyType" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End UnsignedDataObjectProperties-->
- <!-- Start QualifyingPropertiesReference-->
- <xsd:element name="QualifyingPropertiesReference" type="QualifyingPropertiesReferenceType"/>
- <xsd:complexType name="QualifyingPropertiesReferenceType">
- <xsd:attribute name="URI" type="xsd:anyURI" use="required"/>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End QualifyingPropertiesReference-->
- <!-- End container types -->
- <!-- Start SigningTime element -->
- <xsd:element name="SigningTime" type="xsd:dateTime"/>
- <!-- End SigningTime element -->
- <!-- Start SigningCertificate -->
- <xsd:element name="SigningCertificate" type="CertIDListType"/>
- <xsd:complexType name="CertIDListType">
- <xsd:sequence>
- <xsd:element name="Cert" type="CertIDType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CertIDType">
- <xsd:sequence>
- <xsd:element name="CertDigest" type="DigestAlgAndValueType"/>
- <xsd:element name="IssuerSerial" type="ds:X509IssuerSerialType"/>
- </xsd:sequence>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="DigestAlgAndValueType">
- <xsd:sequence>
- <xsd:element ref="ds:DigestMethod"/>
- <xsd:element ref="ds:DigestValue"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End SigningCertificate -->
- <!-- Start SigningCertificateV2 and CertIDListV2Type -->
- <xsd:element name="SigningCertificateV2" type="CertIDListV2Type"/>
- <xsd:complexType name="CertIDListV2Type">
- <xsd:sequence>
- <xsd:element name="Cert" type="CertIDTypeV2" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CertIDTypeV2">
- <xsd:sequence>
- <xsd:element name="CertDigest" type="DigestAlgAndValueType"/>
- <xsd:element name="IssuerSerialV2" type="xsd:base64Binary" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <!-- End SigningCertificateV2 and CertIDListV2Type -->
- <!-- Start SignaturePolicyIdentifier -->
- <xsd:element name="SignaturePolicyIdentifier" type="SignaturePolicyIdentifierType"/>
- <xsd:complexType name="SignaturePolicyIdentifierType">
- <xsd:choice>
- <xsd:element name="SignaturePolicyId" type="SignaturePolicyIdType"/>
- <xsd:element name="SignaturePolicyImplied"/>
- </xsd:choice>
- </xsd:complexType>
- <xsd:complexType name="SignaturePolicyIdType">
- <xsd:sequence>
- <xsd:element name="SigPolicyId" type="ObjectIdentifierType"/>
- <xsd:element ref="ds:Transforms" minOccurs="0"/>
- <xsd:element name="SigPolicyHash" type="DigestAlgAndValueType"/>
- <xsd:element name="SigPolicyQualifiers" type="SigPolicyQualifiersListType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="SigPolicyQualifiersListType">
- <xsd:sequence>
- <xsd:element name="SigPolicyQualifier" type="AnyType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="SPURI" type="xsd:anyURI"/>
- <xsd:element name="SPUserNotice" type="SPUserNoticeType"/>
- <xsd:complexType name="SPUserNoticeType">
- <xsd:sequence>
- <xsd:element name="NoticeRef" type="NoticeReferenceType" minOccurs="0"/>
- <xsd:element name="ExplicitText" type="xsd:string" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="NoticeReferenceType">
- <xsd:sequence>
- <xsd:element name="Organization" type="xsd:string"/>
- <xsd:element name="NoticeNumbers" type="IntegerListType"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="IntegerListType">
- <xsd:sequence>
- <xsd:element name="int" type="xsd:integer" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End SignaturePolicyIdentifier -->
- <!-- Start CounterSignature -->
- <xsd:element name="CounterSignature" type="CounterSignatureType"/>
- <xsd:complexType name="CounterSignatureType">
- <xsd:sequence>
- <xsd:element ref="ds:Signature"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End CounterSignature -->
- <!-- Start DataObjectFormat -->
- <xsd:element name="DataObjectFormat" type="DataObjectFormatType"/>
- <xsd:complexType name="DataObjectFormatType">
- <xsd:sequence>
- <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
- <xsd:element name="ObjectIdentifier" type="ObjectIdentifierType" minOccurs="0"/>
- <xsd:element name="MimeType" type="xsd:string" minOccurs="0"/>
- <xsd:element name="Encoding" type="xsd:anyURI" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="ObjectReference" type="xsd:anyURI" use="required"/>
- </xsd:complexType>
- <!-- End DataObjectFormat -->
- <!-- Start CommitmentTypeIndication -->
- <xsd:element name="CommitmentTypeIndication" type="CommitmentTypeIndicationType"/>
- <xsd:complexType name="CommitmentTypeIndicationType">
- <xsd:sequence>
- <xsd:element name="CommitmentTypeId" type="ObjectIdentifierType"/>
- <xsd:choice>
- <xsd:element name="ObjectReference" type="xsd:anyURI" maxOccurs="unbounded"/>
- <xsd:element name="AllSignedDataObjects"/>
- </xsd:choice>
- <xsd:element name="CommitmentTypeQualifiers" type="CommitmentTypeQualifiersListType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CommitmentTypeQualifiersListType">
- <xsd:sequence>
- <xsd:element name="CommitmentTypeQualifier" type="AnyType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End CommitmentTypeIndication -->
- <!-- Start SignatureProductionPlace -->
- <xsd:element name="SignatureProductionPlace" type="SignatureProductionPlaceType"/>
- <xsd:complexType name="SignatureProductionPlaceType">
- <xsd:sequence>
- <xsd:element name="City" type="xsd:string" minOccurs="0"/>
- <xsd:element name="StateOrProvince" type="xsd:string" minOccurs="0"/>
- <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
- <xsd:element name="CountryName" type="xsd:string" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End SignatureProductionPlace -->
- <!-- Start SignatureProductionPlaceV2 and SignatureProductionPlaceV2Type -->
- <xsd:element name="SignatureProductionPlaceV2" type="SignatureProductionPlaceV2Type"/>
- <xsd:complexType name="SignatureProductionPlaceV2Type">
- <xsd:sequence>
- <xsd:element name="City" type="xsd:string" minOccurs="0"/>
- <xsd:element name="StreetAddress" type="xsd:string" minOccurs="0"/>
- <xsd:element name="StateOrProvince" type="xsd:string" minOccurs="0"/>
- <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
- <xsd:element name="CountryName" type="xsd:string" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End SignatureProductionPlace -->
- <!-- Start SignerRole -->
- <xsd:element name="SignerRole" type="SignerRoleType"/>
- <xsd:complexType name="SignerRoleType">
- <xsd:sequence>
- <xsd:element name="ClaimedRoles" type="ClaimedRolesListType" minOccurs="0"/>
- <xsd:element name="CertifiedRoles" type="CertifiedRolesListType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ClaimedRolesListType">
- <xsd:sequence>
- <xsd:element name="ClaimedRole" type="AnyType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CertifiedRolesListType">
- <xsd:sequence>
- <xsd:element name="CertifiedRole" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End SignerRole -->
- <!-- Start SignerRoleV2 and SignerRoleV2Type -->
- <xsd:element name="SignerRoleV2" type="SignerRoleV2Type"/>
- <xsd:complexType name="SignerRoleV2Type">
- <xsd:sequence>
- <xsd:element ref="ClaimedRoles" minOccurs="0"/>
- <xsd:element ref="CertifiedRolesV2" minOccurs="0"/>
- <xsd:element ref="SignedAssertions" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="ClaimedRoles" type="ClaimedRolesListType"/>
- <xsd:element name="CertifiedRolesV2" type="CertifiedRolesListTypeV2"/>
- <xsd:element name="SignedAssertions" type="SignedAssertionsListType"/>
- <xsd:complexType name="CertifiedRolesListTypeV2">
- <xsd:sequence>
- <xsd:element name="CertifiedRole" type="CertifiedRoleTypeV2" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CertifiedRoleTypeV2">
- <xsd:choice>
- <xsd:element ref="X509AttributeCertificate"/>
- <xsd:element ref="OtherAttributeCertificate"/>
- </xsd:choice>
- </xsd:complexType>
- <xsd:element name="X509AttributeCertificate" type="EncapsulatedPKIDataType"/>
- <xsd:element name="OtherAttributeCertificate" type="AnyType"/>
- <xsd:complexType name="SignedAssertionsListType">
- <xsd:sequence>
- <xsd:element ref="SignedAssertion" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="SignedAssertion" type="AnyType"/>
- <!-- End SignerRoleV2 and SignerRoleV2Type -->
- <xsd:element name="AllDataObjectsTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="IndividualDataObjectsTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="SignatureTimeStamp" type="XAdESTimeStampType"/>
- <!-- Start CompleteCertificateRefs -->
- <xsd:element name="CompleteCertificateRefs" type="CompleteCertificateRefsType"/>
- <xsd:complexType name="CompleteCertificateRefsType">
- <xsd:sequence>
- <xsd:element name="CertRefs" type="CertIDListType"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End CompleteCertificateRefs -->
- <!-- Start CompleteRevocationRefs-->
- <xsd:element name="CompleteRevocationRefs" type="CompleteRevocationRefsType"/>
- <xsd:complexType name="CompleteRevocationRefsType">
- <xsd:sequence>
- <xsd:element name="CRLRefs" type="CRLRefsType" minOccurs="0"/>
- <xsd:element name="OCSPRefs" type="OCSPRefsType" minOccurs="0"/>
- <xsd:element name="OtherRefs" type="OtherCertStatusRefsType" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="CRLRefsType">
- <xsd:sequence>
- <xsd:element name="CRLRef" type="CRLRefType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CRLRefType">
- <xsd:sequence>
- <xsd:element name="DigestAlgAndValue" type="DigestAlgAndValueType"/>
- <xsd:element name="CRLIdentifier" type="CRLIdentifierType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="CRLIdentifierType">
- <xsd:sequence>
- <xsd:element name="Issuer" type="xsd:string"/>
- <xsd:element name="IssueTime" type="xsd:dateTime"/>
- <xsd:element name="Number" type="xsd:integer" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="OCSPRefsType">
- <xsd:sequence>
- <xsd:element name="OCSPRef" type="OCSPRefType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="OCSPRefType">
- <xsd:sequence>
- <xsd:element name="OCSPIdentifier" type="OCSPIdentifierType"/>
- <xsd:element name="DigestAlgAndValue" type="DigestAlgAndValueType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ResponderIDType">
- <xsd:choice>
- <xsd:element name="ByName" type="xsd:string"/>
- <xsd:element name="ByKey" type="xsd:base64Binary"/>
- </xsd:choice>
- </xsd:complexType>
- <xsd:complexType name="OCSPIdentifierType">
- <xsd:sequence>
- <xsd:element name="ResponderID" type="ResponderIDType"/>
- <xsd:element name="ProducedAt" type="xsd:dateTime"/>
- </xsd:sequence>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="OtherCertStatusRefsType">
- <xsd:sequence>
- <xsd:element name="OtherRef" type="AnyType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End CompleteRevocationRefs-->
- <xsd:element name="AttributeCertificateRefs" type="CompleteCertificateRefsType"/>
- <xsd:element name="AttributeRevocationRefs" type="CompleteRevocationRefsType"/>
- <xsd:element name="SigAndRefsTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="RefsOnlyTimeStamp" type="XAdESTimeStampType"/>
- <!-- Start CertificateValues -->
- <xsd:element name="CertificateValues" type="CertificateValuesType"/>
- <xsd:complexType name="CertificateValuesType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="EncapsulatedX509Certificate" type="EncapsulatedPKIDataType"/>
- <xsd:element name="OtherCertificate" type="AnyType"/>
- </xsd:choice>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- End CertificateValues -->
- <!-- Start RevocationValues-->
- <xsd:element name="RevocationValues" type="RevocationValuesType"/>
- <xsd:complexType name="RevocationValuesType">
- <xsd:sequence>
- <xsd:element name="CRLValues" type="CRLValuesType" minOccurs="0"/>
- <xsd:element name="OCSPValues" type="OCSPValuesType" minOccurs="0"/>
- <xsd:element name="OtherValues" type="OtherCertStatusValuesType" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <xsd:complexType name="CRLValuesType">
- <xsd:sequence>
- <xsd:element name="EncapsulatedCRLValue" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="OCSPValuesType">
- <xsd:sequence>
- <xsd:element name="EncapsulatedOCSPValue" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="OtherCertStatusValuesType">
- <xsd:sequence>
- <xsd:element name="OtherValue" type="AnyType" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <!-- End RevocationValues-->
- <xsd:element name="AttrAuthoritiesCertValues" type="CertificateValuesType"/>
- <xsd:element name="AttributeRevocationValues" type="RevocationValuesType"/>
- <xsd:element name="ArchiveTimeStamp" type="XAdESTimeStampType"/>
-</xsd:schema>
-
+<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.3.2#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified"> + <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"/> + <!-- Start auxiliary types definitions: AnyType, ObjectIdentifierType, +EncapsulatedPKIDataType and containers for time-stamp tokens --> + <!-- Start AnyType --> + <xsd:element name="Any" type="AnyType"/> + <xsd:complexType name="AnyType" mixed="true"> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:any namespace="##any" processContents="lax"/> + </xsd:sequence> + <xsd:anyAttribute namespace="##any"/> + </xsd:complexType> + <!-- End AnyType --> + <!-- Start ObjectIdentifierType--> + <xsd:element name="ObjectIdentifier" type="ObjectIdentifierType"/> + <xsd:complexType name="ObjectIdentifierType"> + <xsd:sequence> + <xsd:element name="Identifier" type="IdentifierType"/> + <xsd:element name="Description" type="xsd:string" minOccurs="0"/> + <xsd:element name="DocumentationReferences" type="DocumentationReferencesType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="IdentifierType"> + <xsd:simpleContent> + <xsd:extension base="xsd:anyURI"> + <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:simpleType name="QualifierType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="OIDAsURI"/> + <xsd:enumeration value="OIDAsURN"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="DocumentationReferencesType"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="DocumentationReference" type="xsd:anyURI"/> + </xsd:sequence> + </xsd:complexType> + <!-- End ObjectIdentifierType--> + <!-- Start EncapsulatedPKIDataType--> + <xsd:element name="EncapsulatedPKIData" type="EncapsulatedPKIDataType"/> + <xsd:complexType name="EncapsulatedPKIDataType"> + <xsd:simpleContent> + <xsd:extension base="xsd:base64Binary"> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + <xsd:attribute name="Encoding" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <!-- End EncapsulatedPKIDataType --> + <!-- Start time-stamp containers types --> + <!-- Start GenericTimeStampType --> + <xsd:element name="Include" type="IncludeType"/> + <xsd:complexType name="IncludeType"> + <xsd:attribute name="URI" type="xsd:anyURI" use="required"/> + <xsd:attribute name="referencedData" type="xsd:boolean" use="optional"/> + </xsd:complexType> + <xsd:element name="ReferenceInfo" type="ReferenceInfoType"/> + <xsd:complexType name="ReferenceInfoType"> + <xsd:sequence> + <xsd:element ref="ds:DigestMethod"/> + <xsd:element ref="ds:DigestValue"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <xsd:complexType name="GenericTimeStampType" abstract="true"> + <xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:element ref="Include" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="ReferenceInfo" maxOccurs="unbounded"/> + </xsd:choice> + <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/> + <xsd:element name="XMLTimeStamp" type="AnyType"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End GenericTimeStampType --> + <!-- Start XAdESTimeStampType --> + <xsd:element name="XAdESTimeStamp" type="XAdESTimeStampType"/> + <xsd:complexType name="XAdESTimeStampType"> + <xsd:complexContent> + <xsd:restriction base="GenericTimeStampType"> + <xsd:sequence> + <xsd:element ref="Include" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/> + <xsd:element name="XMLTimeStamp" type="AnyType"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <!-- End XAdESTimeStampType --> + <!-- Start OtherTimeStampType --> + <xsd:element name="OtherTimeStamp" type="OtherTimeStampType"/> + <xsd:complexType name="OtherTimeStampType"> + <xsd:complexContent> + <xsd:restriction base="GenericTimeStampType"> + <xsd:sequence> + <xsd:element ref="ReferenceInfo" maxOccurs="unbounded"/> + <xsd:element ref="ds:CanonicalizationMethod" minOccurs="0"/> + <xsd:choice> + <xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/> + <xsd:element name="XMLTimeStamp" type="AnyType"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <!-- End OtherTimeStampType --> + <!-- End time-stamp containers types --> + <!-- End auxiliary types definitions--> + <!-- Start container types --> + <!-- Start QualifyingProperties --> + <xsd:element name="QualifyingProperties" type="QualifyingPropertiesType"/> + <xsd:complexType name="QualifyingPropertiesType"> + <xsd:sequence> + <xsd:element ref="SignedProperties" minOccurs="0"/> + <xsd:element ref="UnsignedProperties" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Target" type="xsd:anyURI" use="required"/> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End QualifyingProperties --> + <!-- Start SignedProperties--> + <xsd:element name="SignedProperties" type="SignedPropertiesType"/> + <xsd:complexType name="SignedPropertiesType"> + <xsd:sequence> + <xsd:element ref="SignedSignatureProperties" minOccurs="0"/> + <xsd:element ref="SignedDataObjectProperties" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End SignedProperties--> + <!-- Start UnsignedProperties--> + <xsd:element name="UnsignedProperties" type="UnsignedPropertiesType"/> + <xsd:complexType name="UnsignedPropertiesType"> + <xsd:sequence> + <xsd:element ref="UnsignedSignatureProperties" minOccurs="0"/> + <xsd:element ref="UnsignedDataObjectProperties" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End UnsignedProperties--> + <!-- Start SignedSignatureProperties--> + <!-- Definition changed: added new optional children for EN --> + <xsd:element name="SignedSignatureProperties" type="SignedSignaturePropertiesType"/> + <xsd:complexType name="SignedSignaturePropertiesType"> + <xsd:sequence> + <xsd:element ref="SigningTime" minOccurs="0"/> + <xsd:element ref="SigningCertificate" minOccurs="0"/> + <xsd:element ref="SigningCertificateV2" minOccurs="0"/> + <xsd:element ref="SignaturePolicyIdentifier" minOccurs="0"/> + <xsd:element ref="SignatureProductionPlace" minOccurs="0"/> + <xsd:element ref="SignatureProductionPlaceV2" minOccurs="0"/> + <xsd:element ref="SignerRole" minOccurs="0"/> + <xsd:element ref="SignerRoleV2" minOccurs="0"/> + <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End SignedSignatureProperties--> + <!-- Start SignedDataObjectProperties--> + <xsd:element name="SignedDataObjectProperties" type="SignedDataObjectPropertiesType"/> + <xsd:complexType name="SignedDataObjectPropertiesType"> + <xsd:sequence> + <xsd:element ref="DataObjectFormat" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="CommitmentTypeIndication" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="AllDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="IndividualDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/> + <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End SignedDataObjectProperties--> + <!-- Start UnsignedSignatureProperties--> + <xsd:element name="UnsignedSignatureProperties" type="UnsignedSignaturePropertiesType"/> + <xsd:complexType name="UnsignedSignaturePropertiesType"> + <xsd:choice maxOccurs="unbounded"> + <xsd:element ref="CounterSignature"/> + <xsd:element ref="SignatureTimeStamp"/> + <xsd:element ref="CompleteCertificateRefs"/> + <xsd:element ref="CompleteRevocationRefs"/> + <xsd:element ref="AttributeCertificateRefs"/> + <xsd:element ref="AttributeRevocationRefs"/> + <xsd:element ref="SigAndRefsTimeStamp"/> + <xsd:element ref="RefsOnlyTimeStamp"/> + <xsd:element ref="CertificateValues"/> + <xsd:element ref="RevocationValues"/> + <xsd:element ref="AttrAuthoritiesCertValues"/> + <xsd:element ref="AttributeRevocationValues"/> + <xsd:element ref="ArchiveTimeStamp"/> + <xsd:any namespace="##other"/> + </xsd:choice> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End UnsignedSignatureProperties--> + <!-- Start UnsignedDataObjectProperties--> + <xsd:element name="UnsignedDataObjectProperties" type="UnsignedDataObjectPropertiesType"/> + <xsd:complexType name="UnsignedDataObjectPropertiesType"> + <xsd:sequence> + <xsd:element name="UnsignedDataObjectProperty" type="AnyType" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End UnsignedDataObjectProperties--> + <!-- Start QualifyingPropertiesReference--> + <xsd:element name="QualifyingPropertiesReference" type="QualifyingPropertiesReferenceType"/> + <xsd:complexType name="QualifyingPropertiesReferenceType"> + <xsd:attribute name="URI" type="xsd:anyURI" use="required"/> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End QualifyingPropertiesReference--> + <!-- End container types --> + <!-- Start SigningTime element --> + <xsd:element name="SigningTime" type="xsd:dateTime"/> + <!-- End SigningTime element --> + <!-- Start SigningCertificate --> + <xsd:element name="SigningCertificate" type="CertIDListType"/> + <xsd:complexType name="CertIDListType"> + <xsd:sequence> + <xsd:element name="Cert" type="CertIDType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CertIDType"> + <xsd:sequence> + <xsd:element name="CertDigest" type="DigestAlgAndValueType"/> + <xsd:element name="IssuerSerial" type="ds:X509IssuerSerialType"/> + </xsd:sequence> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <xsd:complexType name="DigestAlgAndValueType"> + <xsd:sequence> + <xsd:element ref="ds:DigestMethod"/> + <xsd:element ref="ds:DigestValue"/> + </xsd:sequence> + </xsd:complexType> + <!-- End SigningCertificate --> + <!-- Start SigningCertificateV2 and CertIDListV2Type --> + <xsd:element name="SigningCertificateV2" type="CertIDListV2Type"/> + <xsd:complexType name="CertIDListV2Type"> + <xsd:sequence> + <xsd:element name="Cert" type="CertIDTypeV2" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CertIDTypeV2"> + <xsd:sequence> + <xsd:element name="CertDigest" type="DigestAlgAndValueType"/> + <xsd:element name="IssuerSerialV2" type="xsd:base64Binary" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <!-- End SigningCertificateV2 and CertIDListV2Type --> + <!-- Start SignaturePolicyIdentifier --> + <xsd:element name="SignaturePolicyIdentifier" type="SignaturePolicyIdentifierType"/> + <xsd:complexType name="SignaturePolicyIdentifierType"> + <xsd:choice> + <xsd:element name="SignaturePolicyId" type="SignaturePolicyIdType"/> + <xsd:element name="SignaturePolicyImplied"/> + </xsd:choice> + </xsd:complexType> + <xsd:complexType name="SignaturePolicyIdType"> + <xsd:sequence> + <xsd:element name="SigPolicyId" type="ObjectIdentifierType"/> + <xsd:element ref="ds:Transforms" minOccurs="0"/> + <xsd:element name="SigPolicyHash" type="DigestAlgAndValueType"/> + <xsd:element name="SigPolicyQualifiers" type="SigPolicyQualifiersListType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="SigPolicyQualifiersListType"> + <xsd:sequence> + <xsd:element name="SigPolicyQualifier" type="AnyType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="SPURI" type="xsd:anyURI"/> + <xsd:element name="SPUserNotice" type="SPUserNoticeType"/> + <xsd:complexType name="SPUserNoticeType"> + <xsd:sequence> + <xsd:element name="NoticeRef" type="NoticeReferenceType" minOccurs="0"/> + <xsd:element name="ExplicitText" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="NoticeReferenceType"> + <xsd:sequence> + <xsd:element name="Organization" type="xsd:string"/> + <xsd:element name="NoticeNumbers" type="IntegerListType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="IntegerListType"> + <xsd:sequence> + <xsd:element name="int" type="xsd:integer" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!-- End SignaturePolicyIdentifier --> + <!-- Start CounterSignature --> + <xsd:element name="CounterSignature" type="CounterSignatureType"/> + <xsd:complexType name="CounterSignatureType"> + <xsd:sequence> + <xsd:element ref="ds:Signature"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End CounterSignature --> + <!-- Start DataObjectFormat --> + <xsd:element name="DataObjectFormat" type="DataObjectFormatType"/> + <xsd:complexType name="DataObjectFormatType"> + <xsd:sequence> + <xsd:element name="Description" type="xsd:string" minOccurs="0"/> + <xsd:element name="ObjectIdentifier" type="ObjectIdentifierType" minOccurs="0"/> + <xsd:element name="MimeType" type="xsd:string" minOccurs="0"/> + <xsd:element name="Encoding" type="xsd:anyURI" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="ObjectReference" type="xsd:anyURI" use="required"/> + </xsd:complexType> + <!-- End DataObjectFormat --> + <!-- Start CommitmentTypeIndication --> + <xsd:element name="CommitmentTypeIndication" type="CommitmentTypeIndicationType"/> + <xsd:complexType name="CommitmentTypeIndicationType"> + <xsd:sequence> + <xsd:element name="CommitmentTypeId" type="ObjectIdentifierType"/> + <xsd:choice> + <xsd:element name="ObjectReference" type="xsd:anyURI" maxOccurs="unbounded"/> + <xsd:element name="AllSignedDataObjects"/> + </xsd:choice> + <xsd:element name="CommitmentTypeQualifiers" type="CommitmentTypeQualifiersListType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CommitmentTypeQualifiersListType"> + <xsd:sequence> + <xsd:element name="CommitmentTypeQualifier" type="AnyType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!-- End CommitmentTypeIndication --> + <!-- Start SignatureProductionPlace --> + <xsd:element name="SignatureProductionPlace" type="SignatureProductionPlaceType"/> + <xsd:complexType name="SignatureProductionPlaceType"> + <xsd:sequence> + <xsd:element name="City" type="xsd:string" minOccurs="0"/> + <xsd:element name="StateOrProvince" type="xsd:string" minOccurs="0"/> + <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/> + <xsd:element name="CountryName" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <!-- End SignatureProductionPlace --> + <!-- Start SignatureProductionPlaceV2 and SignatureProductionPlaceV2Type --> + <xsd:element name="SignatureProductionPlaceV2" type="SignatureProductionPlaceV2Type"/> + <xsd:complexType name="SignatureProductionPlaceV2Type"> + <xsd:sequence> + <xsd:element name="City" type="xsd:string" minOccurs="0"/> + <xsd:element name="StreetAddress" type="xsd:string" minOccurs="0"/> + <xsd:element name="StateOrProvince" type="xsd:string" minOccurs="0"/> + <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/> + <xsd:element name="CountryName" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <!-- End SignatureProductionPlace --> + <!-- Start SignerRole --> + <xsd:element name="SignerRole" type="SignerRoleType"/> + <xsd:complexType name="SignerRoleType"> + <xsd:sequence> + <xsd:element name="ClaimedRoles" type="ClaimedRolesListType" minOccurs="0"/> + <xsd:element name="CertifiedRoles" type="CertifiedRolesListType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ClaimedRolesListType"> + <xsd:sequence> + <xsd:element name="ClaimedRole" type="AnyType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CertifiedRolesListType"> + <xsd:sequence> + <xsd:element name="CertifiedRole" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!-- End SignerRole --> + <!-- Start SignerRoleV2 and SignerRoleV2Type --> + <xsd:element name="SignerRoleV2" type="SignerRoleV2Type"/> + <xsd:complexType name="SignerRoleV2Type"> + <xsd:sequence> + <xsd:element ref="ClaimedRoles" minOccurs="0"/> + <xsd:element ref="CertifiedRolesV2" minOccurs="0"/> + <xsd:element ref="SignedAssertions" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="ClaimedRoles" type="ClaimedRolesListType"/> + <xsd:element name="CertifiedRolesV2" type="CertifiedRolesListTypeV2"/> + <xsd:element name="SignedAssertions" type="SignedAssertionsListType"/> + <xsd:complexType name="CertifiedRolesListTypeV2"> + <xsd:sequence> + <xsd:element name="CertifiedRole" type="CertifiedRoleTypeV2" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CertifiedRoleTypeV2"> + <xsd:choice> + <xsd:element ref="X509AttributeCertificate"/> + <xsd:element ref="OtherAttributeCertificate"/> + </xsd:choice> + </xsd:complexType> + <xsd:element name="X509AttributeCertificate" type="EncapsulatedPKIDataType"/> + <xsd:element name="OtherAttributeCertificate" type="AnyType"/> + <xsd:complexType name="SignedAssertionsListType"> + <xsd:sequence> + <xsd:element ref="SignedAssertion" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="SignedAssertion" type="AnyType"/> + <!-- End SignerRoleV2 and SignerRoleV2Type --> + <xsd:element name="AllDataObjectsTimeStamp" type="XAdESTimeStampType"/> + <xsd:element name="IndividualDataObjectsTimeStamp" type="XAdESTimeStampType"/> + <xsd:element name="SignatureTimeStamp" type="XAdESTimeStampType"/> + <!-- Start CompleteCertificateRefs --> + <xsd:element name="CompleteCertificateRefs" type="CompleteCertificateRefsType"/> + <xsd:complexType name="CompleteCertificateRefsType"> + <xsd:sequence> + <xsd:element name="CertRefs" type="CertIDListType"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End CompleteCertificateRefs --> + <!-- Start CompleteRevocationRefs--> + <xsd:element name="CompleteRevocationRefs" type="CompleteRevocationRefsType"/> + <xsd:complexType name="CompleteRevocationRefsType"> + <xsd:sequence> + <xsd:element name="CRLRefs" type="CRLRefsType" minOccurs="0"/> + <xsd:element name="OCSPRefs" type="OCSPRefsType" minOccurs="0"/> + <xsd:element name="OtherRefs" type="OtherCertStatusRefsType" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <xsd:complexType name="CRLRefsType"> + <xsd:sequence> + <xsd:element name="CRLRef" type="CRLRefType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CRLRefType"> + <xsd:sequence> + <xsd:element name="DigestAlgAndValue" type="DigestAlgAndValueType"/> + <xsd:element name="CRLIdentifier" type="CRLIdentifierType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CRLIdentifierType"> + <xsd:sequence> + <xsd:element name="Issuer" type="xsd:string"/> + <xsd:element name="IssueTime" type="xsd:dateTime"/> + <xsd:element name="Number" type="xsd:integer" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <xsd:complexType name="OCSPRefsType"> + <xsd:sequence> + <xsd:element name="OCSPRef" type="OCSPRefType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="OCSPRefType"> + <xsd:sequence> + <xsd:element name="OCSPIdentifier" type="OCSPIdentifierType"/> + <xsd:element name="DigestAlgAndValue" type="DigestAlgAndValueType" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="ResponderIDType"> + <xsd:choice> + <xsd:element name="ByName" type="xsd:string"/> + <xsd:element name="ByKey" type="xsd:base64Binary"/> + </xsd:choice> + </xsd:complexType> + <xsd:complexType name="OCSPIdentifierType"> + <xsd:sequence> + <xsd:element name="ResponderID" type="ResponderIDType"/> + <xsd:element name="ProducedAt" type="xsd:dateTime"/> + </xsd:sequence> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <xsd:complexType name="OtherCertStatusRefsType"> + <xsd:sequence> + <xsd:element name="OtherRef" type="AnyType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!-- End CompleteRevocationRefs--> + <xsd:element name="AttributeCertificateRefs" type="CompleteCertificateRefsType"/> + <xsd:element name="AttributeRevocationRefs" type="CompleteRevocationRefsType"/> + <xsd:element name="SigAndRefsTimeStamp" type="XAdESTimeStampType"/> + <xsd:element name="RefsOnlyTimeStamp" type="XAdESTimeStampType"/> + <!-- Start CertificateValues --> + <xsd:element name="CertificateValues" type="CertificateValuesType"/> + <xsd:complexType name="CertificateValuesType"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="EncapsulatedX509Certificate" type="EncapsulatedPKIDataType"/> + <xsd:element name="OtherCertificate" type="AnyType"/> + </xsd:choice> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- End CertificateValues --> + <!-- Start RevocationValues--> + <xsd:element name="RevocationValues" type="RevocationValuesType"/> + <xsd:complexType name="RevocationValuesType"> + <xsd:sequence> + <xsd:element name="CRLValues" type="CRLValuesType" minOccurs="0"/> + <xsd:element name="OCSPValues" type="OCSPValuesType" minOccurs="0"/> + <xsd:element name="OtherValues" type="OtherCertStatusValuesType" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <xsd:complexType name="CRLValuesType"> + <xsd:sequence> + <xsd:element name="EncapsulatedCRLValue" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="OCSPValuesType"> + <xsd:sequence> + <xsd:element name="EncapsulatedOCSPValue" type="EncapsulatedPKIDataType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="OtherCertStatusValuesType"> + <xsd:sequence> + <xsd:element name="OtherValue" type="AnyType" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <!-- End RevocationValues--> + <xsd:element name="AttrAuthoritiesCertValues" type="CertificateValuesType"/> + <xsd:element name="AttributeRevocationValues" type="RevocationValuesType"/> + <xsd:element name="ArchiveTimeStamp" type="XAdESTimeStampType"/> +</xsd:schema> + diff --git a/moaSig/common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd b/moaSig/common/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd index 4022bc2..1f3aaf9 100644 --- a/moaSig/common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd +++ b/moaSig/common/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd @@ -1,64 +1,64 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.4.1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" elementFormDefault="qualified">
- <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
- <xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="XAdES-1.3.2.xsd"/>
- <!-- Start CertificateValues -->
- <xsd:element name="TimeStampValidationData" type="ValidationDataType"/>
- <xsd:complexType name="ValidationDataType">
- <xsd:sequence>
- <xsd:element ref="xades:CertificateValues" minOccurs="0"/>
- <xsd:element ref="xades:RevocationValues" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:element name="SignaturePolicyStore" type="SignaturePolicyStoreType"/>
- <xsd:complexType name="SignaturePolicyStoreType">
- <xsd:sequence>
- <xsd:element ref="SPDocSpecification"/>
- <xsd:choice>
- <xsd:element name="SignaturePolicyDocument" type="xsd:base64Binary"/>
- <xsd:element name="SigPolDocLocalURI" type="xsd:anyURI"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <xsd:element name="SPDocSpecification" type="xades:ObjectIdentifierType"/>
- <!-- -->
- <!-- Start RenewedDigests-->
- <!-- -->
- <xsd:element name="RenewedDigests" type="RenewedDigestsType"/>
- <xsd:complexType name="RenewedDigestsType">
- <xsd:sequence>
- <xsd:element ref="ds:DigestMethod"/>
- <xsd:element ref="RecomputedDigestValue" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <xsd:element name="RecomputedDigestValue" type="RecomputedDigestValueType"/>
- <xsd:complexType name="RecomputedDigestValueType">
- <xsd:simpleContent>
- <xsd:extension base="ds:DigestValueType">
- <xsd:attribute name="Order" type="xsd:integer" use="required"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- <!-- -->
- <!-- End RenewedDigests-->
- <!-- -->
- <!-- ArchiveTimeStamp in namespace with URI 'http://uri.etsi.org/01903/v1.4.1#'-->
- <xsd:element name="ArchiveTimeStamp" type="xades:XAdESTimeStampType"/>
- <!--CompleteCertificateRefsV2 and AttributeCertificateRefsV2-->
- <xsd:element name="CompleteCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/>
- <xsd:element name="AttributeCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/>
- <xsd:complexType name="CompleteCertificateRefsTypeV2">
- <xsd:sequence>
- <xsd:element name="CertRefs" type="xades:CertIDListV2Type"/>
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- </xsd:complexType>
- <!-- SigAndRefsTimeStampV2 and RefsOnlyTimeStampV2-->
- <xsd:element name="SigAndRefsTimeStampV2" type="xades:XAdESTimeStampType"/>
- <xsd:element name="RefsOnlyTimeStampV2" type="xades:XAdESTimeStampType"/>
-</xsd:schema>
-
+<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.4.1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" elementFormDefault="qualified"> + <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"/> + <xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="http://uri.etsi.org/01903/v1.3.2/XAdES01903v132-201601.xsd"/> + <!-- Start CertificateValues --> + <xsd:element name="TimeStampValidationData" type="ValidationDataType"/> + <xsd:complexType name="ValidationDataType"> + <xsd:sequence> + <xsd:element ref="xades:CertificateValues" minOccurs="0"/> + <xsd:element ref="xades:RevocationValues" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/> + </xsd:complexType> + <xsd:element name="SignaturePolicyStore" type="SignaturePolicyStoreType"/> + <xsd:complexType name="SignaturePolicyStoreType"> + <xsd:sequence> + <xsd:element ref="SPDocSpecification"/> + <xsd:choice> + <xsd:element name="SignaturePolicyDocument" type="xsd:base64Binary"/> + <xsd:element name="SigPolDocLocalURI" type="xsd:anyURI"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <xsd:element name="SPDocSpecification" type="xades:ObjectIdentifierType"/> + <!-- --> + <!-- Start RenewedDigests--> + <!-- --> + <xsd:element name="RenewedDigests" type="RenewedDigestsType"/> + <xsd:complexType name="RenewedDigestsType"> + <xsd:sequence> + <xsd:element ref="ds:DigestMethod"/> + <xsd:element ref="RecomputedDigestValue" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <xsd:element name="RecomputedDigestValue" type="RecomputedDigestValueType"/> + <xsd:complexType name="RecomputedDigestValueType"> + <xsd:simpleContent> + <xsd:extension base="ds:DigestValueType"> + <xsd:attribute name="Order" type="xsd:integer" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <!-- --> + <!-- End RenewedDigests--> + <!-- --> + <!-- ArchiveTimeStamp in namespace with URI 'http://uri.etsi.org/01903/v1.4.1#'--> + <xsd:element name="ArchiveTimeStamp" type="xades:XAdESTimeStampType"/> + <!--CompleteCertificateRefsV2 and AttributeCertificateRefsV2--> + <xsd:element name="CompleteCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/> + <xsd:element name="AttributeCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/> + <xsd:complexType name="CompleteCertificateRefsTypeV2"> + <xsd:sequence> + <xsd:element name="CertRefs" type="xades:CertIDListV2Type"/> + </xsd:sequence> + <xsd:attribute name="Id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- SigAndRefsTimeStampV2 and RefsOnlyTimeStampV2--> + <xsd:element name="SigAndRefsTimeStampV2" type="xades:XAdESTimeStampType"/> + <xsd:element name="RefsOnlyTimeStampV2" type="xades:XAdESTimeStampType"/> +</xsd:schema> + diff --git a/moaSig/common/src/main/resources/resources/schemas/eIDAS_saml_extensions.xsd b/moaSig/common/src/main/resources/resources/schemas/eIDAS_saml_extensions.xsd new file mode 100644 index 0000000..76b82a2 --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/eIDAS_saml_extensions.xsd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:eidas="http://eidas.europa.eu/saml-extensions" targetNamespace="http://eidas.europa.eu/saml-extensions" elementFormDefault="qualified" attributeFormDefault="unqualified"> + + <xsd:element name="SPType" type="eidas:SPTypeType"/> + <xsd:simpleType name="SPTypeType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="public"/> + <xsd:enumeration value="private"/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:element name="RequestedAttributes" type="eidas:RequestedAttributesType"/> + <xsd:complexType name="RequestedAttributesType"> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="unbounded" ref="eidas:RequestedAttribute"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="RequestedAttribute" type="eidas:RequestedAttributeType"/> + <xsd:complexType name="RequestedAttributeType"> + <xsd:sequence> + <xsd:element name="AttributeValue" minOccurs="0" maxOccurs="unbounded" type="xsd:anyType"/> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + <xsd:attribute name="NameFormat" type="xsd:anyURI" use="required" /> + <xsd:attribute name="isRequired" type="xsd:boolean" use="required"/> + <xsd:attribute name="FriendlyName" type="xsd:string" use="optional"/> + <xsd:anyAttribute namespace="##other" processContents="lax" /> + </xsd:complexType> + +</xsd:schema> diff --git a/moaSig/common/src/main/resources/resources/schemas/zuse_mypersondata_en_p2.xsd b/moaSig/common/src/main/resources/resources/schemas/zuse_mypersondata_en_p2.xsd new file mode 100644 index 0000000..f23ee96 --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/zuse_mypersondata_en_p2.xsd @@ -0,0 +1,369 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Mit XMLSpy v2016 (http://www.altova.com) von Arne Tauber (TU Graz) bearbeitet --> +<xs:schema xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" targetNamespace="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.2.006"> + <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="W3C-XMLDSig.xsd"/> + <xs:annotation> + <xs:documentation>This version of person deploys only global elements. All types derived from abstract types have been replaced by substitution groups</xs:documentation> + </xs:annotation> + <!-- ### structure for person data ### --> + <xs:element name="Person" type="p:AbstractPersonType" abstract="true"/> + <!-- ### structure of a person with Identification ### --> + <xs:element name="PersonAndIdentification" type="p:PersonAndIdentificationType"> + <xs:annotation> + <xs:documentation>element of person details type</xs:documentation> + </xs:annotation> + </xs:element> + <!-- ### structure of a person with address### --> + <xs:element name="PersonAndAddress" type="p:PersonAndAddressType"> + <xs:annotation> + <xs:documentation>element of signed person datastructure type</xs:documentation> + </xs:annotation> + </xs:element> + <!-- ### physical person, corporate body and authority ### --> + <xs:element name="PhysicalPerson" type="p:PhysicalPersonType" substitutionGroup="p:Person"> + <xs:annotation> + <xs:documentation>element of physical person type, dreived from Person </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CorporateBody" type="p:CorporateBodyType" substitutionGroup="p:Person"> + <xs:annotation> + <xs:documentation>element of corporate body type, derived from Person</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Name" type="p:PersonNameType"> + <xs:annotation> + <xs:documentation>data related to the person's name</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="FullName" type="xs:token"> + <xs:annotation> + <xs:documentation>name of corporate body (whole name), compare VollerName</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Organization" type="xs:token"> + <xs:annotation> + <xs:documentation>part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Target" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>Beinhaltet die Bereichskennung und entweder das VKZ oder den Service-Identifier der Zielorganisation für die das vbPK-ZU umzuschlüsseln ist. Das Target ist in der Form "urn:publicid:gv.at:ecdid+«VKZ od. Service-ID»+«Bereich»" zu liefern. (vgl. SZR 3.0 Anwendungsdokumentation)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DateOfBirth" type="xs:date"> + <xs:annotation> + <xs:documentation>date of birth, compare Geburtsdatum</xs:documentation> + </xs:annotation> + </xs:element> + <!-- ### adress data for various types of communications ### --> + <xs:element name="Address" type="p:AbstractAddressType" abstract="true"/> + <xs:element name="PostalAddress" type="p:PostalAddressType" substitutionGroup="p:Address"> + <xs:annotation> + <xs:documentation>Postal or ZMR Address, compare PostAdresse</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="InternetAddress" type="p:InternetAddressType" substitutionGroup="p:Address"> + <xs:annotation> + <xs:documentation>element of internet address type</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TelephoneAddress" type="p:TelephoneAddressType" substitutionGroup="p:Address"> + <xs:annotation> + <xs:documentation>element of TelephoneAddressType, compare TelefonAdresse</xs:documentation> + </xs:annotation> + </xs:element> + <!-- ### Identification elements ###--> + <xs:element name="Identification" type="p:IdentificationType"> + <xs:annotation> + <xs:documentation>unique identifier</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="IdentificationType"> + <xs:annotation> + <xs:documentation>unique identifier</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Value"> + <xs:annotation> + <xs:documentation>actual value of the identifier.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + <xs:element name="Type" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...)</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <!--### Complex types ###--> + <xs:complexType name="PersonAndIdentificationType"> + <xs:annotation> + <xs:documentation>person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements).</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element ref="p:Identification"/> + <xs:element ref="p:Person"/> + </xs:sequence> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <xs:complexType name="PersonAndAddressType"> + <xs:annotation> + <xs:documentation>signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements).</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element ref="p:Identification"/> + <xs:element ref="p:Person"/> + <xs:element ref="p:Address" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <xs:complexType name="AbstractPersonType" abstract="true"> + <xs:annotation> + <xs:documentation>main structure of person data</xs:documentation> + </xs:annotation> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <xs:complexType name="PhysicalPersonType"> + <xs:annotation> + <xs:documentation>physical person</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="p:AbstractPersonType"> + <xs:sequence> + <xs:element ref="p:Name"/> + <xs:element ref="p:DateOfBirth" minOccurs="0"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="PersonNameType"> + <xs:sequence> + <xs:element name="GivenName" type="xs:string"/> + <xs:element name="FamilyName"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="primary" default="undefined"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + <xs:enumeration value="undefined"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="prefix" type="xs:string"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + <xs:element name="Affix" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="type" use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="academicGrade"/> + <xs:enumeration value="aristocraticPrefix"/> + <xs:enumeration value="aristocraticTitle"/> + <xs:enumeration value="familyNamePrefix"/> + <xs:enumeration value="familyNameSuffix"/> + <xs:enumeration value="formOfAddress"/> + <xs:enumeration value="generation"/> + <xs:enumeration value="qualification"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="position" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="prefix"/> + <xs:enumeration value="suffix"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="AuthorityType"> + <xs:annotation> + <xs:documentation>public authority</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="p:AbstractPersonType"> + <xs:sequence> + <xs:element ref="p:FullName"/> + <xs:element ref="p:Organization" minOccurs="0"/> + <xs:element ref="p:Target" minOccurs="0"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="CorporateBodyType"> + <xs:annotation> + <xs:documentation>juridical person, organisation</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="p:AbstractPersonType"> + <xs:sequence> + <xs:element ref="p:FullName"/> + <xs:element ref="p:Organization" minOccurs="0"/> + <xs:element ref="p:Target" minOccurs="0"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="AbstractAddressType"> + <xs:annotation> + <xs:documentation>main structure of address data </xs:documentation> + </xs:annotation> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <xs:complexType name="PostalAddressType"> + <xs:complexContent> + <xs:extension base="p:AbstractAddressType"> + <xs:sequence> + <xs:element name="CountryCode" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Code for the country, use ISO or internatinal Postalstandard, compare Staatscode</xs:documentation> + </xs:annotation> + <!-- xs:simpleType> + <xs:restriction base="xs:string"> + <xs:pattern value="[A-Z]{2}"/> + </xs:restriction> + </xs:simpleType --> + </xs:element> + <xs:element name="PostalCode" type="xs:string"> + <xs:annotation> + <xs:documentation>ZIP, compare Postleitzahl</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Municipality" type="xs:string"> + <xs:annotation> + <xs:documentation>compare Gemeinde</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MunicipalityNumber" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>compare Gemeindekennzahl</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DeliveryAddress"> + <xs:complexType> + <xs:sequence> + <xs:element name="StreetName" type="xs:string"/> + <xs:element name="BuildingNumber" type="xs:string"/> + <xs:element name="Unit" type="xs:string" minOccurs="0"/> + <xs:element name="DoorNumber" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="type" default="undefined"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="postOfficeBoxAddress"/> + <xs:enumeration value="streetAddress"/> + <xs:enumeration value="militaryAddress"/> + <xs:enumeration value="undefined"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="InternetAddressType"> + <xs:annotation> + <xs:documentation>internet based communication</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="p:AbstractAddressType"> + <xs:sequence> + <xs:element name="Address" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>URI: email-Address, Web, FTP, LDAP, ..., comapre Adress</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="TelephoneAddressType"> + <xs:annotation> + <xs:documentation>phone numbers</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="p:AbstractAddressType"> + <xs:sequence> + <xs:element name="Number" type="xs:token"> + <xs:annotation> + <xs:documentation>phonenumber</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="MessengerService" type="xs:token" use="optional" default="SMS"> + <xs:annotation> + <xs:documentation>SMS, WhatsApp, etc.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <!-- ### strings of defined maximum lenght for use with ZMR address #### --> + <xs:simpleType name="string3"> + <xs:restriction base="xs:string"> + <xs:maxLength value="3"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string4"> + <xs:restriction base="xs:string"> + <xs:maxLength value="4"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string7"> + <xs:restriction base="xs:string"> + <xs:maxLength value="7"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string20"> + <xs:restriction base="xs:string"> + <xs:maxLength value="20"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string30"> + <xs:restriction base="xs:string"> + <xs:maxLength value="30"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string50"> + <xs:restriction base="xs:string"> + <xs:maxLength value="50"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="string100"> + <xs:restriction base="xs:string"> + <xs:maxLength value="100"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="integer5"> + <xs:restriction base="xs:integer"> + <xs:minInclusive value="10000"/> + <xs:maxInclusive value="99999"/> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/moaSig/common/src/main/resources/resources/schemas/zuse_p2.xsd b/moaSig/common/src/main/resources/resources/schemas/zuse_p2.xsd new file mode 100644 index 0000000..d996d01 --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/zuse_p2.xsd @@ -0,0 +1,989 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Mit XMLSpy v2016 (http://www.altova.com) von Arne Tauber (TU Graz) bearbeitet --> +<!-- ### + + Die Versionsnummer des Schemas wird immer dann hochgezogen, wenn das Schema + selbst verändert wurde aber auch dann, wenn zumindest eines der importierten + ZUSE-Schemata angepasst wurde. + + ###--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:msg="http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" targetNamespace="http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.2.007"> + <!--### Imports ###--> + <!--### ZUSE-Personendaten: namespace="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" version="2.2.007" ###--> + <xs:import namespace="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" schemaLocation="zuse_mypersondata_en_p2.xsd"/> + <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="W3C-XMLDSig.xsd"/> + <!--### Abfrage der Webserviceversion--> + <xs:element name="GetVersionRequest" type="msg:SimpleRequestType"/> + <xs:element name="GetVersionResponse"> + <xs:complexType> + <xs:sequence> + <xs:element name="Version"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="2.2.007"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <!--### Nachrichten und Nachrichtenstrukturen ###--> + <!--### Zustellstückanlieferung ###--> + <xs:element name="DeliveryRequest" type="msg:DeliveryRequestType"> + <xs:annotation> + <xs:documentation>Zustellstückanlieferung</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryRequestType"> + <xs:sequence> + <xs:element ref="msg:Sender"/> + <xs:element ref="msg:Receiver"> + <xs:annotation> + <xs:documentation>Adressierung des Empfängers</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:MetaData"/> + <xs:element name="Attachments" type="msg:AttachmentsType"> + <xs:annotation> + <xs:documentation>Anhänge</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="Version" type="msg:VersionNumberType"/> + </xs:complexType> + <xs:element name="DeliveryResponse" type="msg:DeliveryRequestStatusType"/> + <xs:element name="DeliveryRequestStatus" type="msg:DeliveryRequestStatusType"> + <xs:annotation> + <xs:documentation>Webservice Response of ZSDeliveryRequest, also to used asynchronously </xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryRequestStatusType"> + <xs:sequence> + <xs:choice> + <xs:element name="Success"> + <xs:annotation> + <xs:documentation>Zustellstück wurde erfolgreich übernommen</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="msg:DeliveryAnswerType"> + <xs:sequence> + <xs:element ref="msg:DeliveryTimestamp"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="PartialSuccess"> + <xs:annotation> + <xs:documentation>Zustellstück wurde erfolgreich übernommen, attachment wird später geladen</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="msg:DeliveryAnswerType"/> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="Error"> + <xs:annotation> + <xs:documentation>Zustellstück konnte nicht übernommen werden</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="msg:DeliveryAnswerType"> + <xs:sequence> + <xs:element ref="msg:ErrorInfo"/> + <xs:element ref="msg:PreAdviceNoteSent" minOccurs="0"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:choice> + <xs:element ref="msg:RelayedViaERV" minOccurs="0"/> + <xs:element ref="dsig:Signature"/> + </xs:sequence> + <xs:attribute name="Version" type="msg:VersionNumberType"/> + <xs:attribute name="Id" type="xs:ID" use="optional"> + <xs:annotation> + <xs:documentation>Eindeutige ID des Elements, um in der Signatur referenziert werden zu können </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:element name="DeliveryRequestStatusACK" type="msg:DeliveryRequestStatusACKType"> + <xs:annotation> + <xs:documentation>Wenn DeliveryRequestStatus bei asynchroner Koomunikation als Request benutzt wird, ist DeliveryRequstStatusACK die Antwort</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryRequestStatusACKType"> + <xs:sequence> + <xs:element ref="msg:AppDeliveryID"/> + <xs:element ref="msg:ZSDeliveryID"/> + </xs:sequence> + <xs:attribute name="Version" type="msg:VersionNumberType"/> + </xs:complexType> + <xs:annotation> + <xs:documentation>### Bestätigung über Zustellungs (Miß-) Erfolg ###</xs:documentation> + </xs:annotation> + <xs:element name="DeliveryNotification" type="msg:DeliveryNotificationType"> + <xs:annotation> + <xs:documentation>Benachrichtigung über die erfolgte oder nicht erfolgte Zustellung</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryNotificationType"> + <xs:complexContent> + <xs:extension base="msg:DeliveryAnswerType"> + <xs:sequence> + <xs:element ref="msg:SenderDetails"/> + <xs:element ref="msg:ReceiverDetails"/> + <xs:element ref="msg:Timestamp"> + <xs:annotation> + <xs:documentation>Timestamp der Nachrichtenoperation, welcher vom Anzeigemodul erzeugt wurde. Im Falle der Annahme einer Zustellung entspricht der Timestamp dem Annahmezeitpunkt</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:User" minOccurs="0"> + <xs:annotation> + <xs:documentation>Benutzer, der die Nachricht angenommen hat.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:Answer"/> + <xs:element ref="dsig:Signature"/> + <xs:element name="AdditionalFormat" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:base64Binary"> + <xs:attribute name="Type" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>Als MIME-Type ist „application/pdf“ zu verwenden</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="Version" type="msg:VersionNumberType"/> + <xs:attribute name="Id" type="xs:ID" use="optional"> + <xs:annotation> + <xs:documentation>Eindeutige ID des Elements, um in der Signatur referenziert zu können </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="DeliveryNotificationACK" type="msg:DeliveryNotificationACKType"> + <xs:annotation> + <xs:documentation>Webservice Response of ZSDeliveryNotification</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryNotificationACKType"> + <xs:sequence> + <xs:element ref="msg:AppDeliveryID"/> + <xs:element ref="msg:ZSDeliveryID"/> + </xs:sequence> + <xs:attribute name="Version" type="msg:VersionNumberType"/> + </xs:complexType> + <xs:complexType name="DeliveryAnswerType"> + <xs:annotation> + <xs:documentation>Abstrakter Antwort Typ</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element ref="msg:DeliverySystem"/> + <xs:element ref="msg:ZSDeliveryID"> + <xs:annotation> + <xs:documentation>ID des Zustellstücke innerhalb des Zustellsystems</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:AppDeliveryID"/> + <xs:element ref="msg:GZ" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="DeliveryConfirmationType"> + <xs:complexContent> + <xs:extension base="msg:DeliveryAnswerType"> + <xs:sequence> + <xs:element ref="msg:Sender"/> + <xs:element ref="msg:Receiver"/> + <xs:element name="DeliveryTimestamp" type="xs:dateTime"> + <xs:annotation> + <xs:documentation>Übergabezeitpunkt an den Zustelldienst</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="dsig:Signature"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <!--### globale Elemente und komplexe Typen###--> + <xs:complexType name="AbstractOperationType" abstract="true"/> + <xs:complexType name="AbstractSenderPersonType"> + <xs:annotation> + <xs:documentation>main structure of sender</xs:documentation> + </xs:annotation> + <xs:attribute name="Id" type="xs:ID" use="optional"/> + </xs:complexType> + <xs:element name="Accepted" type="msg:AcceptedType" substitutionGroup="msg:Answer"> + <xs:annotation> + <xs:documentation>Zeigt an, dass die Nachricht durch den Einstieg ins Anzeigemodul angenommen wurde. </xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="AcceptedType"> + <xs:complexContent> + <xs:extension base="msg:AbstractOperationType"> + <xs:sequence> + <xs:element ref="msg:NotificationsPerformed"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="AdditionalCriteria" type="msg:AdditionalCriteriaType"> + <xs:annotation> + <xs:documentation>Weitere über den eigentlichen Adressaten hinausgehende Kriterien zur Adressierung (bspw. c/o)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="AdditionalCriteriaType"> + <xs:sequence> + <xs:element ref="msg:MailBox" minOccurs="0"> + <xs:annotation> + <xs:documentation>Eindeutige Kennung (Filiale, Standort, Abteilung, etc..) innerhalb der jur. Person </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:Roles" minOccurs="0"/> + <xs:element ref="msg:CareOf" minOccurs="0"> + <xs:annotation> + <xs:documentation>Natürlichen Person innerhalb einer Orangisation der "zu Handen" (c/o) zustellen werden soll. Wird eine E-Mail-Adresse angegeben, kann die Person eindeutig identifiziert und notifiziert werden. </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="Answer" type="msg:AbstractOperationType" abstract="true"> + <xs:annotation> + <xs:documentation> Rückmeldungen zu einer Nachricht</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="AppDeliveryID" type="msg:token256"> + <xs:annotation> + <xs:documentation>ID des Zustellstücke beim Absender</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Attachment" type="msg:AttachmentType"/> + <xs:element name="Attachments" type="msg:AttachmentsType"> + <xs:annotation> + <xs:documentation>List of all attachments</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="AttachmentsType"> + <xs:sequence> + <xs:element ref="msg:Attachment" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="AttachmentType"> + <xs:sequence> + <xs:element name="FileName" type="msg:FileNameType"> + <xs:annotation> + <xs:documentation>Dateiname min. 5 Zeichen, max 255 Zeichen</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:MimeType"/> + <xs:element ref="msg:DocumentClass" minOccurs="0"> + <xs:annotation> + <xs:documentation>Dokumentenklasse als String bzw. Namespace im Fall von XML-Dokumenten im Anhang, um auf Empfängerseite eine automatische Verarbeitung durch ein Workflowsystem realisieren zu können.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Size" type="xs:nonNegativeInteger"> + <xs:annotation> + <xs:documentation>Größe in Bytes</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:CheckSum"/> + <xs:choice> + <xs:element name="Content" type="xs:base64Binary"> + <xs:annotation> + <xs:documentation>Für Attachments deren Inhalt direkt in die Nachricht eingebettet werden. (Das Größenlimit für die gesamte Nachricht inklusive aller eingebetteten Attachments beträgt 10 MB)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="URL" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>Docuementlocation in case of Callback attachements</xs:documentation> + </xs:annotation> + </xs:element> + </xs:choice> + </xs:sequence> + </xs:complexType> + <xs:element name="AustrianAddressesOnly" type="msg:IndicatorType"> + <xs:annotation> + <xs:documentation>Die Existenz des Elements zeigt an, dass die gesuchte Person in Österreich gemeldet sein muss</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="AuthLevel" type="msg:token256"> + <xs:annotation> + <xs:documentation>Höchstes Authentifizierungsniveau mit dem sich der Teilnehmer beim Portal/Kommunikationssystem angemeldet hatte. Folgende Werte sind zulässig - absteigend sortiert nach der Höhe des Authentifizierungsniveaus: "EID" > "FON" > "LOW" + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CareOf"> + <xs:annotation> + <xs:documentation>Um einer natürlichen Person innerhalb einer Orangisation "zu Handen" (c/o) zustellen zu können, reicht die vbPK-ZU oder die E-Mail-Adresse aus, um die Person über das Eintreffen der Nachricht notifiziert zu können. </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:ElectronicAddress" minOccurs="0"> + <xs:annotation> + <xs:documentation>Elektronische Adresse der "Zu Handen"-Person innerhalb der Organisation</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Name" type="msg:token256"> + <xs:annotation> + <xs:documentation>Name der Person zu deren Handen adressiert wird. Hierbei handelt es sich um einen Freitext für die Anzeige, der als eindeutiger Identifikator für Verständigungen oder eine automatisierte Weiterleitung ungeeignet ist.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="CheckSum" type="msg:CheckSumType"> + <xs:annotation> + <xs:documentation>Prüfsumme</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="CheckSumType"> + <xs:annotation> + <xs:documentation>Prüfsumme</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="AlgorithmID" type="xs:token"> + <xs:annotation> + <xs:documentation>Hash Algorithmus, z.B. SHA-256, SHA-512</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Value" type="xs:base64Binary"> + <xs:annotation> + <xs:documentation>Hashwert</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="ClearingProfilID" type="xs:token"> + <xs:annotation> + <xs:documentation>Ist zu verwenden, wenn die Abrechnung über ein anderes Profil erfolgen soll, als dem Versender-Profil </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ConfirmationAddress"> + <xs:annotation> + <xs:documentation>Webservice oder E-Mail-Adresse, an welches die Zustellbestätigung oder Fehlermeldung weitergeleitet wird (Callback)</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:choice> + <xs:element ref="msg:WebserviceURL"/> + <xs:element ref="msg:Email"/> + </xs:choice> + <xs:attribute name="Type" default="xml"> + <xs:annotation> + <xs:documentation>Typ des Zustellnachweises, z.B. xml+pdf oder nur xml (default)</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="xml"/> + <xs:enumeration value="xml+pdf"/> + <xs:enumeration value="pdf"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="DeliveryError" type="msg:DeliveryErrorType" substitutionGroup="msg:Answer"> + <xs:annotation> + <xs:documentation>Zustellung war nicht erfolgreich +• Nachricht wurde nicht innerhalb der Zustellfrist angenommen +• Zustellhindernis </xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="DeliveryErrorType"> + <xs:complexContent> + <xs:extension base="msg:AbstractOperationType"> + <xs:sequence> + <xs:element ref="msg:NotificationsPerformed" minOccurs="0"> + <xs:annotation> + <xs:documentation>Im Falle des verstreichens der Zustellfrist MUSS das Element befüllt sein.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:ErrorInfo"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="DeliveryQuality"> + <xs:annotation> + <xs:documentation>Zustellqualität gemäß ZustellG: +• RSa +• RSa+ +• nonRSa +• nonRSa+</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="msg:token256"> + <xs:enumeration value="RSa"/> + <xs:enumeration value="RSa+"/> + <xs:enumeration value="nonRSa"/> + <xs:enumeration value="nonRSa+"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="DeliverySystem" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>URL des für die Nachricht verantwortlichen Zustellstellsystems</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DeliveryTimestamp" type="xs:dateTime"> + <xs:annotation> + <xs:documentation>Zustellzeitpunkt</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DocumentClass" type="xs:token"> + <xs:annotation> + <xs:documentation>Enthält den Namespace des XML-Dokuments, um auf Empfängerseite eine automatische Verarbeitung durch ein Workflowsystem realisieren zu können.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ElectronicAddress" type="p:AbstractAddressType" abstract="true"> + <xs:annotation> + <xs:documentation> Elektronische Adresse (E-Mail, HTTP, etc)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Email" type="p:InternetAddressType"> + <xs:annotation> + <xs:documentation>Für Notfälle, wenn der Absender weder über ein Webservice noch über ein elektronisches Postfach verfügt.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ErrorInfo" type="msg:ErrorInfoType"> + <xs:annotation> + <xs:documentation>Beschreibung eines aufgetretenen Fehlers</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="ErrorInfoType"> + <xs:annotation> + <xs:documentation>ComplexTpye für die Beschreibung eines aufgetretenen Fehlers</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Code" type="xs:token"> + <xs:annotation> + <xs:documentation>Fehlercode</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Text" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Fehlerbeschreibung</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="ERVConfirmedDelivery" type="msg:ERVConfirmedDeliveryType" substitutionGroup="msg:Answer"> + <xs:annotation> + <xs:documentation>Diese Operation zeigt an, dass eine in den ERV weitergeleitete Nachricht erfolgreich im Verfügungsbereich des Empfängers eingelangt ist. </xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="ERVConfirmedDeliveryType"> + <xs:complexContent> + <xs:extension base="msg:AbstractOperationType"> + <xs:sequence> + <xs:element ref="msg:ERVCode"/> + <xs:element ref="msg:ERVDeliveryTimestamp"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="ERVCode" type="msg:token256"> + <xs:annotation> + <xs:documentation>Anschriftcode des Elektronischen Rechtsverkehrs der Justiz (ERV): Wenn die Nachricht in den ERV weitergeleitet wird, ist der Anschriftcode - zwecks Nachvollziehbarkeit - bis zum Versender zurückgegeben.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ERVDeliveryTimestamp" type="xs:dateTime"> + <xs:annotation> + <xs:documentation>Datum, wann die Zustellung in der jeweiligen Übermittlungsstelle und damit im Verfügungsbereich des Empfängers eingelangt ist, d.h. die Zustellung erfolgt ist, wird als Zustellzeitpunkt verwendet und an das jeweilige Zustellsystem zurück-gemeldet. Dieses Datum ist gemäß GOG berechnet und gibt den nächsten auf die Ankunft in der Übermittlungsstelle folgenden Werktag an und enthält keine Zeitangabe.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="GZ" type="xs:token"> + <xs:annotation> + <xs:documentation>Geschäftszahl</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="IgnorePostRedirectionOrder" type="msg:IndicatorType"> + <xs:annotation> + <xs:documentation>Wenn dieser Marker existiert, MUSS diese Zustellung auch bei aktiver Postsperre an den tatsächlichen Empfänger zugestellt werden.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="IndicatorType"> + <xs:annotation> + <xs:documentation>Dieser ComplexType ist ein Hilfskonstrukt damit ein Flag/Kennzeichen/Marker/Idikator Element nicht als XML-Any misbraucht werden kann.</xs:documentation> + </xs:annotation> + </xs:complexType> + <xs:element name="InternetAddress" type="p:InternetAddressType" substitutionGroup="msg:ElectronicAddress"> + <xs:annotation> + <xs:documentation>element of internet address type</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Language" type="msg:AustrianLanguageType"> + <xs:annotation> + <xs:documentation>Sprache in welcher der Zustellnachweis gesendet werden soll</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Logo" type="msg:LogoType"> + <xs:annotation> + <xs:documentation>Definiert ein Logo</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="LogoType"> + <xs:annotation> + <xs:documentation>Definiert ein Nachrichtenlogo</xs:documentation> + </xs:annotation> + <xs:choice> + <xs:element name="LogoID" type="xs:token"> + <xs:annotation> + <xs:documentation>Für Logos, die vorab beim Zustelldienst für den Versender im Profil hinterlegt wurden</xs:documentation> + </xs:annotation> + </xs:element> + <xs:sequence> + <xs:element name="ContentValue" type="xs:base64Binary"/> + <xs:element name="ContentType" type="msg:token256"/> + </xs:sequence> + </xs:choice> + </xs:complexType> + <xs:element name="MailBox" type="xs:token"> + <xs:annotation> + <xs:documentation>Spezielles Postfach des Empfängers, z.B. eine Filiale einer jur. Person</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MetaData"> + <xs:annotation> + <xs:documentation>Metadaten der Zustellung</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:AppDeliveryID"> + <xs:annotation> + <xs:documentation>ID des Zustellstücks beim Absender</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:Origin" minOccurs="0"> + <xs:annotation> + <xs:documentation>Zustellsystem, welches die Nachricht überrmittelt hat. Muss gesetzt werden, wenn die Zustellsystem-Applikationen mehrere Zustellsysteme repräsentiert</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:Subject"/> + <xs:element ref="msg:GZ" minOccurs="0"/> + <xs:choice> + <xs:element ref="msg:DeliveryQuality"/> + <xs:element ref="msg:PrivateMessageQuality"/> + </xs:choice> + <xs:element ref="msg:NotificationLanguages" minOccurs="0"> + <xs:annotation> + <xs:documentation>Sprachen - vom Versender mitgegeben - in denen die Verständigung gesendet werden soll</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:IgnorePostRedirectionOrder" minOccurs="0"/> + <xs:element ref="msg:Reference" minOccurs="0"/> + <xs:element ref="msg:Tags" minOccurs="0"/> + <xs:element ref="msg:MetadataList" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="MetadataEntry" type="msg:MetadataEntryType"> + <xs:annotation> + <xs:documentation>Single metadata entry</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="MetadataEntryType"> + <xs:sequence> + <xs:element name="OID" type="xs:token"> + <xs:annotation> + <xs:documentation>Unique object identifier</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Value" type="xs:anySimpleType"> + <xs:annotation> + <xs:documentation>Metadata value. basic type is defined in specification document</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="DisplayInDetailView" type="xs:boolean"> + <xs:annotation> + <xs:documentation>Display metadata in detailed view. If metadata are displayed by default or prohibited to display (e.g. internal data), this value cannot be overriden</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:element name="MetadataList"> + <xs:annotation> + <xs:documentation>List of metadata entries</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:MetadataEntry" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="MimeType" type="msg:token256"> + <xs:annotation> + <xs:documentation>Mime-Typ</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NotificationAddressList" type="msg:NotificationAddressListType"> + <xs:annotation> + <xs:documentation>Liste der verifizierten Verständigungsadressen des Teilnehmers</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="NotificationAddressListType"> + <xs:sequence> + <xs:element ref="msg:ElectronicAddress" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + <xs:element name="NotificationLanguages"> + <xs:annotation> + <xs:documentation>Sprachen in denen die Verständigung gesendet werden soll</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:Language" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Sprache in der die Verständigung gesendet werden soll</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="NotificationsPerformed" type="msg:NotificationsPerformedType"> + <xs:annotation> + <xs:documentation>Liste der vom AMOD durchgeführten Verständigungen des Empfängers</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="NotificationsPerformedType"> + <xs:sequence> + <xs:element name="RecipientNotification" maxOccurs="unbounded"> + <xs:complexType> + <xs:sequence> + <xs:element name="Timestamp" type="xs:dateTime"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="Origin" type="msg:SystemComponentType"> + <xs:annotation> + <xs:documentation>Herkunftssystem: Zustellsystem oder Kommunikationssystem der Behörde, von welchem die Nachricht oder Empfängerrdaten stammen</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ParticipantID" type="msg:token256"> + <xs:annotation> + <xs:documentation>ParticipantID = Landeskennung ":" ID +ID = "VKZ:" VKZ | Org-Id +VKZ ::= 1#32UACHAR;(Verwaltungskennzeichen gem. [VKZ]) +Org-Id ::= 1#32UACHAR;(Org-Id gem. [VKZ]) +Landeskennung ::= {2} ALPHA; (gem. ISO 3166 - Alpha2) +(nicht normativ / nach ldap.gv.at) Beispiele: "AT:B:102", "AT:VKZ:GGA-12345", "AT:L9:9876"</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PreAdviceNote" type="msg:PreAdviceNoteType"> + <xs:annotation> + <xs:documentation>Aviso (optional)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PreAdviceNoteSent" type="msg:PreAdviceNoteSentType"> + <xs:annotation> + <xs:documentation>Existenz des Elements zeigt an, dass ein Aviso erfolgreich an alle Verständigungsadressen des Teilnahmkandidaten versendet wurde</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="PreAdviceNoteSentType"> + <xs:annotation> + <xs:documentation>(Technisch Notwendig, um implizites XML-Any zu verhindern)</xs:documentation> + </xs:annotation> + </xs:complexType> + <xs:complexType name="PreAdviceNoteType"> + <xs:sequence> + <xs:element name="NumberOfDays" type="xs:positiveInteger"> + <xs:annotation> + <xs:documentation>Frist von der Behörde bis wann die Registrierung erfolgt sein muss, um dass Behördenschriftstück noch elektronisch zu bekommen. Anderenfalls wird das Schriftstück von der Behörde auf dem normalen Postweg versandt. Diese Info wird im Aviso-E-Mail mitgegeben.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:NotificationAddressList" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:element name="PrivateMessageQuality"> + <xs:annotation> + <xs:documentation>Qualität der privatrechtlichen Zusendung ist von der Zustellqualität lt. ZustellG zu unterscheiden: +• Information +• RegisteredMail +• RegisteredMail+ +• ConfirmReceipt +• ConfirmReceipt+</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="Information"/> + <xs:enumeration value="RegisteredMail"/> + <xs:enumeration value="RegisteredMail+"/> + <xs:enumeration value="ConfirmReceipt"/> + <xs:enumeration value="ConfirmReceipt+"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="ProfileID" type="xs:token"> + <xs:annotation> + <xs:documentation>ID mit der der Versender beim Zustellsystem registriert ist. (Das Zustellsystem ist für den Inhalt der Personendaten des Versenders verantwortlich, um sicherzustellen, dass diese nicht missbräuchlich verwendet werden (Vortäuschung einer anderen Identität))</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Receiver"> + <xs:annotation> + <xs:documentation>Informationen zum Empfänger</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:choice> + <xs:element ref="p:Identification"/> + <xs:sequence> + <xs:element ref="p:Person"/> + <xs:element ref="msg:AustrianAddressesOnly" minOccurs="0"/> + <xs:element ref="p:Address" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:choice> + <xs:element ref="msg:AdditionalCriteria" minOccurs="0"/> + <xs:element ref="msg:PreAdviceNote" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="ReceiverDetails" type="p:PersonAndIdentificationType"> + <xs:annotation> + <xs:documentation>Informationen nur für Senderidentifikation</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Reference"> + <xs:annotation> + <xs:documentation>Referenz auf ein anderes Zustellstück (ZSDeliveryID), auf die sich diese Zustellung bezieht</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:ZSDeliveryID"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="RelayedViaERV"> + <xs:annotation> + <xs:documentation>Gibt an ob das Zustellstück über den ERV zugestellt wurde</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:ERVCode"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Roles"> + <xs:annotation> + <xs:documentation>Rollen, welche neben globalen Vertretungsbefugten Zustellstücke entgegennehmen dürfen</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="Role" maxOccurs="unbounded"> + <xs:complexType> + <xs:sequence> + <xs:element name="Value" type="msg:token256"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Sender"> + <xs:annotation> + <xs:documentation>Informationen zum Sender</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:SenderPerson"/> + <xs:element ref="msg:ClearingProfilID" minOccurs="0"/> + <xs:element ref="msg:Logo" minOccurs="0"/> + <xs:element ref="msg:AdditionalCriteria" minOccurs="0"> + <xs:annotation> + <xs:documentation>Spezielles Postfach des Versenders z.B. eine Filiale einer jur. Person an welches dieser eine etwaige Antwort retourniert haben möchte</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="msg:ConfirmationAddress" minOccurs="0"> + <xs:annotation> + <xs:documentation>Webservice oder E-Mail-Adresse, an welche die Übergabebestätigung, der Zustellnachweis oder die Fehlermeldung zurückgemeldet wird (Callback)</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="SenderCorporateBody" type="msg:SenderCorporateBodyType" substitutionGroup="msg:SenderPerson"> + <xs:annotation> + <xs:documentation>Versender ist eine Behörde oder ein Unternehmen, das im gesetzlichen Auftrag handeln</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="SenderCorporateBodyType"> + <xs:annotation> + <xs:documentation>juridical person, organisation</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="msg:AbstractSenderPersonType"> + <xs:choice> + <xs:element ref="msg:SenderProfile"/> + <xs:sequence> + <xs:element ref="p:Identification"/> + <xs:element ref="p:CorporateBody"/> + </xs:sequence> + </xs:choice> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="SenderDetails" type="p:PersonAndIdentificationType"> + <xs:annotation> + <xs:documentation>Informationen nur für Senderidentifikation</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SenderPerson" type="msg:AbstractSenderPersonType"> + <xs:annotation> + <xs:documentation>Die Person des Versenders wird über das Clientzertifikat authentifiziert mit dem sich das IT-Service des Versenders mit seinem Zustellsystem verbindet. (Bei Behörden erfolgt die Authentifizierung über PVP-Header)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SenderProfile"> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:ProfileID"/> + <xs:element ref="p:Organization" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="ServiceProviderID" type="msg:token256"> + <xs:annotation> + <xs:documentation>ID des Dienstleisters, der für den Versender die Kommunikation mit dem Zustelldienst bzw. generell dem Zustellsystem durchführt. In diesem Fall ist der Dienstleister der Rechnungsempfänger</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="SimpleRequestType"> + <xs:annotation> + <xs:documentation>Einfacher "Request" ohne Datenelemente</xs:documentation> + </xs:annotation> + </xs:complexType> + <xs:element name="Subject" type="xs:token"> + <xs:annotation> + <xs:documentation>Zur Anzeige in der Mailbox, vgl. Subject von herkömml. E-mails</xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="SystemComponentType"> + <xs:annotation> + <xs:documentation>Systemkomponente der E-Zustellung: Portal oder Zustellsystem. (Ein Zustellsystem ist entweder ein Zustelldienst, ein Kommunikationssystem der Behörde oder ein Zielsystem)</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element ref="msg:ParticipantID"> + <xs:annotation> + <xs:documentation>ParticipantID = Landeskennung ":" ID +ID = "VKZ:" VKZ | Org-Id +VKZ ::= 1#32UACHAR; (Verwaltungskennzeichen gem. [VKZ]) +Org-Id ::= 1#32UACHAR; (Org-Id gem. [VKZ]) +Landeskennung ::= {2} ALPHA; (gem. ISO 3166 - Alpha2) +(nicht normativ / nach ldap.gv.at) Beispiele: "AT:B:102", "AT:VKZ:GGA-12345", "AT:L9:9876"</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="Tag" type="msg:token256"/> + <xs:element name="Tags"> + <xs:annotation> + <xs:documentation>Schlagworte zu einer Nachricht nach welchen ein Benutzer suchen kann. (Dieser müssen vom Versender einer Nachricht gesetzt werden)</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="msg:Tag" maxOccurs="20"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="TargetIdentification" type="p:IdentificationType"> + <xs:annotation> + <xs:documentation>Wenn im DeliveryRequest ein Target angegeben wurde, d.h. der Bereich und das VKZ des behördlichen Versenders, dann enthält das TargetIdentification Element das entsprechende, umgeschlüsselt vbPK für den Versender</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Timestamp" type="xs:dateTime"> + <xs:annotation> + <xs:documentation>Timestamp, der vom Anzeigemodul erzeugt wurde. Im Falle der Annahme einer Zustellung entspricht der Timestamp dem Zustellzeitpunkt</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="User"> + <xs:annotation> + <xs:documentation>Benutzer, der die Nachricht angenommen oder gelöscht hat. Wenn die Nachrichtenoperation vom System des Anzeigemoduls ausgelöst wurde, bleibt das User Element leer</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="Role"> + <xs:annotation> + <xs:documentation>Rolle des Benutzers: +• Receiver: Empfänger persönlich +• Representative: Vertretungsbevollmächtigter +• InsolvencyAdministrator: Insolvenzverwalters +• System: Eine Systemkomponente der eZustellung ist Auslöser der MessageOperation + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="Receiver"/> + <xs:enumeration value="Representative"/> + <xs:enumeration value="InsolvencyAdministrator"/> + <xs:enumeration value="System"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element ref="p:Identification"/> + <xs:element ref="msg:TargetIdentification" minOccurs="0"/> + <xs:element ref="p:PhysicalPerson"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="WebserviceURL"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="p:InternetAddressType"> + <xs:attribute name="AlternativeEmail" type="xs:anyURI"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="ZSDeliveryID" type="msg:token256"> + <xs:annotation> + <xs:documentation>ID des Zustellstückes MUSS über alle Zustellsysteme eindeutig sein. Die ZSDeliveryID wird durch eine UUID gemäß RFC-4122 repräsentiert. Der Node-Teil MUSS pro Zustellsystem eindeutig sein und wird vom Anzeigemodul vergeben.</xs:documentation> + </xs:annotation> + </xs:element> + <!--### Simple Types--> + <xs:simpleType name="token256"> + <xs:annotation> + <xs:documentation>Token auf 256 Zeichen beschränkt.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:minLength value="1"/> + <xs:maxLength value="256"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="AustrianLanguageType"> + <xs:annotation> + <xs:documentation>2-stelliger Sprachcode der anerkannten österreichischen Minderheiten</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:minLength value="2"/> + <xs:maxLength value="2"/> + <xs:enumeration value="DE"/> + <xs:enumeration value="HR"/> + <xs:enumeration value="HU"/> + <xs:enumeration value="SL"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="FileNameType"> + <xs:annotation> + <xs:documentation>Typ zur Beschränkung von Dateinamen auf minimal 5 Zeichen und maximal 255 Zeichen</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:maxLength value="255"/> + <xs:minLength value="5"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="VersionNumberType"> + <xs:annotation> + <xs:documentation>Typ definiert einen regulären Ausdruck für Versionsnummer - z.B. 1.0.0</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern value="[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}"/> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/moaSig/common/src/test/java/console/SchemaValidationTest.java b/moaSig/common/src/test/java/console/SchemaValidationTest.java new file mode 100644 index 0000000..db3041b --- /dev/null +++ b/moaSig/common/src/test/java/console/SchemaValidationTest.java @@ -0,0 +1,52 @@ +package console; + +import java.io.InputStream; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moaspss.util.DOMUtils; + +public class SchemaValidationTest { + + public static final String SCHEMA_ROOT = "/config/zuseSchema"; + + public static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace"; + public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; + + public static final String XSI_NS_URI = "http://www.w3.org/2001/XMLSchema-instance"; + public static final String XSI_SCHEMA_LOCATION = SCHEMA_ROOT + "XMLSchema-instance.xsd"; + + public static final String eDELIVERY20 = "http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#"; + public static final String eDELIVERY20_SCHEMA_LOCATION = SCHEMA_ROOT + "zuse_p2.xsd"; + + public static final String eDELIVERY_PERSON_20 = "http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#"; + public static final String eDELIVERY_PERSON_20_SCHEMA_LOCATION = SCHEMA_ROOT + "zuse_mypersondata_en_p2.xsd"; + + private static final String ZUSE_SCHEMAS = + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") + + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") + + (eDELIVERY20 + " " + eDELIVERY20_SCHEMA_LOCATION + " ") + + (eDELIVERY_PERSON_20 + " " + eDELIVERY_PERSON_20_SCHEMA_LOCATION); + + /** + * Simple test. + * + * @param args not used yet + * @throws Exception in case of an error + */ + public static void main(String[] args) throws Exception { + + InputStream is = SchemaValidationTest.class.getResourceAsStream("/zuse/msg.xml"); + + + Element result = DOMUtils.parseXmlValidating(is); + +// Document result = DOMUtils.parseDocument(is, +// true, ZUSE_SCHEMAS, null, new MOASPSSEntityResolver(), new MOAErrorHandler()); + + + System.out.print(DOMUtils.serializeNode(result)); + + } + +} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java index 569c24c..f64802d 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java @@ -24,11 +24,11 @@ package test.at.gv.egovernment.moa; -import test.at.gv.egovernment.moa.util.DOMUtilsTest; +//import test.at.gv.egovernment.moa.util.DOMUtilsTest; import test.at.gv.egovernment.moa.util.DateTimeUtilsTest; -import test.at.gv.egovernment.moa.util.KeyStoreUtilsTest; -import test.at.gv.egovernment.moa.util.SSLUtilsTest; -import test.at.gv.egovernment.moa.util.XPathUtilsTest; +//import test.at.gv.egovernment.moa.util.KeyStoreUtilsTest; +//import test.at.gv.egovernment.moa.util.SSLUtilsTest; +//import test.at.gv.egovernment.moa.util.XPathUtilsTest; //import junit.awtui.TestRunner; import junit.framework.Test; diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java index 1754ead..2d2e3ee 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java @@ -36,6 +36,7 @@ import org.xml.sax.InputSource; import at.gv.egovernment.moaspss.util.Constants; import at.gv.egovernment.moaspss.util.DOMUtils; +import at.gv.egovernment.moaspss.util.URLEncoder; import junit.framework.TestCase; /** @@ -46,7 +47,7 @@ import junit.framework.TestCase; * @author Patrick Peck * @version $Id$ */ -public class MOATestCase extends TestCase { +public class MOATestCase { protected static final String TESTDATA_ROOT = "data/test/"; @@ -55,13 +56,14 @@ public class MOATestCase extends TestCase { * @param arg0 */ public MOATestCase(String name) { - super(name); + super(); } + /** * Parse an XML file non-validating. */ - public static Document parseXml(String fileName) throws Exception { + protected static Document parseXml(String fileName) throws Exception { return DOMUtils.parseDocument( new FileInputStream(fileName), false, @@ -74,7 +76,7 @@ public class MOATestCase extends TestCase { * * Uses the local schema resources. */ - public static Document parseXmlValidating(String fileName) throws Exception { + protected static Document parseXmlValidating(String fileName) throws Exception { return DOMUtils.parseDocument( new FileInputStream(fileName), true, @@ -85,7 +87,7 @@ public class MOATestCase extends TestCase { /** * Parse an XML from a String. */ - public static Document parseXmlString(String xml) throws Exception { + protected static Document parseXmlString(String xml) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java index e62d896..5093184 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -1,160 +1,160 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; -import java.io.FileInputStream; -import java.util.Map; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import at.gv.egovernment.moaspss.util.Constants; -import at.gv.egovernment.moaspss.util.DOMUtils; -import test.at.gv.egovernment.moa.*; - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class DOMUtilsTest extends MOATestCase { - private static final String TESTDATA_BASE = TESTDATA_ROOT + "xml/"; - private static boolean grammarsInitialized = false; - - /** - * Constructor for DOMUtilsTest. - * @param name - */ - public DOMUtilsTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - if (!grammarsInitialized) { - // preparse XML schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.XML_SCHEMA_LOCATION), - Constants.XML_NS_URI); - // preparse XMLDsig Filter2 schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), - Constants.DSIG_FILTER2_NS_URI); - // preparse XMLDsig schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), - Constants.DSIG_NS_URI); - // preparse MOA schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), - Constants.MOA_NS_URI); - grammarsInitialized = true; - } - } - - private Document parse(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - true, - Constants.ALL_SCHEMA_LOCATIONS, - null); - } - - public void testParseCreateXMLSignature() throws Exception { - parse(TESTDATA_BASE + "CreateXMLSignature/TestGeneratorCX2.005.Req.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req001.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req002.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req004.xml"); - } - - public void testParseVerifyCMSSignature() throws Exception { - parse(TESTDATA_BASE + "VerifyCMSSignature/Req000.xml"); - } - - public void testParseVerifyXMLSignature() throws Exception { - parse(TESTDATA_BASE + "VerifyXMLSignature/Req000.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/Req001.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.002.Req.xml"); - //parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.006.Req.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/VerifySAMLRequest.xml"); - } - - public void testParseInfobox() throws Exception { - parse(TESTDATA_BASE + "Infobox/InfoboxReadResponseMOA4.xml"); - parse(TESTDATA_BASE + "Infobox/InfoboxReadResponse.xml"); - } - - - private Document parsePlain(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - false, - null, - null); - } - - public void testValidateCreateXMLSignature() throws Exception { - Document doc; - boolean valid; - - // test a valid request - doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); - valid = - DOMUtils.validateElement( - doc.getDocumentElement(), - Constants.ALL_SCHEMA_LOCATIONS, - null); - assertTrue(valid); - - // test an invalid request - doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/invalid.xml"); - try { - valid = - DOMUtils.validateElement( - doc.getDocumentElement(), - Constants.ALL_SCHEMA_LOCATIONS, - null); - fail(); - } catch (Exception e) { - } - } - - public void testGetNamespaceDeclarations() throws Exception { - Document doc; - NodeList nl; - Element elem; - Map nsDecls; - - doc = parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); - nl = doc.getElementsByTagNameNS(Constants.DSIG_NS_URI, "Reference"); - elem = (Element) nl.item(0); - nsDecls = DOMUtils.getNamespaceDeclarations(elem); - - assertEquals(2, nsDecls.size()); - assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); - assertEquals(Constants.MOA_NS_URI, nsDecls.get("")); - } - -} +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +//import java.io.FileInputStream; +//import java.util.Map; +// +//import org.w3c.dom.Document; +//import org.w3c.dom.Element; +//import org.w3c.dom.NodeList; +// +//import at.gv.egovernment.moaspss.util.Constants; +//import at.gv.egovernment.moaspss.util.DOMUtils; +//import test.at.gv.egovernment.moa.*; +// +///** +// * @author Patrick Peck +// * @version $Id$ +// */ +//public class DOMUtilsTest extends MOATestCase { +// private static final String TESTDATA_BASE = TESTDATA_ROOT + "xml/"; +// private static boolean grammarsInitialized = false; +// +// /** +// * Constructor for DOMUtilsTest. +// * @param name +// */ +// public DOMUtilsTest(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// if (!grammarsInitialized) { +// // preparse XML schema +// DOMUtils.addSchemaToPool( +// getClass().getResourceAsStream(Constants.XML_SCHEMA_LOCATION), +// Constants.XML_NS_URI); +// // preparse XMLDsig Filter2 schema +// DOMUtils.addSchemaToPool( +// getClass().getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), +// Constants.DSIG_FILTER2_NS_URI); +// // preparse XMLDsig schema +// DOMUtils.addSchemaToPool( +// getClass().getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), +// Constants.DSIG_NS_URI); +// // preparse MOA schema +// DOMUtils.addSchemaToPool( +// getClass().getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), +// Constants.MOA_NS_URI); +// grammarsInitialized = true; +// } +// } +// +// private Document parse(String fileName) throws Exception { +// return DOMUtils.parseDocument( +// new FileInputStream(fileName), +// true, +// Constants.ALL_SCHEMA_LOCATIONS, +// null); +// } +// +// public void testParseCreateXMLSignature() throws Exception { +// parse(TESTDATA_BASE + "CreateXMLSignature/TestGeneratorCX2.005.Req.xml"); +// parse(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); +// parse(TESTDATA_BASE + "CreateXMLSignature/Req001.xml"); +// parse(TESTDATA_BASE + "CreateXMLSignature/Req002.xml"); +// parse(TESTDATA_BASE + "CreateXMLSignature/Req004.xml"); +// } +// +// public void testParseVerifyCMSSignature() throws Exception { +// parse(TESTDATA_BASE + "VerifyCMSSignature/Req000.xml"); +// } +// +// public void testParseVerifyXMLSignature() throws Exception { +// parse(TESTDATA_BASE + "VerifyXMLSignature/Req000.xml"); +// parse(TESTDATA_BASE + "VerifyXMLSignature/Req001.xml"); +// parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); +// parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.002.Req.xml"); +// //parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.006.Req.xml"); +// parse(TESTDATA_BASE + "VerifyXMLSignature/VerifySAMLRequest.xml"); +// } +// +// public void testParseInfobox() throws Exception { +// parse(TESTDATA_BASE + "Infobox/InfoboxReadResponseMOA4.xml"); +// parse(TESTDATA_BASE + "Infobox/InfoboxReadResponse.xml"); +// } +// +// +// private Document parsePlain(String fileName) throws Exception { +// return DOMUtils.parseDocument( +// new FileInputStream(fileName), +// false, +// null, +// null); +// } +// +// public void testValidateCreateXMLSignature() throws Exception { +// Document doc; +// boolean valid; +// +// // test a valid request +// doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); +// valid = +// DOMUtils.validateElement( +// doc.getDocumentElement(), +// Constants.ALL_SCHEMA_LOCATIONS, +// null); +// assertTrue(valid); +// +// // test an invalid request +// doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/invalid.xml"); +// try { +// valid = +// DOMUtils.validateElement( +// doc.getDocumentElement(), +// Constants.ALL_SCHEMA_LOCATIONS, +// null); +// fail(); +// } catch (Exception e) { +// } +// } +// +// public void testGetNamespaceDeclarations() throws Exception { +// Document doc; +// NodeList nl; +// Element elem; +// Map nsDecls; +// +// doc = parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); +// nl = doc.getElementsByTagNameNS(Constants.DSIG_NS_URI, "Reference"); +// elem = (Element) nl.item(0); +// nsDecls = DOMUtils.getNamespaceDeclarations(elem); +// +// assertEquals(2, nsDecls.size()); +// assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); +// assertEquals(Constants.MOA_NS_URI, nsDecls.get("")); +// } +// +//} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java index 443452c..5501400 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -1,113 +1,113 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.KeyStore; -import java.security.Security; -import java.security.cert.X509Certificate; -import java.util.Enumeration; - -import at.gv.egovernment.moaspss.util.KeyStoreUtils; -import junit.framework.TestCase; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class KeyStoreUtilsTest extends TestCase { - private String tmpDir = "tmp/KeyStoreUtilsTest"; - private String tmpDirURL = "file:" + tmpDir; - - public KeyStoreUtilsTest(String arg0) { - super(arg0); - } - - protected void setUp() throws Exception { - //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - new File(tmpDir).mkdirs(); - } - protected void tearDown() throws Exception { - new File(tmpDir).delete(); - } - public void testCreateKeyStoreJKS() throws Exception { - String[] certFilenames = new String[] { - "data/test/security/server-certs/baltimore.cer" - }; - KeyStore ks = KeyStoreUtils.createKeyStore("jks", certFilenames); - assertEquals(1, ks.size()); - X509Certificate cert = (X509Certificate)ks.getCertificate("0"); - assertEquals(3424, cert.getSerialNumber().intValue()); - } - public void testCreateKeyStorePKCS12() throws Exception { - String[] certFilenames = new String[] { - "data/test/security/server-certs/baltimore.cer" - }; - KeyStore ks = KeyStoreUtils.createKeyStore("pkcs12", certFilenames); - assertEquals(1, ks.size()); - X509Certificate cert = (X509Certificate)ks.getCertificate("0"); - assertEquals(3424, cert.getSerialNumber().intValue()); - } - public void testCreateKeyStoreFromCertificateDirectory() throws Exception { - // copy certificate files to a temporary directory, - // omitting the "CVS" directory in the source directory - copyCertificates("data/test/security/server-certs", tmpDir); - KeyStore ks = KeyStoreUtils.createKeyStoreFromCertificateDirectory("jks", tmpDirURL); - assertEquals(2, ks.size()); - X509Certificate cert0 = (X509Certificate)ks.getCertificate("0"); - X509Certificate cert1 = (X509Certificate)ks.getCertificate("1"); - assertTrue(3424 == cert0.getSerialNumber().intValue() || 3424 == cert1.getSerialNumber().intValue()); - } - private void copyCertificates(String from, String to) throws IOException { - String[] fromList = new File(from).list(); - for (int i = 0; i < fromList.length; i++) { - File fromFile = new File(from + File.separator + fromList[i]); - if (fromFile.isFile()) { - String toFile = to + "/" + fromList[i]; - FileInputStream in = new FileInputStream(fromFile); - FileOutputStream out = new FileOutputStream(toFile); - for (int ch = in.read(); ch >= 0; ch = in.read()) - out.write(ch); - out.close(); - in.close(); - } - } - - } - public void testLoadKeyStore() throws Exception { - String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; - KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); - assertEquals(1, ks.size()); - Enumeration aliases = ks.aliases(); - String alias = (String)aliases.nextElement(); - X509Certificate cert = (X509Certificate)ks.getCertificate(alias); - assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); - } - -} +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +// +//import java.io.File; +//import java.io.FileInputStream; +//import java.io.FileOutputStream; +//import java.io.IOException; +//import java.math.BigInteger; +//import java.security.KeyStore; +//import java.security.Security; +//import java.security.cert.X509Certificate; +//import java.util.Enumeration; +// +//import at.gv.egovernment.moaspss.util.KeyStoreUtils; +//import junit.framework.TestCase; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class KeyStoreUtilsTest extends TestCase { +// private String tmpDir = "tmp/KeyStoreUtilsTest"; +// private String tmpDirURL = "file:" + tmpDir; +// +// public KeyStoreUtilsTest(String arg0) { +// super(arg0); +// } +// +// protected void setUp() throws Exception { +// //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); +// new File(tmpDir).mkdirs(); +// } +// protected void tearDown() throws Exception { +// new File(tmpDir).delete(); +// } +// public void testCreateKeyStoreJKS() throws Exception { +// String[] certFilenames = new String[] { +// "data/test/security/server-certs/baltimore.cer" +// }; +// KeyStore ks = KeyStoreUtils.createKeyStore("jks", certFilenames); +// assertEquals(1, ks.size()); +// X509Certificate cert = (X509Certificate)ks.getCertificate("0"); +// assertEquals(3424, cert.getSerialNumber().intValue()); +// } +// public void testCreateKeyStorePKCS12() throws Exception { +// String[] certFilenames = new String[] { +// "data/test/security/server-certs/baltimore.cer" +// }; +// KeyStore ks = KeyStoreUtils.createKeyStore("pkcs12", certFilenames); +// assertEquals(1, ks.size()); +// X509Certificate cert = (X509Certificate)ks.getCertificate("0"); +// assertEquals(3424, cert.getSerialNumber().intValue()); +// } +// public void testCreateKeyStoreFromCertificateDirectory() throws Exception { +// // copy certificate files to a temporary directory, +// // omitting the "CVS" directory in the source directory +// copyCertificates("data/test/security/server-certs", tmpDir); +// KeyStore ks = KeyStoreUtils.createKeyStoreFromCertificateDirectory("jks", tmpDirURL); +// assertEquals(2, ks.size()); +// X509Certificate cert0 = (X509Certificate)ks.getCertificate("0"); +// X509Certificate cert1 = (X509Certificate)ks.getCertificate("1"); +// assertTrue(3424 == cert0.getSerialNumber().intValue() || 3424 == cert1.getSerialNumber().intValue()); +// } +// private void copyCertificates(String from, String to) throws IOException { +// String[] fromList = new File(from).list(); +// for (int i = 0; i < fromList.length; i++) { +// File fromFile = new File(from + File.separator + fromList[i]); +// if (fromFile.isFile()) { +// String toFile = to + "/" + fromList[i]; +// FileInputStream in = new FileInputStream(fromFile); +// FileOutputStream out = new FileOutputStream(toFile); +// for (int ch = in.read(); ch >= 0; ch = in.read()) +// out.write(ch); +// out.close(); +// in.close(); +// } +// } +// +// } +// public void testLoadKeyStore() throws Exception { +// String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; +// KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); +// assertEquals(1, ks.size()); +// Enumeration aliases = ks.aliases(); +// String alias = (String)aliases.nextElement(); +// X509Certificate cert = (X509Certificate)ks.getCertificate(alias); +// assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); +// } +// +//} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java index 8715380..5b5c910 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -1,182 +1,182 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; - -import java.net.URL; -import java.security.KeyStore; -import java.security.Security; - -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLSocketFactory; - -import junit.framework.TestCase; - -//import com.sun.net.ssl.HostnameVerifier; -//import com.sun.net.ssl.HttpsURLConnection; - -import at.gv.egovernment.moaspss.util.KeyStoreUtils; -import at.gv.egovernment.moaspss.util.SSLUtils; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class SSLUtilsTest extends TestCase { - - public SSLUtilsTest(String arg0) { - super(arg0); - } - - - protected void setUp() throws Exception { - //System.setProperty("javax.net.debug", "all"); - //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); - System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); - } - - public void testGetSSLSocketFactoryBaltimoreOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.baltimore.com/", - false, - "file:data/test/security/cacerts+gt_cybertrust_root", - "changeit", - true); - } - public void testGetSSLSocketFactoryBaltimoreNOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.baltimore.com/", - false, - "file:data/test/security/cacerts", - "changeit", - false); - } - public void testGetSSLSocketFactoryVerisignOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.verisign.com/", - false, - "file:data/test/security/cacerts", - "changeit", - true); - } - public void testGetSSLSocketFactoryVerisignNoTruststoreOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.verisign.com/", - false, - null, - null, - true); - } - public void testGetSSLSocketFactoryLocalhostOK() throws Exception { - String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; - doTestGetSSLSocketFactory( - "GET", - urlString, - true, - "file:data/test/security/server.keystore.tomcat", - "changeit", - true); - } - public void testGetSSLSocketFactoryLocalhostNOK() throws Exception { - String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; - doTestGetSSLSocketFactory( - "GET", - urlString, - true, - null, - null, - false); - } - - public void doTestGetSSLSocketFactory( - String requestMethod, - String urlString, - boolean useHostnameVerifierHack, - String truststoreurl, - String trustpassword, - boolean shouldOk - ) throws Exception { - - doTestGetSSLSocketFactory( - requestMethod, urlString, useHostnameVerifierHack, truststoreurl, trustpassword, null, null, null, shouldOk); - } - public void doTestGetSSLSocketFactory( - String requestMethod, - String urlString, - boolean useHostnameVerifierHack, - String truststoreurl, - String trustpassword, - String keystoretype, - String keystoreurl, - String keypassword, - boolean shouldOk - ) throws Exception { - - KeyStore truststore = null; - if (truststoreurl != null) - truststore = KeyStoreUtils.loadKeyStore("jks", truststoreurl, trustpassword); - SSLSocketFactory sf = SSLUtils.getSSLSocketFactory( - truststore, keystoretype, keystoreurl, keypassword); - System.out.println(requestMethod + " " + urlString); - - URL url = new URL(urlString); - /*HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); - conn.setRequestMethod(requestMethod); - conn.setDoInput(true); - conn.setDoOutput(true); - conn.setUseCaches(false); - conn.setAllowUserInteraction(false); - conn.setSSLSocketFactory(sf); - if (useHostnameVerifierHack) - conn.setHostnameVerifier(new HostnameVerifierHack()); - try { - conn.connect(); - assertTrue(shouldOk); - assertEquals(200, conn.getResponseCode()); - conn.disconnect(); - } - catch (SSLException ex) { - assertFalse(shouldOk); - } - }*/ -// private byte[] readTruststore(String filename) throws IOException { -// if (filename == null) -// return null; -// FileInputStream in = new FileInputStream(filename); -// byte[] buffer = new byte[in.available()]; -// in.read(buffer); -// in.close(); -// return buffer; +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +// +//import java.net.URL; +//import java.security.KeyStore; +//import java.security.Security; +// +//import javax.net.ssl.SSLException; +//import javax.net.ssl.SSLSocketFactory; +// +//import junit.framework.TestCase; +// +////import com.sun.net.ssl.HostnameVerifier; +////import com.sun.net.ssl.HttpsURLConnection; +// +//import at.gv.egovernment.moaspss.util.KeyStoreUtils; +//import at.gv.egovernment.moaspss.util.SSLUtils; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class SSLUtilsTest extends TestCase { +// +// public SSLUtilsTest(String arg0) { +// super(arg0); +// } +// +// +// protected void setUp() throws Exception { +// //System.setProperty("javax.net.debug", "all"); +// //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); +// System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); +// System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); +// } +// +// public void testGetSSLSocketFactoryBaltimoreOK() throws Exception { +// doTestGetSSLSocketFactory( +// "GET", +// "https://www.baltimore.com/", +// false, +// "file:data/test/security/cacerts+gt_cybertrust_root", +// "changeit", +// true); // } - //private class HostnameVerifierHack implements HostnameVerifier { - //public boolean verify(String arg0, String arg1) { - // return true; - //} - } -} +// public void testGetSSLSocketFactoryBaltimoreNOK() throws Exception { +// doTestGetSSLSocketFactory( +// "GET", +// "https://www.baltimore.com/", +// false, +// "file:data/test/security/cacerts", +// "changeit", +// false); +// } +// public void testGetSSLSocketFactoryVerisignOK() throws Exception { +// doTestGetSSLSocketFactory( +// "GET", +// "https://www.verisign.com/", +// false, +// "file:data/test/security/cacerts", +// "changeit", +// true); +// } +// public void testGetSSLSocketFactoryVerisignNoTruststoreOK() throws Exception { +// doTestGetSSLSocketFactory( +// "GET", +// "https://www.verisign.com/", +// false, +// null, +// null, +// true); +// } +// public void testGetSSLSocketFactoryLocalhostOK() throws Exception { +// String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; +// doTestGetSSLSocketFactory( +// "GET", +// urlString, +// true, +// "file:data/test/security/server.keystore.tomcat", +// "changeit", +// true); +// } +// public void testGetSSLSocketFactoryLocalhostNOK() throws Exception { +// String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; +// doTestGetSSLSocketFactory( +// "GET", +// urlString, +// true, +// null, +// null, +// false); +// } +// +// public void doTestGetSSLSocketFactory( +// String requestMethod, +// String urlString, +// boolean useHostnameVerifierHack, +// String truststoreurl, +// String trustpassword, +// boolean shouldOk +// ) throws Exception { +// +// doTestGetSSLSocketFactory( +// requestMethod, urlString, useHostnameVerifierHack, truststoreurl, trustpassword, null, null, null, shouldOk); +// } +// public void doTestGetSSLSocketFactory( +// String requestMethod, +// String urlString, +// boolean useHostnameVerifierHack, +// String truststoreurl, +// String trustpassword, +// String keystoretype, +// String keystoreurl, +// String keypassword, +// boolean shouldOk +// ) throws Exception { +// +// KeyStore truststore = null; +// if (truststoreurl != null) +// truststore = KeyStoreUtils.loadKeyStore("jks", truststoreurl, trustpassword); +// SSLSocketFactory sf = SSLUtils.getSSLSocketFactory( +// truststore, keystoretype, keystoreurl, keypassword); +// System.out.println(requestMethod + " " + urlString); +// +// URL url = new URL(urlString); +// /*HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); +// conn.setRequestMethod(requestMethod); +// conn.setDoInput(true); +// conn.setDoOutput(true); +// conn.setUseCaches(false); +// conn.setAllowUserInteraction(false); +// conn.setSSLSocketFactory(sf); +// if (useHostnameVerifierHack) +// conn.setHostnameVerifier(new HostnameVerifierHack()); +// try { +// conn.connect(); +// assertTrue(shouldOk); +// assertEquals(200, conn.getResponseCode()); +// conn.disconnect(); +// } +// catch (SSLException ex) { +// assertFalse(shouldOk); +// } +// }*/ +//// private byte[] readTruststore(String filename) throws IOException { +//// if (filename == null) +//// return null; +//// FileInputStream in = new FileInputStream(filename); +//// byte[] buffer = new byte[in.available()]; +//// in.read(buffer); +//// in.close(); +//// return buffer; +//// } +// //private class HostnameVerifierHack implements HostnameVerifier { +// //public boolean verify(String arg0, String arg1) { +// // return true; +// //} +// } +//} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java index 7513b51..8a3f788 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -1,52 +1,52 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; - -import java.net.URLEncoder; - -import at.gv.egovernment.moaspss.util.FileUtils; -import at.gv.egovernment.moaspss.util.URLDecoder; -import junit.framework.TestCase; - -/* - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLDecoderTest extends TestCase { - - public void test() throws Exception { - String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\""; - String senc = URLEncoder.encode(s); - String sdec = URLDecoder.decode(senc, "ISO-8859-1"); - assertEquals(s, sdec); - } - public void testUTF8() throws Exception { - String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); - String senc = URLEncoder.encode(s); - String sdec = URLDecoder.decode(senc, "UTF-8"); - String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); - assertEquals(sutf8, sdec); - } -} +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +// +//import java.net.URLEncoder; +// +//import at.gv.egovernment.moaspss.util.FileUtils; +//import at.gv.egovernment.moaspss.util.URLDecoder; +//import junit.framework.TestCase; +// +///* +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class URLDecoderTest extends TestCase { +// +//// public void test() throws Exception { +//// String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\""; +//// String senc = URLEncoder.encode(s); +//// String sdec = URLDecoder.decode(senc, "ISO-8859-1"); +//// assertEquals(s, sdec); +//// } +//// public void testUTF8() throws Exception { +//// String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); +//// String senc = URLEncoder.encode(s); +//// String sdec = URLDecoder.decode(senc, "UTF-8"); +//// String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); +//// assertEquals(sutf8, sdec); +//// } +//} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java index 78c3c7c..f65b7cf 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -40,23 +40,23 @@ public class URLEncoderTest extends TestCase { String senc = URLEncoder.encode(s, "UTF-8"); assertEquals(s, senc); } - public void testAumlUTF8() throws Exception { - String s = "ä"; - String senc = URLEncoder.encode(s, "UTF-8"); - assertEquals("%C3%A4", senc); - } +// public void testAumlUTF8() throws Exception { +// String s = "ä"; +// String senc = URLEncoder.encode(s, "UTF-8"); +// assertEquals("%C3%A4", senc); +// } public void testEncodeDecode() throws Exception { String s = "AZaz09.-*_ <>%=$%&/()@?{}[]\\\""; String senc = URLEncoder.encode(s, "UTF-8"); String sdec = URLDecoder.decode(senc, "UTF-8"); assertEquals(s, sdec); } - public void testCertInfo() throws Exception { - String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); - String senc = URLEncoder.encode(s, "UTF-8"); - String sdec = URLDecoder.decode(senc, "UTF-8"); - assertEquals(s, sdec); - } +// public void testCertInfo() throws Exception { +// String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); +// String senc = URLEncoder.encode(s, "UTF-8"); +// String sdec = URLDecoder.decode(senc, "UTF-8"); +// assertEquals(s, sdec); +// } /*public void testJDK14() throws Exception { String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); String senc = URLEncoder.encode(s, "UTF-8"); diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java index b471fe6..69e85b7 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -1,122 +1,122 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; -import java.io.FileInputStream; -import java.io.InputStream; - -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.parsers.XMLGrammarPreparser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.util.XMLGrammarPoolImpl; -import org.apache.xerces.xni.grammars.Grammar; -import org.apache.xerces.xni.grammars.XMLGrammarDescription; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.xml.sax.InputSource; - -import at.gv.egovernment.moaspss.util.Constants; -import test.at.gv.egovernment.moa.MOATestCase; - - -/** - * Experimentation with Xerces grammar caching. - * - * Used the Xerces sample 'XMLGrammarBuilder' as a starting point. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLGrammarBuilderTest extends MOATestCase { - - private static final String GRAMMAR_POOL = - org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; - - protected static final String NAMESPACES_FEATURE_ID = - "http://xml.org/sax/features/namespaces"; - protected static final String VALIDATION_FEATURE_ID = - "http://xml.org/sax/features/validation"; - protected static final String SCHEMA_VALIDATION_FEATURE_ID = - "http://apache.org/xml/features/validation/schema"; - protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = - "http://apache.org/xml/features/validation/schema-full-checking"; - - private static final int BIG_PRIME = 2039; - private SymbolTable symbolTable; - private XMLGrammarPoolImpl grammarPool; - - /** - * Constructor for XMLGrammarBuilderTest. - * @param name - */ - public XMLGrammarBuilderTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - XMLGrammarPreparser preparser; - - // set up symbol table and grammar pool - symbolTable = new SymbolTable(BIG_PRIME); - grammarPool = new XMLGrammarPoolImpl(); - preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(GRAMMAR_POOL, grammarPool); - preparser.setFeature(NAMESPACES_FEATURE_ID, true); - preparser.setFeature(VALIDATION_FEATURE_ID, true); - // now we can still do schema features just in case, - // so long as it's our configuraiton...... - preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); - preparseSchemaResource( - preparser, - Constants.DSIG_SCHEMA_LOCATION, - "/resources/schemas/xmldsig-core-schema.xsd"); - } - - private static Grammar preparseSchemaResource( - XMLGrammarPreparser preparser, - String systemId, - String resource) - throws Exception { - - InputStream is = XMLGrammarBuilderTest.class.getResourceAsStream(resource); - return preparser.preparseGrammar( - XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, is, null)); - } - - public void testParseValidating() throws Exception { - DOMParser parser = new DOMParser(symbolTable, grammarPool); - - parser.setFeature(NAMESPACES_FEATURE_ID, true); - parser.setFeature(VALIDATION_FEATURE_ID, true); - parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); - - parser.parse( - new InputSource( - new FileInputStream(TESTDATA_ROOT + "xml/dsigTransform/base64.xml"))); - parser.getDocument(); - } - -} +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +//import java.io.FileInputStream; +//import java.io.InputStream; +// +//import org.apache.xerces.parsers.DOMParser; +//import org.apache.xerces.parsers.XMLGrammarPreparser; +//import org.apache.xerces.util.SymbolTable; +//import org.apache.xerces.util.XMLGrammarPoolImpl; +//import org.apache.xerces.xni.grammars.Grammar; +//import org.apache.xerces.xni.grammars.XMLGrammarDescription; +//import org.apache.xerces.xni.parser.XMLInputSource; +//import org.xml.sax.InputSource; +// +//import at.gv.egovernment.moaspss.util.Constants; +//import test.at.gv.egovernment.moa.MOATestCase; +// +// +///** +// * Experimentation with Xerces grammar caching. +// * +// * Used the Xerces sample 'XMLGrammarBuilder' as a starting point. +// * +// * @author Patrick Peck +// * @version $Id$ +// */ +//public class XMLGrammarBuilderTest extends MOATestCase { +// +// private static final String GRAMMAR_POOL = +// org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX +// + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; +// +// protected static final String NAMESPACES_FEATURE_ID = +// "http://xml.org/sax/features/namespaces"; +// protected static final String VALIDATION_FEATURE_ID = +// "http://xml.org/sax/features/validation"; +// protected static final String SCHEMA_VALIDATION_FEATURE_ID = +// "http://apache.org/xml/features/validation/schema"; +// protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = +// "http://apache.org/xml/features/validation/schema-full-checking"; +// +// private static final int BIG_PRIME = 2039; +// private SymbolTable symbolTable; +// private XMLGrammarPoolImpl grammarPool; +// +// /** +// * Constructor for XMLGrammarBuilderTest. +// * @param name +// */ +// public XMLGrammarBuilderTest(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// XMLGrammarPreparser preparser; +// +// // set up symbol table and grammar pool +// symbolTable = new SymbolTable(BIG_PRIME); +// grammarPool = new XMLGrammarPoolImpl(); +// preparser = new XMLGrammarPreparser(symbolTable); +// preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); +// preparser.setProperty(GRAMMAR_POOL, grammarPool); +// preparser.setFeature(NAMESPACES_FEATURE_ID, true); +// preparser.setFeature(VALIDATION_FEATURE_ID, true); +// // now we can still do schema features just in case, +// // so long as it's our configuraiton...... +// preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); +// preparseSchemaResource( +// preparser, +// Constants.DSIG_SCHEMA_LOCATION, +// "/resources/schemas/xmldsig-core-schema.xsd"); +// } +// +// private static Grammar preparseSchemaResource( +// XMLGrammarPreparser preparser, +// String systemId, +// String resource) +// throws Exception { +// +// InputStream is = XMLGrammarBuilderTest.class.getResourceAsStream(resource); +// return preparser.preparseGrammar( +// XMLGrammarDescription.XML_SCHEMA, +// new XMLInputSource(null, systemId, null, is, null)); +// } +// +//// public void testParseValidating() throws Exception { +//// DOMParser parser = new DOMParser(symbolTable, grammarPool); +//// +//// parser.setFeature(NAMESPACES_FEATURE_ID, true); +//// parser.setFeature(VALIDATION_FEATURE_ID, true); +//// parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); +//// +//// parser.parse( +//// new InputSource( +//// new FileInputStream(TESTDATA_ROOT + "xml/dsigTransform/base64.xml"))); +//// parser.getDocument(); +//// } +// +//} diff --git a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java index f2b216f..a80417f 100644 --- a/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java +++ b/moaSig/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -1,74 +1,74 @@ -/* - * Copyright 2003 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package test.at.gv.egovernment.moa.util; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import at.gv.egovernment.moaspss.util.XPathUtils; -import test.at.gv.egovernment.moa.MOATestCase; - - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class XPathUtilsTest extends MOATestCase { - - private Document doc1; - - /** - * Constructor for XPathUtilsTest. - * @param name - */ - public XPathUtilsTest(String name) { - super(name); - } - - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - doc1 = - parseXml(TESTDATA_ROOT + "xml/VerifyXMLSignature/Req000.xml"); - } - - public void testSelectNodeList() throws Exception { - NodeList nodes; - - nodes = - XPathUtils.selectNodeList( - doc1.getDocumentElement(), - doc1.getDocumentElement(), - "/VerifyXMLSignatureRequest"); - assertEquals(1, nodes.getLength()); - nodes = - XPathUtils.selectNodeList( - doc1.getDocumentElement(), - "//dsig:Signature"); - assertEquals(1, nodes.getLength()); - } - -} +///* +// * Copyright 2003 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +// +// +//package test.at.gv.egovernment.moa.util; +//import org.w3c.dom.Document; +//import org.w3c.dom.NodeList; +// +//import at.gv.egovernment.moaspss.util.XPathUtils; +//import test.at.gv.egovernment.moa.MOATestCase; +// +// +///** +// * @author Patrick Peck +// * @version $Id$ +// */ +//public class XPathUtilsTest extends MOATestCase { +// +// private Document doc1; +// +// /** +// * Constructor for XPathUtilsTest. +// * @param name +// */ +// public XPathUtilsTest(String name) { +// super(name); +// } +// +// /** +// * @see TestCase#setUp() +// */ +// protected void setUp() throws Exception { +// super.setUp(); +// doc1 = +// parseXml(TESTDATA_ROOT + "xml/VerifyXMLSignature/Req000.xml"); +// } +// +// public void testSelectNodeList() throws Exception { +// NodeList nodes; +// +// nodes = +// XPathUtils.selectNodeList( +// doc1.getDocumentElement(), +// doc1.getDocumentElement(), +// "/VerifyXMLSignatureRequest"); +// assertEquals(1, nodes.getLength()); +// nodes = +// XPathUtils.selectNodeList( +// doc1.getDocumentElement(), +// "//dsig:Signature"); +// assertEquals(1, nodes.getLength()); +// } +// +//} diff --git a/moaSig/common/src/test/resources/zuse/msg.xml b/moaSig/common/src/test/resources/zuse/msg.xml new file mode 100644 index 0000000..200950a --- /dev/null +++ b/moaSig/common/src/test/resources/zuse/msg.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?><ns2:DeliveryRequest xmlns="http://reference.e-government.gv.at/namespace/persondata/phase2/20181206#" xmlns:ns2="http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#"> + <ns2:Receiver> + <Identification> + <Value>urn:publicid:gv.at:ecdid+ZUSETNVZ+ZU</Value> + </Identification> + </ns2:Receiver> +</ns2:DeliveryRequest> |