summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUApplet/pom.xml74
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java74
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java57
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java106
-rw-r--r--BKUApplet/src/test/resources/appletTest.html2
-rw-r--r--BKULocal/pom.xml2
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java1
-rw-r--r--BKULocalApp/pom.xml6
-rw-r--r--BKUOnline/pom.xml108
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java3
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java8
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java18
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java10
-rw-r--r--BKUOnline/src/main/webapp/applet.jsp14
-rw-r--r--BKUOnline/src/main/webapp/slRequestForm.html3
-rw-r--r--STALExt/pom.xml2
-rw-r--r--STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java2
-rw-r--r--STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java5
-rw-r--r--STALXService/pom.xml25
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ATRType.java100
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeList.java71
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeType.java264
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/CommandAPDUType.java154
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ObjectFactory.java172
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResetType.java64
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseAPDUType.java161
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseType.java82
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ScriptType.java85
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/VerifyAPDUType.java266
-rw-r--r--STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/package-info.java2
-rw-r--r--STALXService/src/main/java/at/gv/egiz/stalx/service/STALPortType.java45
-rw-r--r--STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java73
-rw-r--r--STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java217
-rw-r--r--STALXService/src/main/resources/wsdl/CardChannel.xsd148
-rw-r--r--STALXService/src/main/resources/wsdl/stal.xsd162
-rw-r--r--STALXService/src/main/resources/wsdl/stalx.wsdl123
-rw-r--r--STALXService/src/test/java/at/gv/egiz/stalx/service/ClientJAXBContextFactory.java52
-rw-r--r--STALXService/src/test/java/at/gv/egiz/stalx/service/STALServiceTest.java112
-rw-r--r--bkucommon/pom.xml7
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java6
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java145
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java197
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java6
-rw-r--r--pom.xml7
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java5
-rw-r--r--utils/pom.xml5
-rw-r--r--utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java800
-rw-r--r--utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java6
-rw-r--r--utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java52
-rw-r--r--utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java86
-rw-r--r--utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java418
51 files changed, 3519 insertions, 1094 deletions
diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml
index 3b115399..da5dbc6f 100644
--- a/BKUApplet/pom.xml
+++ b/BKUApplet/pom.xml
@@ -23,35 +23,23 @@
<includeGroupIds>at.gv.egiz</includeGroupIds>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
- <excludes>META-INF\/</excludes><!--
- <artifactItems>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>smcc</artifactId>
- <type>jar</type>
- </artifactItem>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>smccSTAL</artifactId>
- <type>jar</type>
- </artifactItem>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>STAL</artifactId>
- <type>jar</type>
- </artifactItem>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>STALService</artifactId>
- <type>jar</type>
- </artifactItem>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>BKUCommonGUI</artifactId>
- <type>jar</type>
- </artifactItem>
- </artifactItems>
- --></configuration>
+ <excludes>META-INF\/</excludes>
+ </configuration>
+ </execution>
+ <execution>
+ <!-- appletviewer target/test-classes/appletTest.html
+ | commons-logging and iaik_jce_me4se are transitive dependencies
+ |-->
+ <id>copy_testapplet</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
+ <includeGroupIds>at.gv.egiz,commons-logging,iaik</includeGroupIds>
+ <includeArtifactIds>commons-logging,iaik_jce_me4se</includeArtifactIds>
+ <stripVersion>true</stripVersion>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -80,30 +68,6 @@
<verify>true</verify>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copytestlibs</id>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>iaik</groupId>
- <artifactId>iaik_jce_me4se</artifactId>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/test-libs</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<dependencies>
@@ -132,9 +96,5 @@
<artifactId>BKUCommonGUI</artifactId>
<version>1.0.5-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index 6ac892ec..388f045f 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -22,7 +22,6 @@ import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.service.STALPortType;
-import at.gv.egiz.stal.service.STALService;
import at.gv.egiz.stal.service.translator.STALTranslator;
import at.gv.egiz.stal.service.translator.TranslationException;
import at.gv.egiz.stal.service.types.ErrorResponseType;
@@ -31,13 +30,10 @@ import at.gv.egiz.stal.service.types.GetNextRequestType;
import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
-import java.applet.AppletContext;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceException;
/**
@@ -46,29 +42,19 @@ import javax.xml.ws.WebServiceException;
*/
public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
- protected AppletContext ctx;
- protected AppletParameterProvider params;
+ protected BKUApplet applet;
protected String sessionId;
- protected STALPortType stalPort;
+
private ObjectFactory stalObjFactory = new ObjectFactory();
- private STALTranslator translator = new STALTranslator();
- public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx,
- AppletParameterProvider paramProvider) {
+ public AppletBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
super(gui);
- if (ctx == null) {
- throw new NullPointerException("Applet context not provided");
- }
- if (paramProvider == null) {
- throw new NullPointerException("No applet parameters provided");
- }
- this.ctx = ctx;
- this.params = paramProvider;
-
- sessionId = params.getAppletParameter(BKUApplet.SESSION_ID);
+ this.applet = applet;
+
+ sessionId = applet.getParameter(BKUApplet.SESSION_ID);
if (sessionId == null) {
sessionId = "TestSession";
- log.info("using dummy sessionId " + sessionId);
+ log.warn("using dummy sessionId " + sessionId);
}
}
@@ -77,9 +63,11 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
gui.showWelcomeDialog();
try {
- stalPort = getSTALPort();
+ STALPortType stalPort = applet.getSTALPort();
+ STALTranslator stalTranslator = applet.getSTALTranslator();
- registerSignRequestHandler(stalPort, sessionId);
+ addRequestHandler(SignRequest.class,
+ new AppletHashDataDisplay(stalPort, sessionId));
GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId);
@@ -111,7 +99,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
List<STALRequest> stalRequests = new ArrayList<STALRequest>();
for (JAXBElement<? extends RequestType> req : requests) {
try {
- stalRequests.add(translator.translate(req));
+ stalRequests.add(stalTranslator.translate(req));
} catch (TranslationException ex) {
log.error("Received unknown request from server STAL: " + ex.getMessage());
throw new RuntimeException(ex);
@@ -123,7 +111,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
List<STALResponse> stalResponses = handleRequest(stalRequests);
for (STALResponse stalResponse : stalResponses) {
try {
- responses.add(translator.translate(stalResponse));
+ responses.add(stalTranslator.translate(stalResponse));
} catch (TranslationException ex) {
log.error("Received unknown response from STAL: " + ex.getMessage());
throw new RuntimeException(ex);
@@ -184,7 +172,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
}
}
- sendRedirect();
+ applet.sendRedirect(sessionId);
}
/**
@@ -218,38 +206,4 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
log.error(e);
}
}
-
- protected void sendRedirect() {
- try {
- URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL,
- sessionId);
- String redirectTarget = params.getAppletParameter(BKUApplet.REDIRECT_TARGET);
- if (redirectTarget == null) {
- log.info("Done. Redirecting to " + redirectURL + " ...");
- ctx.showDocument(redirectURL);
- } else {
- log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ...");
- ctx.showDocument(redirectURL, redirectTarget);
- }
- } catch (MalformedURLException ex) {
- log.warn("Failed to redirect: " + ex.getMessage(), ex);
- // gui.showErrorDialog(errorMsg, okListener, actionCommand)
- }
- }
-
- private STALPortType getSTALPort() throws MalformedURLException {
- URL wsdlURL = params.getURLParameter(BKUApplet.WSDL_URL);
- log.debug("STAL WSDL at " + wsdlURL);
- QName endpointName = new QName(BKUApplet.STAL_WSDL_NS,
- BKUApplet.STAL_SERVICE);
- STALService stal = new STALService(wsdlURL, endpointName);
- return stal.getSTALPort();
- }
-
- private void registerSignRequestHandler(STALPortType stalPort, String sessionId) {
- log.debug("register SignRequestHandler (resolve hashdata via STAL Webservice)");
- AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort,
- sessionId);
- addRequestHandler(SignRequest.class, handler);
- }
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java
deleted file mode 100644
index 42e2d6ff..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2008 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.online.applet;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public interface AppletParameterProvider {
-
- /**
- * Applet configuration parameters
- *
- * @param paramKey
- * @return null if no parameter is provided for the given key
- */
- String getAppletParameter(String paramKey);
-
- /**
- * Get applet configuration parameter as (absolute) URL
- *
- * @param paramKey
- * @return a URL
- * @throws MalformedURLException if configured URL is invalid
- * or no parameter is provided for the given key
- */
- URL getURLParameter(String paramKey) throws MalformedURLException;
-
- /**
- * Get applet configuration parameter as (absolute) URL
- *
- * @param paramKey
- * @param sessionId adds the jsessionid to the URL
- * @return a URL
- * @throws MalformedURLException if configured URL is invalid
- * or no parameter is provided for the given key
- */
- URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException;
-}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 5e60ed3e..d4b2018d 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -16,8 +16,10 @@
*/
package at.gv.egiz.bku.online.applet;
+import at.gv.egiz.bku.gui.BKUGUIFacade.Style;
import at.gv.egiz.bku.gui.DefaultHelpListener;
import at.gv.egiz.bku.gui.AbstractHelpListener;
+import at.gv.egiz.stal.service.translator.STALTranslator;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
@@ -30,15 +32,18 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
+import at.gv.egiz.stal.service.STALPortType;
+import at.gv.egiz.stal.service.STALService;
+import java.awt.Container;
+import javax.xml.namespace.QName;
/**
* Note: all swing code is executed by the event dispatch thread (see
* BKUGUIFacade)
*/
-public class BKUApplet extends JApplet implements AppletParameterProvider {
+public class BKUApplet extends JApplet {
private static Log log = LogFactory.getLog(BKUApplet.class);
-
/**
* Applet parameter keys
*/
@@ -55,18 +60,15 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
// public static final String HASHDATA_DISPLAY_INTERNAL = "internal";
// public static final String HASHDATA_DISPLAY_BROWSER = "browser";
public static final String HASHDATA_DISPLAY_FRAME = "frame";
-
/**
* STAL WSDL namespace and service name
*/
public static final String STAL_WSDL_NS = "http://www.egiz.gv.at/wsdl/stal";
public static final String STAL_SERVICE = "STALService";
-
/**
* Dummy session id, used if no sessionId parameter is provided
*/
protected static final String TEST_SESSION_ID = "TestSession";
-
/**
* STAL
*/
@@ -81,17 +83,17 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
public void init() {
log.info("Welcome to MOCCA");
log.debug("Called init()");
-
+
HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance());
- String locale = getAppletParameter(LOCALE);
+ String locale = getParameter(LOCALE);
if (locale != null) {
this.setLocale(new Locale(locale));
}
- log.debug("setting locale to " + getLocale());
+ log.debug("setting locale: " + getLocale());
BKUGUIFacade.Style guiStyle;
- String guiStyleParam = getAppletParameter(GUI_STYLE);
+ String guiStyleParam = getParameter(GUI_STYLE);
if ("advanced".equals(guiStyleParam)) {
guiStyle = BKUGUIFacade.Style.advanced;
} else if ("tiny".equals(guiStyleParam)) {
@@ -99,30 +101,33 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
} else {
guiStyle = BKUGUIFacade.Style.simple;
}
-
+ log.debug("setting gui-style: " + guiStyle);
+
URL backgroundImgURL = null;
try {
- backgroundImgURL = getURLParameter(BACKGROUND_IMG);
+ backgroundImgURL = getURLParameter(BACKGROUND_IMG, null);
+ log.debug("setting background: " + backgroundImgURL);
} catch (MalformedURLException ex) {
log.warn("failed to load applet background image: " + ex.getMessage() + ", using default");
}
-
+
AbstractHelpListener helpListener = null;
try {
- URL helpURL = getURLParameter(HELP_URL);
-// helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale());
- helpListener = new DefaultHelpListener(getAppletContext(), helpURL, getLocale());
+ helpListener = new DefaultHelpListener(getAppletContext(),
+ getURLParameter(HELP_URL, null), getLocale());
+ if (log.isDebugEnabled()) {
+ log.debug("setting helpURL: " + getURLParameter(HELP_URL, null));
+ }
} catch (MalformedURLException ex) {
log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help");
}
-
- BKUGUIFacade gui = BKUGUIFactory.createGUI(getContentPane(),
- getLocale(),
- guiStyle,
- backgroundImgURL,
+
+ BKUGUIFacade gui = createGUI(getContentPane(), getLocale(),
+ guiStyle,
+ backgroundImgURL,
helpListener);
- worker = new AppletBKUWorker(gui, getAppletContext(), this);
+ worker = new AppletBKUWorker(this, gui);
}
@Override
@@ -145,15 +150,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
log.debug("Called destroy()");
}
- @Override
- public String getAppletParameter(String paramKey) {
- String param = getParameter(paramKey);
- log.info("applet parameter: " + paramKey + ": " + param);
- return param;
- }
-
- @Override
- public URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException {
+ protected URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException {
String urlParam = getParameter(paramKey);
if (urlParam != null) {
URL codebase = getCodeBase();
@@ -173,15 +170,54 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
} catch (MalformedURLException ex) {
log.error("applet paremeter " + urlParam + " is not a valid URL: " + ex.getMessage());
throw ex;
- }
+ }
} else {
log.error("applet paremeter " + urlParam + " not set");
throw new MalformedURLException(urlParam + " not set");
}
}
-
- @Override
- public URL getURLParameter(String paramKey) throws MalformedURLException {
- return getURLParameter(paramKey, null);
+
+ /**
+ * provides a means to for subclasses to inject a different GUI
+ */
+ protected BKUGUIFacade createGUI(Container contentPane,
+ Locale locale,
+ Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ return BKUGUIFactory.createGUI(contentPane,
+ locale,
+ guiStyle,
+ backgroundImgURL,
+ helpListener);
+ }
+
+ protected STALPortType getSTALPort() throws MalformedURLException {
+ URL wsdlURL = getURLParameter(WSDL_URL, null);
+ log.debug("setting STAL WSDL: " + wsdlURL);
+ QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE);
+ STALService stal = new STALService(wsdlURL, endpointName);
+ return stal.getSTALPort();
+ }
+
+ protected STALTranslator getSTALTranslator() {
+ return new STALTranslator();
+ }
+
+ protected void sendRedirect(String sessionId) {
+ try {
+ URL redirectURL = getURLParameter(REDIRECT_URL, sessionId);
+ String redirectTarget = getParameter(REDIRECT_TARGET);
+ if (redirectTarget == null) {
+ log.info("Done. Redirecting to " + redirectURL + " ...");
+ getAppletContext().showDocument(redirectURL);
+ } else {
+ log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ...");
+ getAppletContext().showDocument(redirectURL, redirectTarget);
+ }
+ } catch (MalformedURLException ex) {
+ log.warn("Failed to redirect: " + ex.getMessage(), ex);
+ // gui.showErrorDialog(errorMsg, okListener, actionCommand)
+ }
}
}
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index c8bd99d3..4a768f91 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -18,7 +18,7 @@
<body>
<center>
<applet code="at.gv.egiz.bku.online.applet.BKUApplet.class"
- archive="../BKUApplet-1.0.4-SNAPSHOT.jar, ../test-libs/commons-logging-1.1.1.jar , ../test-libs/iaik_jce_me4se-3.04.jar"
+ archive="../BKUApplet-1.0.5-SNAPSHOT.jar, commons-logging.jar , iaik_jce_me4se.jar"
width=152 height=145>
<param name="GuiStyle" value="tiny"/>
<param name="Locale" value="ja_JA"/>
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml
index 0f5757b8..5fd142a2 100644
--- a/BKULocal/pom.xml
+++ b/BKULocal/pom.xml
@@ -9,7 +9,7 @@
<artifactId>BKULocal</artifactId>
<packaging>war</packaging>
<name>BKU Local</name>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<scm>
<developerConnection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal</developerConnection>
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
index 91d0aba0..61cc7c4c 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
@@ -22,7 +22,6 @@ import at.gv.egiz.stal.QuitRequest;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
-import at.gv.egiz.stal.ext.APDUScriptRequest;
import java.util.List;
import javax.swing.JDialog;
diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml
index 52bc4e36..79a270d8 100644
--- a/BKULocalApp/pom.xml
+++ b/BKULocalApp/pom.xml
@@ -5,10 +5,10 @@
<version>1.0.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>at.gv.egiz.bku</groupId>
+ <groupId>at.gv.egiz</groupId>
<artifactId>BKULocalApp</artifactId>
<name>BKU Local App</name>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<description />
<build>
<pluginManagement>
@@ -76,7 +76,7 @@
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>BKULocal</artifactId>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml
index c82cfc1e..fc5f04fa 100644
--- a/BKUOnline/pom.xml
+++ b/BKUOnline/pom.xml
@@ -1,4 +1,4 @@
-
+<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>bku</artifactId>
@@ -56,25 +56,20 @@
<version>1.0.5-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
- <!-- build BKUApplet prior to BKUOnline -->
- <dependency>
- <groupId>at.gv.egiz</groupId>
- <artifactId>BKUApplet</artifactId>
- <version>1.0.5-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
+ <dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>STALService</artifactId>
<version>1.0.5-SNAPSHOT</version>
</dependency>
- <!-- TODO move at.buergerkarte.namespaces.cardchannel.service out from STALXService
+ <!--
+ | TODO move at.buergerkarte.namespaces.cardchannel.service out from STALXService
| so that BKUOnline does not have to depend on STALXService
+ |-->
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>STALXService</artifactId>
<version>1.0.2-SNAPSHOT</version>
- </dependency-->
+ </dependency>
<!--
| see https://wsit.dev.java.net/issues/show_bug.cgi?id=970
-->
@@ -102,10 +97,30 @@
<groupId>com.sun.xml.stream</groupId>
<version>1.0.1</version>
</dependency>
+ <!--
+ | Applet-only dependencies (put in provided scope)
+ | list to make them known to maven-dependency plugin
+ | and make sure BKUApplet(Ext) is built prior to BKUOnline
+ |-->
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUApplet</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUAppletExt</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_jce_me4se</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
- <properties>
- <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
- </properties>
<scm>
<developerConnection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline</developerConnection>
<connection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline</connection>
@@ -117,75 +132,31 @@
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>copyapplet-dependencies</id>
+ <id>copy_applet</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}/applet</outputDirectory>
- <!--<artifactItems>
- <artifactItem>
- <groupId>at.gv.egiz</groupId>
- <artifactId>BKUApplet</artifactId>
- <version>1.0</version>
- </artifactItem>
- <artifactItem>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>iaik</groupId>
- <artifactId>iaik_jce_me4se</artifactId>
- </artifactItem>
- </artifactItems>-->
- <includeGroupIds>at.gv.egiz</includeGroupIds>
- <includeArtifactIds>BKUApplet</includeArtifactIds>
- <stripVersion>true</stripVersion>
+ <includeGroupIds>at.gv.egiz,commons-logging,iaik</includeGroupIds>
+ <includeArtifactIds>BKUApplet,BKUAppletExt,commons-logging,iaik_jce_me4se</includeArtifactIds>
<excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- <execution>
- <id>copyapplet</id>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/${project.build.finalName}/applet</outputDirectory>
- <artifactItems>
- <artifactItem>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>iaik</groupId>
- <artifactId>iaik_jce_me4se</artifactId>
- </artifactItem>
- </artifactItems>
+ <stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
- <!--plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin-->
+
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<manifest>
- <addDefaultImplementationEntries>
- true
- </addDefaultImplementationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<archive>
<manifestEntries>
- <Implementation-Build>
- ${project.version}-r${buildNumber}
- </Implementation-Build>
+ <Implementation-Build>${project.version}-r${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
@@ -211,7 +182,7 @@
</build>
<profiles>
<profile>
- <id>jaxb-generate</id>
+ <id>jaxb-generate-stal</id>
<build>
<plugins>
<plugin>
@@ -245,4 +216,7 @@
</build>
</profile>
</profiles>
-</project> \ No newline at end of file
+ <properties>
+ <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
+ </properties>
+</project>
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
index d9be0981..c758bcee 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
@@ -133,6 +133,9 @@ public class BKURequestHandler extends SpringBKUServlet {
.getFormData("appletHashDataDisplay"), charset);
String localeFormParam = getStringFromStream(bindingProcessor
.getFormData("locale"), charset);
+ String extension = getStringFromStream(bindingProcessor
+ .getFormData("appletExtension"), charset);
+
if (width != null) {
try {
log.trace("Found applet width parameter: " + width);
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
index a617c61f..81b70b7c 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
@@ -19,19 +19,17 @@ package at.gv.egiz.stal.service.impl;
import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.InfoboxReadRequest;
import at.gv.egiz.stal.QuitRequest;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.service.translator.STALTranslator;
import at.gv.egiz.stal.service.translator.TranslationException;
-import at.gv.egiz.stal.service.types.InfoboxReadRequestType;
import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
-import at.gv.egiz.stal.service.types.SignRequestType;
+import at.gv.egiz.stalx.service.translator.STALXTranslationHandler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -71,10 +69,12 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
if (timeoutMillisec <= 0)
timeoutMillisec = DEFAULT_TIMEOUT_MS;
timeout = timeoutMillisec;
-// translator.registerTranslationHandler(handler);
requests = new ArrayList<JAXBElement<? extends RequestType>>();
responses = new ArrayList<JAXBElement<? extends ResponseType>>();
hashDataInputs = new ArrayList<HashDataInput>();
+
+ // register handler for STAL-X
+ translator.registerTranslationHandler(new STALXTranslationHandler());
}
/**
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
index afeba9cb..a30c6bb2 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
@@ -18,6 +18,8 @@ package at.gv.egiz.stal.service.impl;
//import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType;
//import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
+import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType;
+import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
import at.gv.egiz.bku.binding.BindingProcessor;
import at.gv.egiz.bku.binding.BindingProcessorManager;
import at.gv.egiz.bku.binding.Id;
@@ -78,8 +80,10 @@ public class STALServiceImpl implements STALPortType {
@Resource
protected WebServiceContext wsContext;
protected IdFactory idF = IdFactory.getInstance();
+ /** JAXB ObjectFactories */
private at.gv.egiz.stal.service.types.ObjectFactory stalObjFactory = new at.gv.egiz.stal.service.types.ObjectFactory();
-// private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory();
+ /** don't confuse with at.buergerkarte.namespaces.cardchannel */
+ private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory();
@Override
public GetNextRequestResponseType connect(String sessId) {
@@ -331,12 +335,12 @@ public class STALServiceImpl implements STALPortType {
if (responsesIn == null) {
log.info("[TestSession] received CONNECT, return dummy requests ");
-// ScriptType scriptT = ccObjFactory.createScriptType();
-// CommandAPDUType cmd = ccObjFactory.createCommandAPDUType();
-// cmd.setValue("TestSession CardChannelCMD 1234".getBytes());
-// scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd);
-// reqs.add(ccObjFactory.createScript(scriptT));
- addDummyRequests(reqs);
+// addDummyRequests(reqs);
+ ScriptType scriptT = ccObjFactory.createScriptType();
+ CommandAPDUType cmd = ccObjFactory.createCommandAPDUType();
+ cmd.setValue("TestSession CardChannelCMD 1234".getBytes());
+ scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd);
+ reqs.add(ccObjFactory.createScript(scriptT));
} else if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0).getValue() instanceof ErrorResponseType) {
log.info("[TestSession] received ErrorResponse, return QUIT request");
QuitRequestType quitT = stalObjFactory.createQuitRequestType();
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java
index 92559254..9caf950f 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java
@@ -47,11 +47,11 @@ public class STALXJAXBContextFactory implements JAXBContextFactory {
}
List<Class> classes = new ArrayList<Class>();
classes.addAll(classesToBind);
-// Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class;
-// if (!classes.contains(ccOF)) {
-// log.debug("adding " + ccOF + " to JAXBContext seed");
-// classes.add(ccOF);
-// }
+ Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class;
+ if (!classes.contains(ccOF)) {
+ log.debug("adding " + ccOF + " to JAXBContext seed");
+ classes.add(ccOF);
+ }
//TODO add typeReference?
diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp
index 3bf0ff40..ada48f22 100644
--- a/BKUOnline/src/main/webapp/applet.jsp
+++ b/BKUOnline/src/main/webapp/applet.jsp
@@ -39,6 +39,16 @@
String backgroundImg = (String) session.getAttribute("appletBackground");
String guiStyle = (String) session.getAttribute("appletGuiStyle");
String locale = (String) session.getAttribute("locale");
+
+ String appletClass, appletArchive;
+ //if (Boolean.parseBoolean((String) session.getAttribute("appletExtension"))) {
+ if ("activation".equals(guiStyle)) {
+ appletArchive = "BKUAppletExt.jar";
+ appletClass = "at.gv.egiz.bku.online.applet.ext.BKUAppletExt.class";
+ } else {
+ appletArchive = "BKUApplet.jar";
+ appletClass = "at.gv.egiz.bku.online.applet.BKUApplet.class";
+ }
%>
<body id="appletpage" style="width:<%=width%>">
<script>
@@ -48,8 +58,8 @@
} else {
var attributes = {
codebase :'applet',
- code :'at.gv.egiz.bku.online.applet.BKUApplet.class',
- archive :'BKUApplet.jar, commons-logging-1.1.1.jar, iaik_jce_me4se-3.04.jar',
+ code : '<%=appletClass%>',
+ archive : '<%=appletArchive + ", commons-logging.jar, iaik_jce_me4se.jar"%>',
width : <%=width%>,
height :<%=height%>
};
diff --git a/BKUOnline/src/main/webapp/slRequestForm.html b/BKUOnline/src/main/webapp/slRequestForm.html
index 10330c8c..ff96a6fa 100644
--- a/BKUOnline/src/main/webapp/slRequestForm.html
+++ b/BKUOnline/src/main/webapp/slRequestForm.html
@@ -95,9 +95,10 @@ legend {
name="appletBackground" value="" id="appletBackground">
<p>
<label for="appletGuiStyle">GUI Style</label>
- <input type="radio" name="appletGuiStyle" value="tiny" checked="checked">tiny
+ <input type="radio" name="appletGuiStyle" value="tiny">tiny
<input type="radio" name="appletGuiStyle" value="simple" checked="checked">simple
<input type="radio" name="appletGuiStyle" value="advanced">advanced
+ <input type="radio" name="appletGuiStyle" value="activation">activation
</p>
<!--
diff --git a/STALExt/pom.xml b/STALExt/pom.xml
index 90e051cf..3f71e805 100644
--- a/STALExt/pom.xml
+++ b/STALExt/pom.xml
@@ -8,7 +8,7 @@
<groupId>at.gv.egiz</groupId>
<artifactId>STALExt</artifactId>
<name>STAL Extension</name>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<description />
<dependencies>
<dependency>
diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java b/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java
index 436ee7f1..d38010aa 100644
--- a/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java
+++ b/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java
@@ -23,7 +23,7 @@ import at.gv.egiz.stal.service.types.GetNextRequestType;
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
at.gv.egiz.stal.service.types.ObjectFactory.class
-// at.buergerkarte.namespaces.cardchannel.ObjectFactory.class
+// at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class
})
public interface STALPortType {
diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java
index c4a3d62e..a52de482 100644
--- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java
+++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java
@@ -156,10 +156,10 @@ public class STALTranslator {
JAXBElement<? extends RequestType> translate(STALRequest request) throws TranslationException;
- STALRequest translate(RequestType request) throws TranslationException;
-
JAXBElement<? extends ResponseType> translate(STALResponse response) throws TranslationException;
+ STALRequest translate(RequestType request) throws TranslationException;
+
STALResponse translate(ResponseType response) throws TranslationException;
}
@@ -178,7 +178,6 @@ public class STALTranslator {
@Override
public List<Class> getSupportedTypes() {
-// log.warn(" *** Fake STALTranslator ***");
return Arrays.asList(new Class[]{InfoboxReadRequest.class,
SignRequest.class,
QuitRequest.class,
diff --git a/STALXService/pom.xml b/STALXService/pom.xml
new file mode 100644
index 00000000..2737c68d
--- /dev/null
+++ b/STALXService/pom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>bku</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0.4-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STALXService</artifactId>
+ <name>STAL-X Service</name>
+ <version>1.0.2-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <artifactId>STALService</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <artifactId>STALExt</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ATRType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ATRType.java
new file mode 100644
index 00000000..b1b83976
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ATRType.java
@@ -0,0 +1,100 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * Contains the ATR received as reponse to a Reset
+ * command
+ *
+ * <p>Java class for ATRType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ATRType">
+ * &lt;simpleContent>
+ * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>hexBinary">
+ * &lt;attribute name="rc" type="{http://www.w3.org/2001/XMLSchema}integer" default="0" />
+ * &lt;/extension>
+ * &lt;/simpleContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ATRType", propOrder = {
+ "value"
+})
+public class ATRType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] value;
+ @XmlAttribute
+ protected BigInteger rc;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(byte[] value) {
+ this.value = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the rc property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getRc() {
+ if (rc == null) {
+ return new BigInteger("0");
+ } else {
+ return rc;
+ }
+ }
+
+ /**
+ * Sets the value of the rc property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setRc(BigInteger value) {
+ this.rc = value;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeList.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeList.java
new file mode 100644
index 00000000..2b00509f
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeList.java
@@ -0,0 +1,71 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Contains a list of attributes
+ *
+ * <p>Java class for AttributeList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="AttributeList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="Attribute" type="{http://www.buergerkarte.at/cardchannel}AttributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AttributeList", propOrder = {
+ "attribute"
+})
+public class AttributeList {
+
+ @XmlElement(name = "Attribute")
+ protected List<AttributeType> attribute;
+
+ /**
+ * Gets the value of the attribute property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the attribute property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getAttribute().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link AttributeType }
+ *
+ *
+ */
+ public List<AttributeType> getAttribute() {
+ if (attribute == null) {
+ attribute = new ArrayList<AttributeType>();
+ }
+ return this.attribute;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeType.java
new file mode 100644
index 00000000..d258545a
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/AttributeType.java
@@ -0,0 +1,264 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+
+/**
+ * Contains an attribute converted from ASN.1
+ *
+ * <p>Java class for AttributeType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="AttributeType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="Integer" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
+ * &lt;element name="Latin1String" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="UTF8String" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="NumericString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PrintableString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="GeneralizedTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
+ * &lt;element name="Date" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;attribute name="oid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AttributeType", propOrder = {
+ "integer",
+ "latin1String",
+ "utf8String",
+ "numericString",
+ "printableString",
+ "generalizedTime",
+ "date"
+})
+public class AttributeType {
+
+ @XmlElement(name = "Integer")
+ protected BigInteger integer;
+ @XmlElement(name = "Latin1String")
+ protected String latin1String;
+ @XmlElement(name = "UTF8String")
+ protected String utf8String;
+ @XmlElement(name = "NumericString")
+ protected String numericString;
+ @XmlElement(name = "PrintableString")
+ protected String printableString;
+ @XmlElement(name = "GeneralizedTime")
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar generalizedTime;
+ @XmlElement(name = "Date")
+ protected String date;
+ @XmlAttribute(required = true)
+ protected String oid;
+
+ /**
+ * Gets the value of the integer property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getInteger() {
+ return integer;
+ }
+
+ /**
+ * Sets the value of the integer property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setInteger(BigInteger value) {
+ this.integer = value;
+ }
+
+ /**
+ * Gets the value of the latin1String property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLatin1String() {
+ return latin1String;
+ }
+
+ /**
+ * Sets the value of the latin1String property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLatin1String(String value) {
+ this.latin1String = value;
+ }
+
+ /**
+ * Gets the value of the utf8String property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getUTF8String() {
+ return utf8String;
+ }
+
+ /**
+ * Sets the value of the utf8String property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setUTF8String(String value) {
+ this.utf8String = value;
+ }
+
+ /**
+ * Gets the value of the numericString property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNumericString() {
+ return numericString;
+ }
+
+ /**
+ * Sets the value of the numericString property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNumericString(String value) {
+ this.numericString = value;
+ }
+
+ /**
+ * Gets the value of the printableString property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPrintableString() {
+ return printableString;
+ }
+
+ /**
+ * Sets the value of the printableString property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPrintableString(String value) {
+ this.printableString = value;
+ }
+
+ /**
+ * Gets the value of the generalizedTime property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getGeneralizedTime() {
+ return generalizedTime;
+ }
+
+ /**
+ * Sets the value of the generalizedTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setGeneralizedTime(XMLGregorianCalendar value) {
+ this.generalizedTime = value;
+ }
+
+ /**
+ * Gets the value of the date property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDate() {
+ return date;
+ }
+
+ /**
+ * Sets the value of the date property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDate(String value) {
+ this.date = value;
+ }
+
+ /**
+ * Gets the value of the oid property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOid() {
+ return oid;
+ }
+
+ /**
+ * Sets the value of the oid property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOid(String value) {
+ this.oid = value;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/CommandAPDUType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/CommandAPDUType.java
new file mode 100644
index 00000000..98337761
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/CommandAPDUType.java
@@ -0,0 +1,154 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * Contains a sequence of bytes send as command APDU to the
+ * icc
+ *
+ * <p>Java class for CommandAPDUType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="CommandAPDUType">
+ * &lt;simpleContent>
+ * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>hexBinary">
+ * &lt;attribute name="sequence" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * &lt;attribute name="of" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * &lt;attribute name="expectedSW" type="{http://www.w3.org/2001/XMLSchema}hexBinary" />
+ * &lt;/extension>
+ * &lt;/simpleContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "CommandAPDUType", propOrder = {
+ "value"
+})
+public class CommandAPDUType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] value;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger sequence;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger of;
+ @XmlAttribute
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] expectedSW;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(byte[] value) {
+ this.value = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the sequence property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getSequence() {
+ return sequence;
+ }
+
+ /**
+ * Sets the value of the sequence property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setSequence(BigInteger value) {
+ this.sequence = value;
+ }
+
+ /**
+ * Gets the value of the of property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getOf() {
+ return of;
+ }
+
+ /**
+ * Sets the value of the of property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setOf(BigInteger value) {
+ this.of = value;
+ }
+
+ /**
+ * Gets the value of the expectedSW property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getExpectedSW() {
+ return expectedSW;
+ }
+
+ /**
+ * Sets the value of the expectedSW property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExpectedSW(byte[] value) {
+ this.expectedSW = ((byte[]) value);
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ObjectFactory.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ObjectFactory.java
new file mode 100644
index 00000000..dc8ba4da
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ObjectFactory.java
@@ -0,0 +1,172 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the at.buergerkarte.namespaces.cardchannel.service package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _EHIC_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "EHIC");
+ private final static QName _Status_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "Status");
+ private final static QName _SVPersonenbindung_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "SV-Personenbindung");
+ private final static QName _Grunddaten_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "Grunddaten");
+
+ /** TODO */
+ private final static QName _Response_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "Response");
+ private final static QName _Script_QNAME = new QName("http://www.buergerkarte.at/cardchannel", "Script");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.buergerkarte.namespaces.cardchannel.service
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ResponseAPDUType }
+ *
+ */
+ public ResponseAPDUType createResponseAPDUType() {
+ return new ResponseAPDUType();
+ }
+
+ /**
+ * Create an instance of {@link AttributeType }
+ *
+ */
+ public AttributeType createAttributeType() {
+ return new AttributeType();
+ }
+
+ /**
+ * Create an instance of {@link VerifyAPDUType }
+ *
+ */
+ public VerifyAPDUType createVerifyAPDUType() {
+ return new VerifyAPDUType();
+ }
+
+ /**
+ * Create an instance of {@link ATRType }
+ *
+ */
+ public ATRType createATRType() {
+ return new ATRType();
+ }
+
+ /**
+ * Create an instance of {@link ResponseType }
+ *
+ */
+ public ResponseType createResponseType() {
+ return new ResponseType();
+ }
+
+ /**
+ * Create an instance of {@link CommandAPDUType }
+ *
+ */
+ public CommandAPDUType createCommandAPDUType() {
+ return new CommandAPDUType();
+ }
+
+ /**
+ * Create an instance of {@link ResetType }
+ *
+ */
+ public ResetType createResetType() {
+ return new ResetType();
+ }
+
+ /**
+ * Create an instance of {@link ScriptType }
+ *
+ */
+ public ScriptType createScriptType() {
+ return new ScriptType();
+ }
+
+ /**
+ * Create an instance of {@link AttributeList }
+ *
+ */
+ public AttributeList createAttributeList() {
+ return new AttributeList();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link AttributeList }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "EHIC")
+ public JAXBElement<AttributeList> createEHIC(AttributeList value) {
+ return new JAXBElement<AttributeList>(_EHIC_QNAME, AttributeList.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link AttributeList }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "Status")
+ public JAXBElement<AttributeList> createStatus(AttributeList value) {
+ return new JAXBElement<AttributeList>(_Status_QNAME, AttributeList.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ResponseType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "Response", substitutionHeadNamespace = "http://www.egiz.gv.at/stal", substitutionHeadName = "OtherResponse")
+ public JAXBElement<ResponseType> createResponse(ResponseType value) {
+ return new JAXBElement<ResponseType>(_Response_QNAME, ResponseType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "SV-Personenbindung")
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ public JAXBElement<byte[]> createSVPersonenbindung(byte[] value) {
+ return new JAXBElement<byte[]>(_SVPersonenbindung_QNAME, byte[].class, null, ((byte[]) value));
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ScriptType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "Script", substitutionHeadNamespace = "http://www.egiz.gv.at/stal", substitutionHeadName = "OtherRequest")
+ public JAXBElement<ScriptType> createScript(ScriptType value) {
+ return new JAXBElement<ScriptType>(_Script_QNAME, ScriptType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link AttributeList }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.buergerkarte.at/cardchannel", name = "Grunddaten")
+ public JAXBElement<AttributeList> createGrunddaten(AttributeList value) {
+ return new JAXBElement<AttributeList>(_Grunddaten_QNAME, AttributeList.class, null, value);
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResetType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResetType.java
new file mode 100644
index 00000000..e6e1eb95
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResetType.java
@@ -0,0 +1,64 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Reset the icc and sequence counter
+ *
+ * <p>Java class for ResetType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ResetType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;attribute name="cold" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ResetType")
+public class ResetType {
+
+ @XmlAttribute
+ protected Boolean cold;
+
+ /**
+ * Gets the value of the cold property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public boolean isCold() {
+ if (cold == null) {
+ return true;
+ } else {
+ return cold;
+ }
+ }
+
+ /**
+ * Sets the value of the cold property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setCold(Boolean value) {
+ this.cold = value;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseAPDUType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseAPDUType.java
new file mode 100644
index 00000000..1dba7996
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseAPDUType.java
@@ -0,0 +1,161 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * Contains a sequence of bytes received from the card as response
+ * APDU
+ *
+ * <p>Java class for ResponseAPDUType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ResponseAPDUType">
+ * &lt;simpleContent>
+ * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>hexBinary">
+ * &lt;attribute name="sequence" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * &lt;attribute name="rc" type="{http://www.w3.org/2001/XMLSchema}integer" default="0" />
+ * &lt;attribute name="SW" type="{http://www.w3.org/2001/XMLSchema}hexBinary" default="9000" />
+ * &lt;/extension>
+ * &lt;/simpleContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ResponseAPDUType", propOrder = {
+ "value"
+})
+public class ResponseAPDUType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] value;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger sequence;
+ @XmlAttribute
+ protected BigInteger rc;
+ @XmlAttribute(name = "SW")
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] sw;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(byte[] value) {
+ this.value = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the sequence property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getSequence() {
+ return sequence;
+ }
+
+ /**
+ * Sets the value of the sequence property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setSequence(BigInteger value) {
+ this.sequence = value;
+ }
+
+ /**
+ * Gets the value of the rc property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getRc() {
+ if (rc == null) {
+ return new BigInteger("0");
+ } else {
+ return rc;
+ }
+ }
+
+ /**
+ * Sets the value of the rc property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setRc(BigInteger value) {
+ this.rc = value;
+ }
+
+ /**
+ * Gets the value of the sw property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getSW() {
+ if (sw == null) {
+ return new HexBinaryAdapter().unmarshal("9000");
+ } else {
+ return sw;
+ }
+ }
+
+ /**
+ * Sets the value of the sw property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSW(byte[] value) {
+ this.sw = ((byte[]) value);
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseType.java
new file mode 100644
index 00000000..86750d5d
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ResponseType.java
@@ -0,0 +1,82 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * extends abstract stal:ResponseType
+ *
+ * Contains the result of the script executed by the
+ * BKU
+ *
+ * <p>Java class for ResponseType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ResponseType">
+ * &lt;complexContent>
+ * &lt;extension base="{http://www.egiz.gv.at/stal}ResponseType">
+ * &lt;choice maxOccurs="unbounded">
+ * &lt;element name="ATR" type="{http://www.buergerkarte.at/cardchannel}ATRType"/>
+ * &lt;element name="ResponseAPDU" type="{http://www.buergerkarte.at/cardchannel}ResponseAPDUType"/>
+ * &lt;/choice>
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ResponseType", propOrder = {
+ "atrOrResponseAPDU"
+})
+public class ResponseType
+ extends at.gv.egiz.stal.service.types.ResponseType
+{
+
+ @XmlElements({
+ @XmlElement(name = "ATR", type = ATRType.class),
+ @XmlElement(name = "ResponseAPDU", type = ResponseAPDUType.class)
+ })
+ protected List<Object> atrOrResponseAPDU;
+
+ /**
+ * Gets the value of the atrOrResponseAPDU property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the atrOrResponseAPDU property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getATROrResponseAPDU().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ATRType }
+ * {@link ResponseAPDUType }
+ *
+ *
+ */
+ public List<Object> getATROrResponseAPDU() {
+ if (atrOrResponseAPDU == null) {
+ atrOrResponseAPDU = new ArrayList<Object>();
+ }
+ return this.atrOrResponseAPDU;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ScriptType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ScriptType.java
new file mode 100644
index 00000000..18ac8f6c
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/ScriptType.java
@@ -0,0 +1,85 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+import at.gv.egiz.stal.service.types.RequestType;
+
+
+/**
+ * extends abstract stal:RequestType
+ *
+ * Contains the script to be executed by the BKU
+ *
+ * <p>Java class for ScriptType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ScriptType">
+ * &lt;complexContent>
+ * &lt;extension base="{http://www.egiz.gv.at/stal}RequestType">
+ * &lt;choice maxOccurs="unbounded">
+ * &lt;element name="Reset" type="{http://www.buergerkarte.at/cardchannel}ResetType"/>
+ * &lt;element name="CommandAPDU" type="{http://www.buergerkarte.at/cardchannel}CommandAPDUType"/>
+ * &lt;element name="VerifyAPDU" type="{http://www.buergerkarte.at/cardchannel}VerifyAPDUType"/>
+ * &lt;/choice>
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ScriptType", propOrder = {
+ "resetOrCommandAPDUOrVerifyAPDU"
+})
+public class ScriptType
+ extends RequestType
+{
+
+ @XmlElements({
+ @XmlElement(name = "VerifyAPDU", type = VerifyAPDUType.class),
+ @XmlElement(name = "Reset", type = ResetType.class),
+ @XmlElement(name = "CommandAPDU", type = CommandAPDUType.class)
+ })
+ protected List<Object> resetOrCommandAPDUOrVerifyAPDU;
+
+ /**
+ * Gets the value of the resetOrCommandAPDUOrVerifyAPDU property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the resetOrCommandAPDUOrVerifyAPDU property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getResetOrCommandAPDUOrVerifyAPDU().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VerifyAPDUType }
+ * {@link ResetType }
+ * {@link CommandAPDUType }
+ *
+ *
+ */
+ public List<Object> getResetOrCommandAPDUOrVerifyAPDU() {
+ if (resetOrCommandAPDUOrVerifyAPDU == null) {
+ resetOrCommandAPDUOrVerifyAPDU = new ArrayList<Object>();
+ }
+ return this.resetOrCommandAPDUOrVerifyAPDU;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/VerifyAPDUType.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/VerifyAPDUType.java
new file mode 100644
index 00000000..8f688336
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/VerifyAPDUType.java
@@ -0,0 +1,266 @@
+
+package at.buergerkarte.namespaces.cardchannel.service;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * Contains a sequence of bytes send as command APDU to the icc after a
+ * PIN entered by the user has been incorporated into the APDU
+ *
+ * <p>Java class for VerifyAPDUType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="VerifyAPDUType">
+ * &lt;simpleContent>
+ * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>hexBinary">
+ * &lt;attribute name="sequence" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * &lt;attribute name="of" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * &lt;attribute name="expectedSW" type="{http://www.w3.org/2001/XMLSchema}hexBinary" />
+ * &lt;attribute name="message" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;attribute name="format" use="required" type="{http://www.w3.org/2001/XMLSchema}hexBinary" />
+ * &lt;attribute name="offset" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
+ * &lt;attribute name="timeout" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
+ * &lt;/extension>
+ * &lt;/simpleContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "VerifyAPDUType", propOrder = {
+ "value"
+})
+public class VerifyAPDUType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] value;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger sequence;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger of;
+ @XmlAttribute
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] expectedSW;
+ @XmlAttribute(required = true)
+ protected String message;
+ @XmlAttribute(required = true)
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @XmlSchemaType(name = "hexBinary")
+ protected byte[] format;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "nonNegativeInteger")
+ protected BigInteger offset;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "nonNegativeInteger")
+ protected BigInteger timeout;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(byte[] value) {
+ this.value = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the sequence property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getSequence() {
+ return sequence;
+ }
+
+ /**
+ * Sets the value of the sequence property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setSequence(BigInteger value) {
+ this.sequence = value;
+ }
+
+ /**
+ * Gets the value of the of property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getOf() {
+ return of;
+ }
+
+ /**
+ * Sets the value of the of property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setOf(BigInteger value) {
+ this.of = value;
+ }
+
+ /**
+ * Gets the value of the expectedSW property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getExpectedSW() {
+ return expectedSW;
+ }
+
+ /**
+ * Sets the value of the expectedSW property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExpectedSW(byte[] value) {
+ this.expectedSW = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+ /**
+ * Gets the value of the format property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public byte[] getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets the value of the format property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFormat(byte[] value) {
+ this.format = ((byte[]) value);
+ }
+
+ /**
+ * Gets the value of the offset property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getOffset() {
+ return offset;
+ }
+
+ /**
+ * Sets the value of the offset property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setOffset(BigInteger value) {
+ this.offset = value;
+ }
+
+ /**
+ * Gets the value of the timeout property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the value of the timeout property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setTimeout(BigInteger value) {
+ this.timeout = value;
+ }
+
+}
diff --git a/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/package-info.java b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/package-info.java
new file mode 100644
index 00000000..05d7df46
--- /dev/null
+++ b/STALXService/src/main/java/at/buergerkarte/namespaces/cardchannel/service/package-info.java
@@ -0,0 +1,2 @@
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.buergerkarte.at/cardchannel", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package at.buergerkarte.namespaces.cardchannel.service;
diff --git a/STALXService/src/main/java/at/gv/egiz/stalx/service/STALPortType.java b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALPortType.java
new file mode 100644
index 00000000..b31e60ce
--- /dev/null
+++ b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALPortType.java
@@ -0,0 +1,45 @@
+package at.gv.egiz.stalx.service;
+
+//import at.buergerkarte.namespaces.cardchannel.service.ObjectFactory;
+//import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+/**
+ * Dummy PortType to add at.buergerkarte.namespaces.cardchannel.service to the
+ * JAXB context seed.
+ *
+ * overriding a webmethod results in ClassCastEx for the WebResult
+ * ClassCastException: at.gv.egiz.stal.service.types.GetNextRequestResponseType
+ * cannot be cast to at.buergerkarte.namespaces.cardchannel.service.GetNextRequestResponseType
+ *
+ * adding a new method results in Error: Undefined operation name
+ *
+ * adding a constant doesn't seed
+ */
+@WebService(name = "STALPortType", targetNamespace = "http://www.egiz.gv.at/wsdl/stal")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@XmlSeeAlso({
+ at.gv.egiz.stal.service.types.ObjectFactory.class,
+ at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class
+})
+interface STALPortType extends at.gv.egiz.stal.service.STALPortType {
+
+ // doesn't seed
+// public static final ScriptType seed = (new ObjectFactory()).createScriptType();
+ /**
+ * dummy method to put at.buergerkarte.namespaces.cardchannel.service as JAXB context seed
+ * @return
+ */
+// @WebMethod
+// @WebResult(name = "Script", targetNamespace = "http://www.buergerkarte.at/cardchannel", partName = "part1")
+ //java.lang.Error: Undefined operation name seedJAXBContext
+// ScriptType seedJAXBContext();
+
+// @WebMethod
+// @WebResult(name = "GetNextRequestResponse", targetNamespace = "http://www.egiz.gv.at/stal", partName = "part1")
+// @Override
+// public GetNextRequestResponseType connect(
+// @WebParam(name = "SessionId", targetNamespace = "http://www.egiz.gv.at/stal", partName = "part1") String sessionId);
+}
diff --git a/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java
new file mode 100644
index 00000000..eccd2c4f
--- /dev/null
+++ b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java
@@ -0,0 +1,73 @@
+
+package at.gv.egiz.stalx.service;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.3-b02-
+ * Generated source version: 2.1
+ *
+ */
+@WebServiceClient(name = "STALService", targetNamespace = "http://www.egiz.gv.at/wsdl/stal")
+//, wsdlLocation = "file:/home/clemens/workspace/mocca/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal-service.wsdl")
+public class STALService
+ extends Service
+{
+
+// private final static URL STALSERVICE_WSDL_LOCATION;
+ private final static Logger logger = Logger.getLogger(at.gv.egiz.stalx.service.STALService.class.getName());
+
+// static {
+// URL url = null;
+// try {
+// URL baseUrl;
+// baseUrl = at.gv.egiz.stal.service.STALService.class.getResource(".");
+// url = new URL(baseUrl, "file:/home/clemens/workspace/mocca/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal-service.wsdl");
+// } catch (MalformedURLException e) {
+// logger.warning("Failed to create URL for the wsdl Location: 'file:/home/clemens/workspace/mocca/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal-service.wsdl', retrying as a local file");
+// logger.warning(e.getMessage());
+// }
+// STALSERVICE_WSDL_LOCATION = url;
+// }
+
+ public STALService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+// public STALService() {
+// super(STALSERVICE_WSDL_LOCATION, new QName("http://www.egiz.gv.at/wsdl/stal", "STALService"));
+// }
+
+ /**
+ * Do not export package protected STALXPortType interface
+ * (this is a dummy interface to make JAXB include the STAL-X types)
+ * @return
+ * returns STALPortType
+ */
+ @WebEndpoint(name = "STALPort")
+ public at.gv.egiz.stal.service.STALPortType getSTALPort() {
+ return super.getPort(new QName("http://www.egiz.gv.at/wsdl/stal", "STALPort"), STALPortType.class);
+ }
+
+ /**
+ *
+ * @param features
+ * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
+ * @return
+ * returns STALPortType
+ */
+// @WebEndpoint(name = "STALPort")
+// public STALPortType getSTALPort(WebServiceFeature... features) {
+// return super.getPort(new QName("http://www.egiz.gv.at/wsdl/stal", "STALPort"), STALPortType.class, features);
+// }
+
+}
diff --git a/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java b/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java
new file mode 100644
index 00000000..d93da722
--- /dev/null
+++ b/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2008 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.stalx.service.translator;
+
+import at.buergerkarte.namespaces.cardchannel.service.ATRType;
+import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType;
+import at.buergerkarte.namespaces.cardchannel.service.ObjectFactory;
+import at.buergerkarte.namespaces.cardchannel.service.ResetType;
+import at.buergerkarte.namespaces.cardchannel.service.ResponseAPDUType;
+import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
+import at.buergerkarte.namespaces.cardchannel.service.VerifyAPDUType;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.APDUScriptRequest;
+import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement;
+import at.gv.egiz.stal.ext.APDUScriptResponse;
+import at.gv.egiz.stal.service.translator.STALTranslator;
+import at.gv.egiz.stal.service.translator.TranslationException;
+import at.gv.egiz.stal.service.types.RequestType;
+import at.gv.egiz.stal.service.types.ResponseType;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.xml.bind.JAXBElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class STALXTranslationHandler implements STALTranslator.TranslationHandler {
+
+ private static final Log log = LogFactory.getLog(STALXTranslationHandler.class);
+ ObjectFactory of;
+
+ public STALXTranslationHandler() {
+ of = new ObjectFactory();
+ }
+
+ @Override
+ public List<Class> getSupportedTypes() {
+ return Arrays.asList(new Class[]{ScriptType.class,
+ ResponseType.class,
+ APDUScriptRequest.class,
+ APDUScriptResponse.class});
+ }
+
+ @Override
+ public JAXBElement<? extends RequestType> translate(STALRequest request) throws TranslationException {
+ if (request instanceof APDUScriptRequest) {
+ log.trace("translate at.gv.egiz.stal.ext.APDUScriptRequest -> at.buergerkarte.namespaces.cardchannel.service.ScriptType");
+
+ ScriptType scriptT = of.createScriptType();
+
+ List<RequestScriptElement> script = ((APDUScriptRequest) request).getScript();
+ for (RequestScriptElement requestScriptElement : script) {
+ if (requestScriptElement instanceof APDUScriptRequest.Reset) {
+ scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(of.createResetType());
+ } else if (requestScriptElement instanceof APDUScriptRequest.Command) {
+ APDUScriptRequest.Command cmd = (APDUScriptRequest.Command) requestScriptElement;
+ CommandAPDUType commandAPDUType = of.createCommandAPDUType();
+ commandAPDUType.setSequence(BigInteger.valueOf(cmd.getSequence()));
+ commandAPDUType.setValue(cmd.getCommandAPDU());
+ commandAPDUType.setExpectedSW(cmd.getExpectedSW());
+ scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(commandAPDUType);
+ } else {
+ log.error("invalid requestScriptElement " + requestScriptElement.getClass());
+ throw new TranslationException(requestScriptElement.getClass());
+ }
+ }
+
+ return of.createScript(scriptT);
+ } else {
+ log.error("cannot translate " + request.getClass());
+ throw new TranslationException(request.getClass());
+ }
+ }
+
+ @Override
+ public STALRequest translate(RequestType request) throws TranslationException {
+ if (request instanceof ScriptType) {
+
+ log.trace("translate at.buergerkarte.namespaces.cardchannel.service.ScriptType -> at.gv.egiz.stal.ext.APDUScriptRequest");
+
+ List<Object> resetOrCommandAPDUOrVerifyAPDU = ((ScriptType) request).getResetOrCommandAPDUOrVerifyAPDU();
+ List<APDUScriptRequest.RequestScriptElement> requestScript = new ArrayList<APDUScriptRequest.RequestScriptElement>();
+
+ for (Object element : resetOrCommandAPDUOrVerifyAPDU) {
+
+ if (element instanceof ResetType) {
+
+ requestScript.add(new APDUScriptRequest.Reset());
+
+ } else if (element instanceof CommandAPDUType) {
+
+ CommandAPDUType commandAPDU = (CommandAPDUType) element;
+ int sequence = (commandAPDU.getSequence() != null)
+ ? commandAPDU.getSequence().intValue()
+ : 0;
+
+ requestScript.add(
+ new APDUScriptRequest.Command(
+ sequence,
+ commandAPDU.getValue(),
+ commandAPDU.getExpectedSW()));
+
+ } else if (element instanceof VerifyAPDUType) {
+ log.error("CardChannel script command 'VerifyAPDU' not implemented.");
+ throw new TranslationException(VerifyAPDUType.class);
+ } else {
+ log.error("invalid requestScriptElement element " + element.getClass());
+ throw new TranslationException(element.getClass());
+ }
+ }
+
+ return new APDUScriptRequest(requestScript);
+
+ } else {
+ log.error("cannot translate " + request.getClass());
+ throw new TranslationException(request.getClass());
+ }
+ }
+
+ @Override
+ public JAXBElement<? extends ResponseType> translate(STALResponse response) throws TranslationException {
+ if (response instanceof APDUScriptResponse) {
+ log.trace("translate at.gv.egiz.stal.ext.APDUScriptResponse -> at.buergerkarte.namespaces.cardchannel.service.ResponseType");
+ at.buergerkarte.namespaces.cardchannel.service.ResponseType responseT = of.createResponseType();
+ List<APDUScriptResponse.ResponseScriptElement> responseScript = ((APDUScriptResponse) response).getScript();
+
+ for (APDUScriptResponse.ResponseScriptElement element : responseScript) {
+
+ if (element instanceof APDUScriptResponse.ATR) {
+
+ byte[] atr = ((APDUScriptResponse.ATR) element).getAtr();
+
+ ATRType atrType = of.createATRType();
+ atrType.setValue(atr);
+ atrType.setRc(BigInteger.ZERO);
+ responseT.getATROrResponseAPDU().add(atrType);
+
+ } else if (element instanceof APDUScriptResponse.Response) {
+
+ APDUScriptResponse.Response resp = (APDUScriptResponse.Response) element;
+
+ ResponseAPDUType responseAPDUType = of.createResponseAPDUType();
+ responseAPDUType.setSequence(BigInteger.valueOf(resp.getSequence()));
+ responseAPDUType.setRc(BigInteger.valueOf(resp.getRc()));
+ responseAPDUType.setSW(resp.getSw());
+ responseAPDUType.setValue(resp.getApdu());
+
+ responseT.getATROrResponseAPDU().add(responseAPDUType);
+ } else {
+ log.error("invalid responseScriptElement " + element.getClass());
+ throw new TranslationException(element.getClass());
+ }
+ }
+ return of.createResponse(responseT);
+ } else {
+ log.error("cannot translate " + response.getClass());
+ throw new TranslationException(response.getClass());
+ }
+ }
+
+ @Override
+ public STALResponse translate(ResponseType response) throws TranslationException {
+ if (response instanceof at.buergerkarte.namespaces.cardchannel.service.ResponseType) {
+ log.trace("translate at.buergerkarte.namespaces.cardchannel.service.ResponseType -> at.gv.egiz.stal.ext.APDUScriptResponse");
+
+ List<Object> atrOrResponseAPDU = ((at.buergerkarte.namespaces.cardchannel.service.ResponseType) response).getATROrResponseAPDU();
+ List<APDUScriptResponse.ResponseScriptElement> responseScript = new ArrayList<APDUScriptResponse.ResponseScriptElement>();
+
+ for (Object object : atrOrResponseAPDU) {
+ if (object instanceof ATRType) {
+ byte[] atr = ((ATRType) object).getValue();
+ responseScript.add(new APDUScriptResponse.ATR(atr));
+ } else if (object instanceof ResponseAPDUType) {
+ ResponseAPDUType respAPDU = (ResponseAPDUType) object;
+ int sequence = (respAPDU.getSequence() != null)
+ ? respAPDU.getSequence().intValue()
+ : 0;
+ int rc = (respAPDU.getRc() != null)
+ ? respAPDU.getRc().intValue()
+ : 0;
+ responseScript.add(new APDUScriptResponse.Response(sequence,
+ respAPDU.getValue(),
+ respAPDU.getSW(),
+ rc));
+ } else {
+ log.error("invalid responseScriptElement " + object.getClass());
+ throw new TranslationException(object.getClass());
+ }
+ }
+ return new APDUScriptResponse(responseScript);
+
+ } else {
+ log.error("cannot translate " + response.getClass());
+ throw new TranslationException(response.getClass());
+ }
+ }
+}
diff --git a/STALXService/src/main/resources/wsdl/CardChannel.xsd b/STALXService/src/main/resources/wsdl/CardChannel.xsd
new file mode 100644
index 00000000..2dbc558e
--- /dev/null
+++ b/STALXService/src/main/resources/wsdl/CardChannel.xsd
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.buergerkarte.at/cardchannel"
+ xmlns:tns="http://www.buergerkarte.at/cardchannel"
+ elementFormDefault="qualified"
+ xmlns:stal="http://www.egiz.gv.at/stal">
+
+ <xs:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal.xsd"/>
+
+ <xs:annotation>
+ <xs:documentation>Schema for transparent access to cards using a BKU and the CardChannel
+ infobox</xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="Script" type="tns:ScriptType" substitutionGroup="stal:OtherRequest"/>
+ <xs:element name="Response" type="tns:ResponseType" substitutionGroup="stal:OtherResponse"/>
+ <xs:element name="Grunddaten" type="tns:AttributeList"/>
+ <xs:element name="EHIC" type="tns:AttributeList"/>
+ <xs:element name="Status" type="tns:AttributeList"/>
+ <xs:element name="SV-Personenbindung" type="xs:hexBinary"/>
+
+ <xs:complexType name="ScriptType">
+ <xs:annotation>
+ <xs:documentation>extends abstract stal:RequestType</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="stal:RequestType">
+ <xs:annotation>
+ <xs:documentation>Contains the script to be executed by the BKU</xs:documentation>
+ </xs:annotation>
+ <xs:choice maxOccurs="unbounded" minOccurs="1">
+ <xs:element name="Reset" type="tns:ResetType"/>
+ <xs:element name="CommandAPDU" type="tns:CommandAPDUType"/>
+ <xs:element name="VerifyAPDU" type="tns:VerifyAPDUType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="ResponseType">
+ <xs:annotation>
+ <xs:documentation>extends abstract stal:ResponseType</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="stal:ResponseType">
+ <xs:annotation>
+ <xs:documentation>Contains the result of the script executed by the
+ BKU</xs:documentation>
+ </xs:annotation>
+ <xs:choice maxOccurs="unbounded" minOccurs="1">
+ <xs:element name="ATR" type="tns:ATRType"/>
+ <xs:element name="ResponseAPDU" type="tns:ResponseAPDUType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="ResetType">
+ <xs:annotation>
+ <xs:documentation>Reset the icc and sequence counter</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="cold" type="xs:boolean" default="true"/>
+ </xs:complexType>
+
+ <xs:complexType name="CommandAPDUType">
+ <xs:annotation>
+ <xs:documentation>Contains a sequence of bytes send as command APDU to the
+ icc</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:hexBinary">
+ <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/>
+ <xs:attribute name="of" type="xs:positiveInteger" use="required"/>
+ <xs:attribute name="expectedSW" type="xs:hexBinary"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="VerifyAPDUType">
+ <xs:annotation>
+ <xs:documentation>Contains a sequence of bytes send as command APDU to the icc after a
+ PIN entered by the user has been incorporated into the APDU</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:hexBinary">
+ <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/>
+ <xs:attribute name="of" type="xs:positiveInteger" use="required"/>
+ <xs:attribute name="expectedSW" type="xs:hexBinary"/>
+ <xs:attribute name="message" type="xs:string" use="required"/>
+ <xs:attribute name="format" type="xs:hexBinary" use="required"/>
+ <xs:attribute name="offset" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="timeout" type="xs:nonNegativeInteger" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="ATRType">
+ <xs:annotation>
+ <xs:documentation>Contains the ATR received as reponse to a Reset
+ command</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:hexBinary">
+ <xs:attribute name="rc" type="xs:integer" default="0"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="ResponseAPDUType">
+ <xs:annotation>
+ <xs:documentation>Contains a sequence of bytes received from the card as response
+ APDU</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:hexBinary">
+ <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/>
+ <xs:attribute name="rc" type="xs:integer" default="0"/>
+ <xs:attribute name="SW" type="xs:hexBinary" default="9000"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="AttributeList">
+ <xs:annotation>
+ <xs:documentation>Contains a list of attributes</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="Attribute" type="tns:AttributeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="AttributeType">
+ <xs:annotation>
+ <xs:documentation>Contains an attribute converted from ASN.1</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="Integer" type="xs:integer" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Latin1String" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="UTF8String" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="NumericString" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="PrintableString" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="GeneralizedTime" type="xs:dateTime" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Date" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="oid" type="xs:string" use="required"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/STALXService/src/main/resources/wsdl/stal.xsd b/STALXService/src/main/resources/wsdl/stal.xsd
new file mode 100644
index 00000000..fd4ad4e3
--- /dev/null
+++ b/STALXService/src/main/resources/wsdl/stal.xsd
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2008 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.egiz.gv.at/stal"
+ xmlns:tns="http://www.egiz.gv.at/stal"
+ elementFormDefault="qualified">
+ <element name="SessionId" type="string"/>
+ <element name="GetNextRequest" type="tns:GetNextRequestType"/>
+ <element name="GetNextRequestResponse" type="tns:GetNextRequestResponseType"/>
+ <element name="GetHashDataInput" type="tns:GetHashDataInputType"/>
+ <element name="GetHashDataInputResponse" type="tns:GetHashDataInputResponseType"/>
+ <element name="GetHashDataInputFault" type="tns:GetHashDataInputFaultType"/>
+
+ <!-- Abstract Request/Response to be substituted by extending schemata
+ | must be top level element for allowing substitution groups
+ |-->
+ <element name="OtherRequest" type="tns:RequestType" abstract="true"/>
+ <element name="OtherResponse" type="tns:ResponseType" abstract="true"/>
+
+ <complexType name="GetNextRequestType">
+ <!-- abstract Request/Response type not supported by JAX-WS 2.0 (jdk < 1.6.0_04)
+ <sequence>
+ <element name="Response" type="tns:ResponseType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence-->
+ <choice maxOccurs="unbounded">
+ <element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/>
+ <element name="SignResponse" type="tns:SignResponseType"/>
+ <element name="ErrorResponse" type="tns:ErrorResponseType"/>
+ <element ref="tns:OtherResponse"/>
+ </choice>
+ <attribute name="SessionId" type="string"/>
+ </complexType>
+ <complexType name="ResponseType" abstract="true" />
+ <complexType name="InfoboxReadResponseType">
+ <complexContent>
+ <extension base="tns:ResponseType">
+ <sequence>
+ <element name="InfoboxValue" type="base64Binary"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="SignResponseType">
+ <complexContent>
+ <extension base="tns:ResponseType">
+ <sequence>
+ <element name="SignatureValue" type="base64Binary"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="ErrorResponseType">
+ <complexContent>
+ <extension base="tns:ResponseType">
+ <sequence>
+ <element name="ErrorCode" type="int"/>
+ <element name="ErrorMessage" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="GetNextRequestResponseType">
+ <!-- abstract Request/Response type not supported by JAX-WS 2.0 (jdk < 1.6.0_04)
+ <sequence>
+ <element name="Request" type="tns:RequestType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence-->
+ <choice maxOccurs="unbounded">
+ <element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/>
+ <element name="SignRequest" type="tns:SignRequestType"/>
+ <element name="QuitRequest" type="tns:QuitRequestType"/>
+ <element ref="tns:OtherRequest"/>
+ </choice>
+ <attribute name="SessionId" type="string"/>
+ </complexType>
+ <complexType name="RequestType" abstract="true"/>
+ <complexType name="InfoboxReadRequestType">
+ <complexContent>
+ <extension base="tns:RequestType">
+ <sequence>
+ <element name="InfoboxIdentifier">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="Certificates"/>
+ <enumeration value="IdentityLink"/>
+ <enumeration value="Mandates"/>
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="DomainIdentifier" type="anyURI" minOccurs="0"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="SignRequestType">
+ <complexContent>
+ <extension base="tns:RequestType">
+ <sequence>
+ <element name="KeyIdentifier">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="SecureSignatureKeypair"/>
+ <enumeration value="CertifiedKeypair"/>
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="SignedInfo" type="base64Binary"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="QuitRequestType">
+ <complexContent>
+ <extension base="tns:RequestType"/>
+ </complexContent>
+ </complexType>
+ <complexType name="GetHashDataInputType">
+ <sequence>
+ <element name="Reference" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="ID" type="string"/>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="SessionId" type="string"/>
+ </complexType>
+ <complexType name="GetHashDataInputResponseType">
+ <sequence>
+ <element name="Reference" maxOccurs="unbounded">
+ <complexType>
+ <simpleContent>
+ <extension base="base64Binary">
+ <attribute name="ID" type="string"/>
+ <attribute name="MimeType" type="string" use="optional"/>
+ <attribute name="Encoding" type="string" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="SessionId" type="string"/>
+ </complexType>
+ <complexType name="GetHashDataInputFaultType">
+ <sequence>
+ <element name="ErrorCode" type="int"/>
+ <element name="ErrorMessage" type="string"/>
+ </sequence>
+ </complexType>
+</schema>
diff --git a/STALXService/src/main/resources/wsdl/stalx.wsdl b/STALXService/src/main/resources/wsdl/stalx.wsdl
new file mode 100644
index 00000000..4c27f107
--- /dev/null
+++ b/STALXService/src/main/resources/wsdl/stalx.wsdl
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2008 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<definitions name="stal" targetNamespace="http://www.egiz.gv.at/wsdl/stal"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.egiz.gv.at/wsdl/stal"
+ xmlns:stal="http://www.egiz.gv.at/stal"
+ xmlns:cc="http://www.buergerkarte.at/cardchannel"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <types>
+ <xsd:schema targetNamespace="http://www.egiz.gv.at/wsdl/stal">
+ <xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal.xsd"/>
+ </xsd:schema>
+ <xsd:schema targetNamespace="http://www.egiz.gv.at/wsdl/stal-extended">
+ <xsd:import namespace="http://www.buergerkarte.at/cardchannel" schemaLocation="CardChannel.xsd"/>
+ </xsd:schema>
+ </types>
+ <message name="ConnectRequest">
+ <part name="part1" element="stal:SessionId"/>
+ </message>
+ <message name="NextRequestRequest">
+ <part name="part1" element="stal:GetNextRequest"/>
+ </message>
+ <message name="NextRequestResponse">
+ <part name="part1" element="stal:GetNextRequestResponse"/>
+ </message>
+ <message name="GetHashDataInputRequest">
+ <part name="part1" element="stal:GetHashDataInput"/>
+ </message>
+ <message name="GetHashDataInputResponse">
+ <part name="part1" element="stal:GetHashDataInputResponse"/>
+ </message>
+ <message name="GetHashDataInputFault">
+ <part name="part1" element="stal:GetHashDataInputFault"/>
+ </message>
+ <!--message name="DummyRequest">
+ <part name="part1" element="cc:Script"/>
+ </message>
+ <message name="DummyResponse">
+ <part name="part1" element="cc:Response"/>
+ </message-->
+ <portType name="STALPortType">
+ <operation name="connect">
+ <input name="input3" message="tns:ConnectRequest"/>
+ <output name="output3" message="tns:NextRequestResponse"/>
+ </operation>
+ <operation name="nextRequest">
+ <input name="input1" message="tns:NextRequestRequest"/>
+ <output name="output1" message="tns:NextRequestResponse"/>
+ </operation>
+ <operation name="getHashDataInput">
+ <input name="input2" message="tns:GetHashDataInputRequest"/>
+ <output name="output2" message="tns:GetHashDataInputResponse"/>
+ <fault name="fault1" message="tns:GetHashDataInputFault"/>
+ </operation>
+ <!--operation name="dummyOp">
+ <input name="dummyIn" message="tns:DummyRequest"/>
+ <output name="dummyOut" message="tns:DummyResponse"/>
+ </operation-->
+ </portType>
+ <binding name="STALBinding" type="tns:STALPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="connect">
+ <input name="input3">
+ <soap:body use="literal"/>
+ </input>
+ <output name="output3">
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="nextRequest">
+ <soap:operation/>
+ <input name="input1">
+ <soap:body use="literal"/>
+ </input>
+ <output name="output1">
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="getHashDataInput">
+ <soap:operation/>
+ <input name="input2">
+ <soap:body use="literal"/>
+ </input>
+ <output name="output2">
+ <soap:body use="literal"/>
+ </output>
+ <fault name="fault1">
+ <soap:fault name="fault1"/>
+ </fault>
+ </operation>
+ <!--operation name="dummyOp">
+ <soap:operation/>
+ <input name="dummyIn">
+ <soap:body use="literal"/>
+ </input>
+ <output name="dummyOut">
+ <soap:body use="literal"/>
+ </output>
+ </operation-->
+ </binding>
+ <service name="STALService">
+ <port name="STALPort" binding="tns:STALBinding">
+ <soap:address location="http://localhost:3495/jxbctx/stal"/>
+ </port>
+ </service>
+</definitions>
diff --git a/STALXService/src/test/java/at/gv/egiz/stalx/service/ClientJAXBContextFactory.java b/STALXService/src/test/java/at/gv/egiz/stalx/service/ClientJAXBContextFactory.java
new file mode 100644
index 00000000..2f5c371d
--- /dev/null
+++ b/STALXService/src/test/java/at/gv/egiz/stalx/service/ClientJAXBContextFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.stalx.service;
+
+//import com.sun.xml.bind.api.JAXBRIContext;
+//import com.sun.xml.bind.api.TypeReference;
+//import com.sun.xml.ws.api.model.SEIModel;
+//import com.sun.xml.ws.developer.JAXBContextFactory;
+import java.util.List;
+import javax.xml.bind.JAXBException;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class ClientJAXBContextFactory { //implements JAXBContextFactory {
+
+// @Override
+// public JAXBRIContext createJAXBContext(SEIModel sei, List<Class> classesToBind, List<TypeReference> typeReferences) throws JAXBException {
+//
+// System.out.println("Using client's custom JAXBContext");
+////54 List<Class> classList = new ArrayList<Class>();
+////55 classList.addAll(classesToBind);
+////56 classList.add(Toyota.class);
+////57
+////58 List<TypeReference> refList = new ArrayList<TypeReference>();
+////59 refList.addAll(typeReferences);
+////60 refList.add(new TypeReference(new QName("","arg0"),Toyota.class));
+////61
+////62 return JAXBRIContext.newInstance(classList.toArray
+////63 (new Class[classList.size()]),
+////64 refList, null, sei.getTargetNamespace(), false, null);
+//
+// return null;
+// }
+
+}
diff --git a/STALXService/src/test/java/at/gv/egiz/stalx/service/STALServiceTest.java b/STALXService/src/test/java/at/gv/egiz/stalx/service/STALServiceTest.java
new file mode 100644
index 00000000..fda4b235
--- /dev/null
+++ b/STALXService/src/test/java/at/gv/egiz/stalx/service/STALServiceTest.java
@@ -0,0 +1,112 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package at.gv.egiz.stalx.service;
+
+import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType;
+import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
+import at.gv.egiz.stal.service.types.GetNextRequestResponseType;
+import at.gv.egiz.stal.service.types.RequestType;
+import java.net.URL;
+import java.util.List;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ * @author clemens
+ */
+@Ignore
+public class STALServiceTest {
+
+ static at.gv.egiz.stal.service.STALPortType port;
+
+ public STALServiceTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ // UsesJAXBContextFeature feature = new UsesJAXBContextFeature(ClientJAXBContextFactory.class);
+
+ URL wsdlLocation = new URL("http://localhost:3495/stal?wsdl");
+ QName serviceName = new QName("http://www.egiz.gv.at/wsdl/stal", "STALService");
+ STALService service = new STALService(wsdlLocation, serviceName);
+ port = service.getSTALPort();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+// /**
+// * Test of getSTALPort method, of class STALService.
+// */
+// @Test
+// public void testGetSTALPort() {
+// System.out.println("getSTALPort");
+// STALService instance = null;
+// STALPortType expResult = null;
+// STALPortType result = instance.getSTALPort();
+// assertEquals(expResult, result);
+// // TODO review the generated test code and remove the default call to fail.
+// fail("The test case is a prototype.");
+// }
+ @Test
+ public void testConnect() {
+ System.out.println("connecting to STAL WS [TestSession] ...");
+ GetNextRequestResponseType wsResponse = port.connect("TestSession");
+
+ List<JAXBElement<? extends RequestType>> stalRequests = wsResponse.getInfoboxReadRequestOrSignRequestOrQuitRequest();
+ System.out.println("Received " + wsResponse.getClass() + " containing " + stalRequests.size() + " requests");
+ for (JAXBElement<? extends RequestType> jAXBElement : stalRequests) {
+ System.out.println(" STALRequest " + jAXBElement.getValue().getClass());
+ RequestType request = jAXBElement.getValue();
+ if (request instanceof ScriptType) {
+ List<Object> apdus = ((ScriptType) request).getResetOrCommandAPDUOrVerifyAPDU();
+ for (Object object : apdus) {
+ System.out.println(" - APDU: " + new String(((CommandAPDUType) object).getValue()));
+// System.out.println(" APDU: " + object.getClass());
+ }
+ }
+ }
+ }
+
+
+// GetHashDataInputType hdi = stalOF.createGetHashDataInputType();
+// hdi.setSessionId("TestSession");
+// hdi.getReference().add(new GetHashDataInputType.Reference());
+// GetHashDataInputResponseType hdiResponse = port.getHashDataInput(hdi);
+// List<GetHashDataInputResponseType.Reference> l = hdiResponse.getReference();
+// System.out.println("HDI references: " + l.size());
+// for (GetHashDataInputResponseType.Reference reference : l) {
+// System.out.println(" Reference " + reference.getID());
+// }
+
+
+// ScriptType part2 = ccOF.createScriptType();
+// ResponseType scriptResp = ccOF.createResponseType();
+// GetNextRequestResponseType stalReqResp =
+// port.nextRequest();
+// // TODO process result here
+// generated.ResponseType result2 = port.runAPDUScript(part2);
+// System.out.println("Result = " + result2);
+
+
+
+
+} \ No newline at end of file
diff --git a/bkucommon/pom.xml b/bkucommon/pom.xml
index 79516b1d..ccc1814d 100644
--- a/bkucommon/pom.xml
+++ b/bkucommon/pom.xml
@@ -20,7 +20,7 @@
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>STALExt</artifactId>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -62,6 +62,11 @@
<artifactId>spring-context</artifactId>
<scope>test</scope>
</dependency>
+ <!-- dependency to ensure NamespacePrefixmapper -->
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java
index e7f96c06..ce03dcf9 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.slcommands.impl;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import java.io.ByteArrayOutputStream;
import java.util.Arrays;
import java.util.Collections;
@@ -43,6 +44,8 @@ import at.gv.egiz.bku.slcommands.InfoboxReadResult;
import at.gv.egiz.bku.slcommands.SLCommandContext;
import at.gv.egiz.bku.slcommands.SLCommandFactory;
import at.gv.egiz.bku.slexceptions.SLCommandException;
+import at.gv.egiz.marshal.MarshallerFactory;
+import javax.xml.bind.PropertyException;
/**
* An abstract base class for {@link Infobox} implementations of type associative array.
@@ -257,8 +260,7 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl
ByteArrayOutputStream result;
try {
- Marshaller marshaller = jaxbContext.createMarshaller();
-
+ Marshaller marshaller = MarshallerFactory.createMarshaller(jaxbContext);
result = new ByteArrayOutputStream();
marshaller.marshal(jaxbElement, result);
} catch (JAXBException e) {
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java
index 4969c85a..b352a51e 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java
@@ -14,8 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.slcommands.impl;
-
+package at.gv.egiz.bku.slcommands.impl;
+
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -34,76 +35,78 @@ import at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseTyp
import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory;
import at.gv.egiz.bku.slcommands.SLCommandFactory;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-/**
- * This calls implements the result of the security layer command <code>CreateXMLSignature</code>.
- *
- * @author mcentner
- */
-public class CreateXMLSignatureResultImpl extends SLResultImpl {
-
- /**
- * Logging facility.
- */
- private static Log log = LogFactory.getLog(CreateXMLSignatureResultImpl.class);
-
- /**
- * The document containing the XMLSignature.
- */
- protected Document doc;
-
- /**
- * Creates a new instance of this CreateXMLSignatureResultImpl with the given
- * signature <code>document</code>.
- *
- * @param document the signature document
- *
- * @throws NullPointerException if <code>document</code> is <code>null</code>
- */
- public CreateXMLSignatureResultImpl(Document document) {
- super();
-
- if (document == null) {
- throw new NullPointerException("Argument 'document' must not be null.");
- }
-
- this.doc = document;
-
- marshallCreateXMLSignatureResponse();
- }
-
- /**
- * Marshalls the <code>CreateXMLSignatureResponse</code>.
- */
- private void marshallCreateXMLSignatureResponse() {
-
- ObjectFactory factory = new ObjectFactory();
-
- CreateXMLSignatureResponseType createCreateXMLSignatureResponseType = factory.createCreateXMLSignatureResponseType();
- JAXBElement<CreateXMLSignatureResponseType> createCreateXMLSignatureResponse = factory.createCreateXMLSignatureResponse(createCreateXMLSignatureResponseType);
-
- DocumentFragment fragment = doc.createDocumentFragment();
-
- JAXBContext jaxbContext = SLCommandFactory.getInstance().getJaxbContext();
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.marshal(createCreateXMLSignatureResponse, fragment);
- } catch (JAXBException e) {
- log.error("Failed to marshall 'CreateXMLSignatureResponse'", e);
- throw new SLRuntimeException(e);
- }
-
- Node child = fragment.getFirstChild();
- if (child instanceof Element) {
- Node node = doc.replaceChild(child, doc.getDocumentElement());
- child.appendChild(node);
- }
-
- }
+import at.gv.egiz.marshal.MarshallerFactory;
+import javax.xml.bind.PropertyException;
+
+/**
+ * This calls implements the result of the security layer command <code>CreateXMLSignature</code>.
+ *
+ * @author mcentner
+ */
+public class CreateXMLSignatureResultImpl extends SLResultImpl {
+
+ /**
+ * Logging facility.
+ */
+ private static Log log = LogFactory.getLog(CreateXMLSignatureResultImpl.class);
+
+ /**
+ * The document containing the XMLSignature.
+ */
+ protected Document doc;
+
+ /**
+ * Creates a new instance of this CreateXMLSignatureResultImpl with the given
+ * signature <code>document</code>.
+ *
+ * @param document the signature document
+ *
+ * @throws NullPointerException if <code>document</code> is <code>null</code>
+ */
+ public CreateXMLSignatureResultImpl(Document document) {
+ super();
+
+ if (document == null) {
+ throw new NullPointerException("Argument 'document' must not be null.");
+ }
+
+ this.doc = document;
+
+ marshallCreateXMLSignatureResponse();
+ }
+
+ /**
+ * Marshalls the <code>CreateXMLSignatureResponse</code>.
+ */
+ private void marshallCreateXMLSignatureResponse() {
+
+ ObjectFactory factory = new ObjectFactory();
+
+ CreateXMLSignatureResponseType createCreateXMLSignatureResponseType = factory.createCreateXMLSignatureResponseType();
+ JAXBElement<CreateXMLSignatureResponseType> createCreateXMLSignatureResponse = factory.createCreateXMLSignatureResponse(createCreateXMLSignatureResponseType);
+
+ DocumentFragment fragment = doc.createDocumentFragment();
+
+ JAXBContext jaxbContext = SLCommandFactory.getInstance().getJaxbContext();
+ try {
+ Marshaller marshaller = MarshallerFactory.createMarshaller(jaxbContext);
+ marshaller.marshal(createCreateXMLSignatureResponse, fragment);
+ } catch (JAXBException e) {
+ log.error("Failed to marshall 'CreateXMLSignatureResponse'", e);
+ throw new SLRuntimeException(e);
+ }
+
+ Node child = fragment.getFirstChild();
+ if (child instanceof Element) {
+ Node node = doc.replaceChild(child, doc.getDocumentElement());
+ child.appendChild(node);
+ }
+
+ }
@Override
public void writeTo(Result result, Templates templates) {
writeTo(doc, result, templates);
- }
-
-}
+ }
+
+}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java
index d8295227..75e44afa 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java
@@ -14,8 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.slcommands.impl;
-
+package at.gv.egiz.bku.slcommands.impl;
+
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -40,86 +41,88 @@ import at.gv.egiz.bku.slcommands.InfoboxReadResult;
import at.gv.egiz.bku.slcommands.SLCommand;
import at.gv.egiz.bku.slcommands.SLCommandFactory;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-/**
- * This class implements the result of the security layer command <code>InfoboxReadRequest</code>.
- *
- * @author mcentner
- */
-public class InfoboxReadResultFileImpl extends SLResultImpl implements
- InfoboxReadResult {
-
- /**
- * Logging facility.
- */
- protected static Log log = LogFactory.getLog(InfoboxReadResultFileImpl.class);
-
- /**
- * The XML document containing the infobox content.
- */
- protected Document xmlDocument;
-
- /**
- * Creates the response document from the given <code>binaryContent</code>.
- *
- * @param binaryContent the infobox content
- * @param preserveSpace the value of the <code>preserveSpace</code> parameter
- *
- * @return the created response document
- */
- private Document createResponseDocument(byte[] binaryContent, boolean preserveSpace) {
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- Document doc;
- try {
- doc = dbf.newDocumentBuilder().newDocument();
- } catch (ParserConfigurationException e) {
- // it should always be possible to create a new Document
- log.error("Failed to create XML document.", e);
- throw new SLRuntimeException(e);
- }
-
- ObjectFactory factory = new ObjectFactory();
-
- Base64XMLContentType base64XMLContentType = factory.createBase64XMLContentType();
- if (binaryContent == null) {
- XMLContentType xmlContentType = factory.createXMLContentType();
- if (preserveSpace) {
- xmlContentType.setSpace("preserve");
- }
- base64XMLContentType.setXMLContent(xmlContentType);
- } else {
- base64XMLContentType.setBase64Content(binaryContent);
- }
- InfoboxReadResponseType infoboxReadResponseType = factory.createInfoboxReadResponseType();
- infoboxReadResponseType.setBinaryFileData(base64XMLContentType);
-
- JAXBElement<InfoboxReadResponseType> infoboxReadResponse = factory.createInfoboxReadResponse(infoboxReadResponseType);
-
- JAXBContext context = SLCommandFactory.getInstance().getJaxbContext();
- try {
- Marshaller marshaller = context.createMarshaller();
- marshaller.marshal(infoboxReadResponse, doc);
- } catch (JAXBException e) {
- log.error("Failed to marshal 'InfoboxReadResponse' document.", e);
- throw new SLRuntimeException(e);
- }
-
- return doc;
-
- }
-
-
- /**
- * @return an XMLResult for marshalling the infobox to
- */
- public Result getXmlResult(boolean preserveSpace) {
-
- xmlDocument = createResponseDocument(null, preserveSpace);
-
- NodeList nodeList = xmlDocument.getElementsByTagNameNS(SLCommand.NAMESPACE_URI, "XMLContent");
- return new DOMResult(nodeList.item(0));
-
+import at.gv.egiz.marshal.MarshallerFactory;
+import javax.xml.bind.PropertyException;
+
+/**
+ * This class implements the result of the security layer command <code>InfoboxReadRequest</code>.
+ *
+ * @author mcentner
+ */
+public class InfoboxReadResultFileImpl extends SLResultImpl implements
+ InfoboxReadResult {
+
+ /**
+ * Logging facility.
+ */
+ protected static Log log = LogFactory.getLog(InfoboxReadResultFileImpl.class);
+
+ /**
+ * The XML document containing the infobox content.
+ */
+ protected Document xmlDocument;
+
+ /**
+ * Creates the response document from the given <code>binaryContent</code>.
+ *
+ * @param binaryContent the infobox content
+ * @param preserveSpace the value of the <code>preserveSpace</code> parameter
+ *
+ * @return the created response document
+ */
+ private Document createResponseDocument(byte[] binaryContent, boolean preserveSpace) {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ Document doc;
+ try {
+ doc = dbf.newDocumentBuilder().newDocument();
+ } catch (ParserConfigurationException e) {
+ // it should always be possible to create a new Document
+ log.error("Failed to create XML document.", e);
+ throw new SLRuntimeException(e);
+ }
+
+ ObjectFactory factory = new ObjectFactory();
+
+ Base64XMLContentType base64XMLContentType = factory.createBase64XMLContentType();
+ if (binaryContent == null) {
+ XMLContentType xmlContentType = factory.createXMLContentType();
+ if (preserveSpace) {
+ xmlContentType.setSpace("preserve");
+ }
+ base64XMLContentType.setXMLContent(xmlContentType);
+ } else {
+ base64XMLContentType.setBase64Content(binaryContent);
+ }
+ InfoboxReadResponseType infoboxReadResponseType = factory.createInfoboxReadResponseType();
+ infoboxReadResponseType.setBinaryFileData(base64XMLContentType);
+
+ JAXBElement<InfoboxReadResponseType> infoboxReadResponse = factory.createInfoboxReadResponse(infoboxReadResponseType);
+
+ JAXBContext context = SLCommandFactory.getInstance().getJaxbContext();
+ try {
+ Marshaller marshaller = MarshallerFactory.createMarshaller(context);
+ marshaller.marshal(infoboxReadResponse, doc);
+ } catch (JAXBException e) {
+ log.error("Failed to marshal 'InfoboxReadResponse' document.", e);
+ throw new SLRuntimeException(e);
+ }
+
+ return doc;
+
+ }
+
+
+ /**
+ * @return an XMLResult for marshalling the infobox to
+ */
+ public Result getXmlResult(boolean preserveSpace) {
+
+ xmlDocument = createResponseDocument(null, preserveSpace);
+
+ NodeList nodeList = xmlDocument.getElementsByTagNameNS(SLCommand.NAMESPACE_URI, "XMLContent");
+ return new DOMResult(nodeList.item(0));
+
}
/**
@@ -142,21 +145,21 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements
}
- /**
- * Creates a new result document for this <code>InfoboxReadResult</code>
- * and sets the given <code>resultBytes</code> as content.
- *
- * @param resultBytes
- */
- public void setResultBytes(byte[] resultBytes) {
-
- xmlDocument = createResponseDocument(resultBytes, false);
-
- }
-
+ /**
+ * Creates a new result document for this <code>InfoboxReadResult</code>
+ * and sets the given <code>resultBytes</code> as content.
+ *
+ * @param resultBytes
+ */
+ public void setResultBytes(byte[] resultBytes) {
+
+ xmlDocument = createResponseDocument(resultBytes, false);
+
+ }
+
@Override
public void writeTo(Result result, Templates templates) {
writeTo(xmlDocument, result, templates);
- }
-
-}
+ }
+
+}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java
index 99a3b119..0452bddf 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java
@@ -41,6 +41,7 @@ import org.w3c.dom.Node;
import at.buergerkarte.namespaces.securitylayer._1.ErrorResponseType;
import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import at.gv.egiz.bku.slcommands.SLCommandFactory;
import at.gv.egiz.bku.slcommands.SLResult;
import at.gv.egiz.bku.slexceptions.SLBindingException;
@@ -49,6 +50,8 @@ import at.gv.egiz.bku.slexceptions.SLException;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
import at.gv.egiz.bku.utils.DebugOutputStream;
import at.gv.egiz.bku.utils.DebugWriter;
+import at.gv.egiz.marshal.MarshallerFactory;
+import javax.xml.bind.PropertyException;
/**
* This class serves as an abstract base class for the implementation of a
@@ -90,8 +93,7 @@ public abstract class SLResultImpl implements SLResult {
private Marshaller getMarshaller() {
try {
JAXBContext context = SLCommandFactory.getInstance().getJaxbContext();
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ Marshaller marshaller = MarshallerFactory.createMarshaller(context, true);
return marshaller;
} catch (JAXBException e) {
log.fatal("Failed to marshall error response.", e);
diff --git a/pom.xml b/pom.xml
index 9db504a3..2ba2b2ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,6 +20,8 @@
<module>BKUViewer</module>
<module>BKULocalApp</module>
<module>STALExt</module>
+ <module>STALXService</module>
+ <module>BKUAppletExt</module>
</modules>
<developers>
<developer>
@@ -230,6 +232,11 @@
<artifactId>spring-context</artifactId>
<version>2.5.5</version>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.9</version>
+ </dependency>
</dependencies>
</dependencyManagement>
</project> \ No newline at end of file
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
index 6f08a135..92491139 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
@@ -61,8 +61,7 @@ public abstract class AbstractSMCCSTAL implements STAL {
protected abstract BKUGUIFacade getGUI();
- private STALResponse getRespone(STALRequest request) throws InterruptedException {
- log.info("Processing: " + request.getClass());
+ private STALResponse getResponse(STALRequest request) throws InterruptedException {
int retryCounter = 0;
while (retryCounter < maxRetries) {
log.info("Retry #" + retryCounter + " of " + maxRetries);
@@ -130,7 +129,7 @@ public abstract class AbstractSMCCSTAL implements STAL {
log.info("Processing: " + request.getClass());
STALResponse response;
try {
- response = getRespone(request);
+ response = getResponse(request);
if (response != null) {
responseList.add(response);
if (response instanceof ErrorResponse) {
diff --git a/utils/pom.xml b/utils/pom.xml
index d9620dca..aabab561 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -45,6 +45,11 @@
<groupId>iaik</groupId>
<artifactId>iaik_xsect</artifactId>
</dependency>
+ <!-- dependency to ensure NamespacePrefixmapper -->
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
</dependencies>
<!--
add dependencies to determine build order of BKU modules | (scope
diff --git a/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java b/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java
index 5f4e5d92..31e5163a 100644
--- a/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java
+++ b/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java
@@ -14,403 +14,403 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.idlink;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.security.PublicKey;
-import java.security.cert.X509Certificate;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.PropertyException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-
-import org.w3._2000._09.xmldsig_.KeyValueType;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import at.buergerkarte.namespaces.personenbindung._20020506_.CompressedIdentityLinkType;
-import at.gv.e_government.reference.namespace.persondata._20020228_.AbstractPersonType;
-import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType;
-import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType;
-import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPersonType;
-import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType.Value;
-import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType.FamilyName;
-import at.gv.egiz.idlink.ans1.CitizenPublicKey;
-import at.gv.egiz.idlink.ans1.IdentityLink;
-import at.gv.egiz.idlink.ans1.PersonData;
-import at.gv.egiz.idlink.ans1.PhysicalPersonData;
-import at.gv.egiz.xmldsig.KeyTypeNotSupportedException;
-import at.gv.egiz.xmldsig.KeyValueFactory;
-
-public class CompressedIdentityLinkFactory {
-
- /**
- * The instance returned by {@link #getInstance()}.
- */
- private static CompressedIdentityLinkFactory instance;
-
- /**
- * The <code>JAXBContext</code>.
- */
- private static JAXBContext jaxbContext;
-
- /**
- * The <code>KeyValueFactory</code>.
- */
- private static KeyValueFactory keyValueFactory;
-
- /**
- * Get an instance of this <code>CompressedIdentityLinkFactory</code>.
- *
- * @return an instance of this <code>CompressedIdentityLinkFactory</code>
- */
- public synchronized static CompressedIdentityLinkFactory getInstance() {
- if (instance == null) {
- instance = new CompressedIdentityLinkFactory();
- }
- return instance;
- }
-
- /**
- * Private constructor.
- */
- private CompressedIdentityLinkFactory() {
-
- keyValueFactory = new KeyValueFactory();
-
- StringBuffer packageNames = new StringBuffer();
- packageNames.append(at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(org.w3._2001._04.xmldsig_more_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory.class.getPackage().getName());
-
- try {
- jaxbContext = JAXBContext.newInstance(packageNames.toString());
- } catch (JAXBException e) {
- // we should not get an JAXBException initializing the JAXBContext
- throw new RuntimeException(e);
- }
-
- }
-
- public IdentityLink createIdLink(CompressedIdentityLinkType compressedIdentityLinkType) {
-
- // IssuerTemplate
- String issuerTemplate = compressedIdentityLinkType.getIssuerTemplate();
-
- // AssertionId
- String assertionID = compressedIdentityLinkType.getAssertionID();
-
- // IssueInstant
- String issueInstant = compressedIdentityLinkType.getIssueInstant();
-
- AbstractPersonType personDataType = compressedIdentityLinkType.getPersonData();
-
- String baseId = null;
-
- List<IdentificationType> identifications = personDataType.getIdentification();
- for (IdentificationType identificationType : identifications) {
- String type = identificationType.getType();
- if ("urn:publicid:gv.at:baseid".equals(type)) {
- baseId = identificationType.getValue().getValue();
- }
- }
-
- String givenName = null;
- String familyName = null;
- String dateOfBirth = null;
-
- if (personDataType instanceof PhysicalPersonType) {
- PhysicalPersonType physicalPersonType = (PhysicalPersonType) personDataType;
- PersonNameType name = physicalPersonType.getName();
- List<String> givenNames = name.getGivenName();
- if (!givenNames.isEmpty()) {
- givenName = givenNames.get(0);
- }
- List<FamilyName> familyNames = name.getFamilyName();
- if (!familyNames.isEmpty()) {
- familyName = familyNames.get(0).getValue();
- }
- dateOfBirth = physicalPersonType.getDateOfBirth();
- }
-
- PhysicalPersonData physicalPersonData = new PhysicalPersonData(baseId, givenName, familyName, dateOfBirth);
- PersonData personData = new PersonData(physicalPersonData);
-
- int numKeys = compressedIdentityLinkType.getCitizenPublicKey().size();
- CitizenPublicKey[] citizenPublicKeys = new CitizenPublicKey[numKeys];
- for (int i = 0; i < numKeys;) {
- citizenPublicKeys[i] = new CitizenPublicKey(++i);
- }
-
- byte[] signatureValue = compressedIdentityLinkType.getSignatureValue();
- byte[] referenceDigest = compressedIdentityLinkType.getReferenceDigest();
- byte[] referenceManifestDigest = compressedIdentityLinkType.getReferenceManifestDigest();
- byte[] manifestReferenceDigest = compressedIdentityLinkType.getManifestReferenceDigest();
-
- IdentityLink idLink = new IdentityLink(issuerTemplate, assertionID, issueInstant, personData, citizenPublicKeys, signatureValue);
- idLink.setReferenceDigest(referenceDigest);
- idLink.setReferenceManifestDigest(referenceManifestDigest);
- idLink.setManifestReferenceDigest(manifestReferenceDigest);
-
- return idLink;
-
- }
-
- /**
- * Creates a new <code>CompressedIdentityLink</code> element from the given
- * ASN.1 representation of an <code>idLink</code>.
- *
- * @param idLink
- * the ASN.1 representation of an <code>IdentityLink</code>
- * @param certificates
- * a list of {@link X509Certificate}s containing the corresponding
- * public keys
- * @param domainId TODO
- * @return a new <code>CompressedIdentityLink</code> element
- *
- * @throws NullPointerException
- * if <code>idLink</code> or <code>certificates</code> is
- * <code>null</code>
- * @throws IllegalArgumentException
- * if <code>idLink</code> references certificates not in the range
- * of the <code>certificates</code> list
- */
- public JAXBElement<CompressedIdentityLinkType> createCompressedIdentityLink(
- at.gv.egiz.idlink.ans1.IdentityLink idLink,
- List<X509Certificate> certificates, String domainId) {
-
- at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory prFactory =
- new at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory();
-
- at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory pbFactory =
- new at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory();
-
- org.w3._2000._09.xmldsig_.ObjectFactory dsFactory = new org.w3._2000._09.xmldsig_.ObjectFactory();
-
- // PersonData
- PhysicalPersonData __physicalPersonData = idLink.getPersonData()
- .getPhysicalPerson();
-
- Value identificationTypeValue = prFactory.createIdentificationTypeValue();
- identificationTypeValue.setValue(__physicalPersonData.getBaseId());
- IdentificationType identificationType = prFactory
- .createIdentificationType();
- identificationType.setValue(identificationTypeValue);
- if (domainId != null) {
- identificationType.setType(domainId);
- } else {
- identificationType.setType("urn:publicid:gv.at:baseid");
- }
-
- PersonNameType personNameType = prFactory.createPersonNameType();
- FamilyName personNameTypeFamilyName = prFactory
- .createPersonNameTypeFamilyName();
- personNameTypeFamilyName.setValue(__physicalPersonData.getFamilyName());
- personNameType.getFamilyName().add(personNameTypeFamilyName);
- personNameType.getGivenName().add(__physicalPersonData.getGivenName());
-
- PhysicalPersonType physicalPersonType = prFactory
- .createPhysicalPersonType();
- physicalPersonType.getIdentification().add(identificationType);
- physicalPersonType.setName(personNameType);
- physicalPersonType.setDateOfBirth(__physicalPersonData.getDateOfBirth());
-
- // CompressedIdentityLink
- CompressedIdentityLinkType compressedIdentityLinkType = pbFactory
- .createCompressedIdentityLinkType();
- compressedIdentityLinkType.setIssuerTemplate(idLink.getIssuerTemplate());
- compressedIdentityLinkType.setAssertionID(idLink.getAssertionID());
- compressedIdentityLinkType.setIssueInstant(idLink.getIssueInstant());
- compressedIdentityLinkType.setPersonData(physicalPersonType);
-
- // CitizenPublicKey
- CitizenPublicKey[] __citizenPublicKeys = idLink.getCitizenPublicKeys();
- for (CitizenPublicKey __citizenPublicKey : __citizenPublicKeys) {
-
- X509Certificate certificate = certificates.get(__citizenPublicKey.getOnToken());
- PublicKey publicKey = certificate.getPublicKey();
-
- JAXBElement<?> keyValue;
- try {
- keyValue = keyValueFactory.createKeyValue(publicKey);
- } catch (KeyTypeNotSupportedException e) {
- // TODO: handle exception properly
- throw new RuntimeException(e);
- }
-
- KeyValueType keyValueType = dsFactory.createKeyValueType();
- keyValueType.getContent().add(keyValue);
-
- compressedIdentityLinkType.getCitizenPublicKey().add(keyValueType);
- }
-
- compressedIdentityLinkType.setSignatureValue(idLink.getSignatureValue());
- compressedIdentityLinkType.setReferenceDigest(idLink.getReferenceDigest());
- compressedIdentityLinkType.setReferenceManifestDigest(idLink
- .getReferenceManifestDigest());
- compressedIdentityLinkType.setManifestReferenceDigest(idLink
- .getManifestReferenceDigest());
- JAXBElement<CompressedIdentityLinkType> compressedIdentityLink = pbFactory
- .createCompressedIdentityLink(compressedIdentityLinkType);
-
- return compressedIdentityLink;
-
- }
-
- /**
- * Marshall the given <code>compressedIdentityLink</code> into a DOM document
- * with the given Nodes as <code>parent</code> and <code>nextSibling</code>
- * nodes.
- *
- * @param compressedIdentityLink
- * the <code>CompressedIdentityLink</code> element
- * @param parent
- * the parent node
- * @param nextSibling
- * the next sibling node (may be <code>null</code>)
- * @param applyWorkarounds
- * apply workarounds as spefiyed by
- * {@link #applyWorkarounds(Element, int)}
- *
- * @throws JAXBException
- * if an unexpected error occurs while marshalling
- * @throws NullPointerException
- * if <code>compressdIdentityLink</code> or <code>parent</code> is
- * <code>null</code>
- */
- public void marshallCompressedIdentityLink(
- JAXBElement<CompressedIdentityLinkType> compressedIdentityLink,
- Node parent, Node nextSibling, boolean applyWorkarounds) throws JAXBException {
-
- DOMResult result = new DOMResult(parent, nextSibling);
-
-
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
-
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
-
- marshaller.marshal(compressedIdentityLink, result);
- } catch (PropertyException e) {
- throw new RuntimeException(e);
- }
-
- if (applyWorkarounds) {
- Element element = (Element) ((nextSibling != null)
- ? nextSibling.getPreviousSibling()
- : parent.getFirstChild());
- applyWorkarounds(element, 76);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public CompressedIdentityLinkType unmarshallCompressedIdentityLink(Source source) throws JAXBException {
-
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-
- return ((JAXBElement<CompressedIdentityLinkType>) unmarshaller.unmarshal(source)).getValue();
-
- }
-
- /**
- * Apply some workarounds to the given CompressedIdentityLink
- * <code>element</code> to achieve compatibility with IdentityLink
- * transformation stylesheets that have been designed for a (buggy) form of
- * the CompressedIdentityLink as produced by a well-known citizen card
- * environment implementation.
- *
- * <ol>
- * <li>Replace the attribute node <code>URN</code> of the
- * <code>NamedCurve</code> element of an <code>ECDSAKeyValue</code> element by
- * a child text-node with the same content.</li>
- * <li>Replace the attribute nodes <code>Value</code> of the <code>X</code>
- * and <code>Y</code> elements of an <code>ECDSAKeyValue</code> element by a
- * child text-node with the same content.</li>
- * <li>Insert &quot;\n&quot; at <code>base64LineLength</code> into the Base64
- * content of the <code>Modulus</code> element of an <code>RSAKeyValue</code>
- * element.
- * </ol>
- *
- * @param element
- * the <code>CompressedIdentityLink</code> element
- * @param base64LineLength
- * the line length of Base64 content
- */
- public void applyWorkarounds(Element element, int base64LineLength) {
-
- Document document = element.getOwnerDocument();
-
- NodeList nodeList = element.getElementsByTagNameNS(
- "http://www.w3.org/2001/04/xmldsig-more#", "NamedCurve");
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node ecdsaNameCurve = nodeList.item(i);
- Attr attrNode = ((Element) ecdsaNameCurve).getAttributeNodeNS(null,
- "URN");
- ecdsaNameCurve
- .appendChild(document.createTextNode(attrNode.getValue()));
- ((Element) ecdsaNameCurve).removeAttributeNode(attrNode);
- }
- nodeList = document.getElementsByTagNameNS(
- "http://www.w3.org/2001/04/xmldsig-more#", "X");
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node x = nodeList.item(i);
- Attr attrNode = ((Element) x).getAttributeNodeNS(null, "Value");
- x.appendChild(document.createTextNode(attrNode.getValue()));
- ((Element) x).removeAttributeNode(attrNode);
- }
- nodeList = document.getElementsByTagNameNS(
- "http://www.w3.org/2001/04/xmldsig-more#", "Y");
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node y = nodeList.item(i);
- Attr attrNode = ((Element) y).getAttributeNodeNS(null, "Value");
- y.appendChild(document.createTextNode(attrNode.getValue()));
- ((Element) y).removeAttributeNode(attrNode);
- }
-
- if (base64LineLength > 0) {
- nodeList = document.getElementsByTagNameNS(
- "http://www.w3.org/2000/09/xmldsig#", "Modulus");
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node modulus = nodeList.item(i);
- String value = ((Element) modulus).getTextContent();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- new ByteArrayInputStream(value.getBytes())));
- char[] buff = new char[base64LineLength];
- StringBuffer newValue = new StringBuffer();
- int found = 0;
- try {
- while ((found = reader.read(buff)) > 0) {
- newValue.append(buff, 0, found);
- if (found == base64LineLength)
- newValue.append('\n');
- }
- } catch (IOException e) {
- // this should never happen, as we are reading from a ByteArrayInputStream
- throw new RuntimeException(e);
- }
- ((Element) modulus).setTextContent(newValue.toString());
- }
-
- }
-
-
- }
-
-}
+package at.gv.egiz.idlink;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+
+import org.w3._2000._09.xmldsig_.KeyValueType;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import at.buergerkarte.namespaces.personenbindung._20020506_.CompressedIdentityLinkType;
+import at.gv.e_government.reference.namespace.persondata._20020228_.AbstractPersonType;
+import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType;
+import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType;
+import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPersonType;
+import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType.Value;
+import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType.FamilyName;
+import at.gv.egiz.idlink.ans1.CitizenPublicKey;
+import at.gv.egiz.idlink.ans1.IdentityLink;
+import at.gv.egiz.idlink.ans1.PersonData;
+import at.gv.egiz.idlink.ans1.PhysicalPersonData;
+import at.gv.egiz.marshal.MarshallerFactory;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
+import at.gv.egiz.xmldsig.KeyTypeNotSupportedException;
+import at.gv.egiz.xmldsig.KeyValueFactory;
+
+public class CompressedIdentityLinkFactory {
+
+ /**
+ * The instance returned by {@link #getInstance()}.
+ */
+ private static CompressedIdentityLinkFactory instance;
+
+ /**
+ * The <code>JAXBContext</code>.
+ */
+ private static JAXBContext jaxbContext;
+
+ /**
+ * The <code>KeyValueFactory</code>.
+ */
+ private static KeyValueFactory keyValueFactory;
+
+ /**
+ * Get an instance of this <code>CompressedIdentityLinkFactory</code>.
+ *
+ * @return an instance of this <code>CompressedIdentityLinkFactory</code>
+ */
+ public synchronized static CompressedIdentityLinkFactory getInstance() {
+ if (instance == null) {
+ instance = new CompressedIdentityLinkFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private CompressedIdentityLinkFactory() {
+
+ keyValueFactory = new KeyValueFactory();
+
+ StringBuffer packageNames = new StringBuffer();
+ packageNames.append(at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(org.w3._2001._04.xmldsig_more_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory.class.getPackage().getName());
+
+ try {
+ jaxbContext = JAXBContext.newInstance(packageNames.toString());
+ } catch (JAXBException e) {
+ // we should not get an JAXBException initializing the JAXBContext
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public IdentityLink createIdLink(CompressedIdentityLinkType compressedIdentityLinkType) {
+
+ // IssuerTemplate
+ String issuerTemplate = compressedIdentityLinkType.getIssuerTemplate();
+
+ // AssertionId
+ String assertionID = compressedIdentityLinkType.getAssertionID();
+
+ // IssueInstant
+ String issueInstant = compressedIdentityLinkType.getIssueInstant();
+
+ AbstractPersonType personDataType = compressedIdentityLinkType.getPersonData();
+
+ String baseId = null;
+
+ List<IdentificationType> identifications = personDataType.getIdentification();
+ for (IdentificationType identificationType : identifications) {
+ String type = identificationType.getType();
+ if ("urn:publicid:gv.at:baseid".equals(type)) {
+ baseId = identificationType.getValue().getValue();
+ }
+ }
+
+ String givenName = null;
+ String familyName = null;
+ String dateOfBirth = null;
+
+ if (personDataType instanceof PhysicalPersonType) {
+ PhysicalPersonType physicalPersonType = (PhysicalPersonType) personDataType;
+ PersonNameType name = physicalPersonType.getName();
+ List<String> givenNames = name.getGivenName();
+ if (!givenNames.isEmpty()) {
+ givenName = givenNames.get(0);
+ }
+ List<FamilyName> familyNames = name.getFamilyName();
+ if (!familyNames.isEmpty()) {
+ familyName = familyNames.get(0).getValue();
+ }
+ dateOfBirth = physicalPersonType.getDateOfBirth();
+ }
+
+ PhysicalPersonData physicalPersonData = new PhysicalPersonData(baseId, givenName, familyName, dateOfBirth);
+ PersonData personData = new PersonData(physicalPersonData);
+
+ int numKeys = compressedIdentityLinkType.getCitizenPublicKey().size();
+ CitizenPublicKey[] citizenPublicKeys = new CitizenPublicKey[numKeys];
+ for (int i = 0; i < numKeys;) {
+ citizenPublicKeys[i] = new CitizenPublicKey(++i);
+ }
+
+ byte[] signatureValue = compressedIdentityLinkType.getSignatureValue();
+ byte[] referenceDigest = compressedIdentityLinkType.getReferenceDigest();
+ byte[] referenceManifestDigest = compressedIdentityLinkType.getReferenceManifestDigest();
+ byte[] manifestReferenceDigest = compressedIdentityLinkType.getManifestReferenceDigest();
+
+ IdentityLink idLink = new IdentityLink(issuerTemplate, assertionID, issueInstant, personData, citizenPublicKeys, signatureValue);
+ idLink.setReferenceDigest(referenceDigest);
+ idLink.setReferenceManifestDigest(referenceManifestDigest);
+ idLink.setManifestReferenceDigest(manifestReferenceDigest);
+
+ return idLink;
+
+ }
+
+ /**
+ * Creates a new <code>CompressedIdentityLink</code> element from the given
+ * ASN.1 representation of an <code>idLink</code>.
+ *
+ * @param idLink
+ * the ASN.1 representation of an <code>IdentityLink</code>
+ * @param certificates
+ * a list of {@link X509Certificate}s containing the corresponding
+ * public keys
+ * @param domainId TODO
+ * @return a new <code>CompressedIdentityLink</code> element
+ *
+ * @throws NullPointerException
+ * if <code>idLink</code> or <code>certificates</code> is
+ * <code>null</code>
+ * @throws IllegalArgumentException
+ * if <code>idLink</code> references certificates not in the range
+ * of the <code>certificates</code> list
+ */
+ public JAXBElement<CompressedIdentityLinkType> createCompressedIdentityLink(
+ at.gv.egiz.idlink.ans1.IdentityLink idLink,
+ List<X509Certificate> certificates, String domainId) {
+
+ at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory prFactory =
+ new at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory();
+
+ at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory pbFactory =
+ new at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory();
+
+ org.w3._2000._09.xmldsig_.ObjectFactory dsFactory = new org.w3._2000._09.xmldsig_.ObjectFactory();
+
+ // PersonData
+ PhysicalPersonData __physicalPersonData = idLink.getPersonData()
+ .getPhysicalPerson();
+
+ Value identificationTypeValue = prFactory.createIdentificationTypeValue();
+ identificationTypeValue.setValue(__physicalPersonData.getBaseId());
+ IdentificationType identificationType = prFactory
+ .createIdentificationType();
+ identificationType.setValue(identificationTypeValue);
+ if (domainId != null) {
+ identificationType.setType(domainId);
+ } else {
+ identificationType.setType("urn:publicid:gv.at:baseid");
+ }
+
+ PersonNameType personNameType = prFactory.createPersonNameType();
+ FamilyName personNameTypeFamilyName = prFactory
+ .createPersonNameTypeFamilyName();
+ personNameTypeFamilyName.setValue(__physicalPersonData.getFamilyName());
+ personNameType.getFamilyName().add(personNameTypeFamilyName);
+ personNameType.getGivenName().add(__physicalPersonData.getGivenName());
+
+ PhysicalPersonType physicalPersonType = prFactory
+ .createPhysicalPersonType();
+ physicalPersonType.getIdentification().add(identificationType);
+ physicalPersonType.setName(personNameType);
+ physicalPersonType.setDateOfBirth(__physicalPersonData.getDateOfBirth());
+
+ // CompressedIdentityLink
+ CompressedIdentityLinkType compressedIdentityLinkType = pbFactory
+ .createCompressedIdentityLinkType();
+ compressedIdentityLinkType.setIssuerTemplate(idLink.getIssuerTemplate());
+ compressedIdentityLinkType.setAssertionID(idLink.getAssertionID());
+ compressedIdentityLinkType.setIssueInstant(idLink.getIssueInstant());
+ compressedIdentityLinkType.setPersonData(physicalPersonType);
+
+ // CitizenPublicKey
+ CitizenPublicKey[] __citizenPublicKeys = idLink.getCitizenPublicKeys();
+ for (CitizenPublicKey __citizenPublicKey : __citizenPublicKeys) {
+
+ X509Certificate certificate = certificates.get(__citizenPublicKey.getOnToken());
+ PublicKey publicKey = certificate.getPublicKey();
+
+ JAXBElement<?> keyValue;
+ try {
+ keyValue = keyValueFactory.createKeyValue(publicKey);
+ } catch (KeyTypeNotSupportedException e) {
+ // TODO: handle exception properly
+ throw new RuntimeException(e);
+ }
+
+ KeyValueType keyValueType = dsFactory.createKeyValueType();
+ keyValueType.getContent().add(keyValue);
+
+ compressedIdentityLinkType.getCitizenPublicKey().add(keyValueType);
+ }
+
+ compressedIdentityLinkType.setSignatureValue(idLink.getSignatureValue());
+ compressedIdentityLinkType.setReferenceDigest(idLink.getReferenceDigest());
+ compressedIdentityLinkType.setReferenceManifestDigest(idLink
+ .getReferenceManifestDigest());
+ compressedIdentityLinkType.setManifestReferenceDigest(idLink
+ .getManifestReferenceDigest());
+ JAXBElement<CompressedIdentityLinkType> compressedIdentityLink = pbFactory
+ .createCompressedIdentityLink(compressedIdentityLinkType);
+
+ return compressedIdentityLink;
+
+ }
+
+ /**
+ * Marshall the given <code>compressedIdentityLink</code> into a DOM document
+ * with the given Nodes as <code>parent</code> and <code>nextSibling</code>
+ * nodes.
+ *
+ * @param compressedIdentityLink
+ * the <code>CompressedIdentityLink</code> element
+ * @param parent
+ * the parent node
+ * @param nextSibling
+ * the next sibling node (may be <code>null</code>)
+ * @param applyWorkarounds
+ * apply workarounds as spefiyed by
+ * {@link #applyWorkarounds(Element, int)}
+ *
+ * @throws JAXBException
+ * if an unexpected error occurs while marshalling
+ * @throws NullPointerException
+ * if <code>compressdIdentityLink</code> or <code>parent</code> is
+ * <code>null</code>
+ */
+ public void marshallCompressedIdentityLink(
+ JAXBElement<CompressedIdentityLinkType> compressedIdentityLink,
+ Node parent, Node nextSibling, boolean applyWorkarounds) throws JAXBException {
+
+ DOMResult result = new DOMResult(parent, nextSibling);
+
+
+ try {
+ Marshaller marshaller = MarshallerFactory.createMarshaller(jaxbContext);
+
+ marshaller.marshal(compressedIdentityLink, result);
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+
+ if (applyWorkarounds) {
+ Element element = (Element) ((nextSibling != null)
+ ? nextSibling.getPreviousSibling()
+ : parent.getFirstChild());
+ applyWorkarounds(element, 76);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public CompressedIdentityLinkType unmarshallCompressedIdentityLink(Source source) throws JAXBException {
+
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+ return ((JAXBElement<CompressedIdentityLinkType>) unmarshaller.unmarshal(source)).getValue();
+
+ }
+
+ /**
+ * Apply some workarounds to the given CompressedIdentityLink
+ * <code>element</code> to achieve compatibility with IdentityLink
+ * transformation stylesheets that have been designed for a (buggy) form of
+ * the CompressedIdentityLink as produced by a well-known citizen card
+ * environment implementation.
+ *
+ * <ol>
+ * <li>Replace the attribute node <code>URN</code> of the
+ * <code>NamedCurve</code> element of an <code>ECDSAKeyValue</code> element by
+ * a child text-node with the same content.</li>
+ * <li>Replace the attribute nodes <code>Value</code> of the <code>X</code>
+ * and <code>Y</code> elements of an <code>ECDSAKeyValue</code> element by a
+ * child text-node with the same content.</li>
+ * <li>Insert &quot;\n&quot; at <code>base64LineLength</code> into the Base64
+ * content of the <code>Modulus</code> element of an <code>RSAKeyValue</code>
+ * element.
+ * </ol>
+ *
+ * @param element
+ * the <code>CompressedIdentityLink</code> element
+ * @param base64LineLength
+ * the line length of Base64 content
+ */
+ public void applyWorkarounds(Element element, int base64LineLength) {
+
+ Document document = element.getOwnerDocument();
+
+ NodeList nodeList = element.getElementsByTagNameNS(
+ "http://www.w3.org/2001/04/xmldsig-more#", "NamedCurve");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node ecdsaNameCurve = nodeList.item(i);
+ Attr attrNode = ((Element) ecdsaNameCurve).getAttributeNodeNS(null,
+ "URN");
+ ecdsaNameCurve
+ .appendChild(document.createTextNode(attrNode.getValue()));
+ ((Element) ecdsaNameCurve).removeAttributeNode(attrNode);
+ }
+ nodeList = document.getElementsByTagNameNS(
+ "http://www.w3.org/2001/04/xmldsig-more#", "X");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node x = nodeList.item(i);
+ Attr attrNode = ((Element) x).getAttributeNodeNS(null, "Value");
+ x.appendChild(document.createTextNode(attrNode.getValue()));
+ ((Element) x).removeAttributeNode(attrNode);
+ }
+ nodeList = document.getElementsByTagNameNS(
+ "http://www.w3.org/2001/04/xmldsig-more#", "Y");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node y = nodeList.item(i);
+ Attr attrNode = ((Element) y).getAttributeNodeNS(null, "Value");
+ y.appendChild(document.createTextNode(attrNode.getValue()));
+ ((Element) y).removeAttributeNode(attrNode);
+ }
+
+ if (base64LineLength > 0) {
+ nodeList = document.getElementsByTagNameNS(
+ "http://www.w3.org/2000/09/xmldsig#", "Modulus");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node modulus = nodeList.item(i);
+ String value = ((Element) modulus).getTextContent();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ new ByteArrayInputStream(value.getBytes())));
+ char[] buff = new char[base64LineLength];
+ StringBuffer newValue = new StringBuffer();
+ int found = 0;
+ try {
+ while ((found = reader.read(buff)) > 0) {
+ newValue.append(buff, 0, found);
+ if (found == base64LineLength)
+ newValue.append('\n');
+ }
+ } catch (IOException e) {
+ // this should never happen, as we are reading from a ByteArrayInputStream
+ throw new RuntimeException(e);
+ }
+ ((Element) modulus).setTextContent(newValue.toString());
+ }
+
+ }
+
+
+ }
+
+}
diff --git a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
index fb7943dc..38597446 100644
--- a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
+++ b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
@@ -87,6 +87,8 @@ import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameTy
import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPersonType;
import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType.Value;
import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType.FamilyName;
+import at.gv.egiz.marshal.MarshallerFactory;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import at.gv.egiz.xmldsig.KeyTypeNotSupportedException;
import at.gv.egiz.xmldsig.KeyValueFactory;
import oasis.names.tc.saml._1_0.assertion.AnyType;
@@ -276,9 +278,7 @@ public class IdentityLinkFactory {
DOMResult result = new DOMResult(parent, nextSibling);
try {
- Marshaller marshaller = jaxbContext.createMarshaller();
-
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ Marshaller marshaller = MarshallerFactory.createMarshaller(jaxbContext, true);
marshaller.marshal(identityLink, result);
} catch (PropertyException e) {
diff --git a/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
new file mode 100644
index 00000000..ccebcc81
--- /dev/null
+++ b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.marshal;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class MarshallerFactory {
+
+ private static final Log log = LogFactory.getLog(MarshallerFactory.class);
+
+ public static Marshaller createMarshaller(JAXBContext ctx, boolean formattedOutput) throws JAXBException {
+ Marshaller m = ctx.createMarshaller();
+ try {
+ if (formattedOutput) {
+ log.trace("setting marshaller property FORMATTED_OUTPUT");
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ }
+ log.trace("setting marshaller property NamespacePrefixMapper");
+ m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
+ } catch (PropertyException ex) {
+ log.info("failed to set marshaller property: " + ex.getMessage());
+ }
+ return m;
+ }
+
+ public static Marshaller createMarshaller(JAXBContext ctx) throws JAXBException {
+ return createMarshaller(ctx, false);
+ }
+}
diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
new file mode 100644
index 00000000..a08c1188
--- /dev/null
+++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.marshal;
+
+//import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
+import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class NamespacePrefixMapperImpl extends NamespacePrefixMapper {
+
+ private static final Log log = LogFactory.getLog(NamespacePrefixMapperImpl.class);
+
+ @Override
+ public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("prefix for namespace " + namespaceUri + " requested");
+ }
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(namespaceUri)) {
+ return "xsi";
+ }
+
+ if ("http://www.w3.org/2000/09/xmldsig#".equals(namespaceUri)) {
+ return "dsig";
+ }
+
+ if ("http://www.buergerkarte.at/namespaces/securitylayer/1.2#".equals(namespaceUri)) {
+ return "sl";
+ }
+
+ if ("http://www.buergerkarte.at/cardchannel".equals(namespaceUri)) {
+ return "cc";
+ }
+
+ if ("http://www.w3.org/2001/04/xmldsig-more#".equals(namespaceUri)) {
+ return "ecdsa";
+ }
+
+ if ("http://reference.e-government.gv.at/namespace/persondata/20020228#".equals(namespaceUri)) {
+ return "pr";
+ }
+
+ if ("urn:oasis:names:tc:SAML:1.0:assertion".equals(namespaceUri)) {
+ return "saml";
+ }
+
+ if ("http://uri.etsi.org/01903/v1.1.1#".equals(namespaceUri)) {
+ return "xades";
+ }
+
+ return suggestion;
+ }
+
+ /**
+ * Returns a list of namespace URIs that should be declared
+ * at the root element.
+ * <p>
+ * By default, the JAXB RI produces namespace declarations only when
+ * they are necessary, only at where they are used. Because of this
+ * lack of look-ahead, sometimes the marshaller produces a lot of
+ * namespace declarations that look redundant to human eyes. For example,
+ */
+ @Override
+ public String[] getPreDeclaredNamespaceUris() {
+ return new String[]{ "http://www.buergerkarte.at/namespaces/securitylayer/1.2#" };
+ }
+}
diff --git a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
index ae159215..71ca1db9 100644
--- a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
+++ b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
@@ -14,212 +14,212 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.xades;
-
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.PropertyException;
-import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.etsi.uri._01903.v1_1.CertIDListType;
-import org.etsi.uri._01903.v1_1.CertIDType;
-import org.etsi.uri._01903.v1_1.DataObjectFormatType;
-import org.etsi.uri._01903.v1_1.DigestAlgAndValueType;
-import org.etsi.uri._01903.v1_1.QualifyingPropertiesType;
-import org.etsi.uri._01903.v1_1.SignaturePolicyIdentifierType;
-import org.etsi.uri._01903.v1_1.SignedDataObjectPropertiesType;
-import org.etsi.uri._01903.v1_1.SignedPropertiesType;
-import org.etsi.uri._01903.v1_1.SignedSignaturePropertiesType;
-import org.w3._2000._09.xmldsig_.DigestMethodType;
-import org.w3._2000._09.xmldsig_.X509IssuerSerialType;
-import org.w3c.dom.Node;
-
-public class QualifyingPropertiesFactory {
-
- public static String NS_URI_V1_1_1 = "http://uri.etsi.org/01903/v1.1.1#";
-
- public static String SIGNED_PROPERTIES_REFERENCE_TYPE_V1_1_1 = NS_URI_V1_1_1 + "SignedProperties";
-
- private static QualifyingPropertiesFactory instance;
-
- /**
- * The <code>JAXBContext</code>.
- */
- private static JAXBContext jaxbContext;
-
- public static synchronized QualifyingPropertiesFactory getInstance() {
- if (instance == null) {
- instance = new QualifyingPropertiesFactory();
- }
- return instance;
- }
-
- private DatatypeFactory datatypeFactory;
-
- private org.etsi.uri._01903.v1_1.ObjectFactory qpFactory;
-
- private org.w3._2000._09.xmldsig_.ObjectFactory dsFactory;
-
- public QualifyingPropertiesFactory() {
-
- try {
- datatypeFactory = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e) {
- throw new RuntimeException(e);
- }
-
- qpFactory = new org.etsi.uri._01903.v1_1.ObjectFactory();
-
- dsFactory = new org.w3._2000._09.xmldsig_.ObjectFactory();
-
- StringBuffer packageNames = new StringBuffer();
-
- packageNames.append(org.etsi.uri._01903.v1_1.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
-
- try {
- jaxbContext = JAXBContext.newInstance(packageNames.toString());
- } catch (JAXBException e) {
- // we should not get an JAXBException initializing the JAXBContext
- throw new RuntimeException(e);
- }
-
- }
-
- public DigestAlgAndValueType createDigestAlgAndValueType(X509Certificate certificate) throws QualifyingPropertiesException {
-
- DigestMethodType digestMethodType = dsFactory.createDigestMethodType();
- digestMethodType.setAlgorithm(DigestMethod.SHA1);
-
- byte[] digest;
- try {
- MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
- digest = messageDigest.digest(certificate.getEncoded());
- } catch (CertificateEncodingException e) {
- throw new QualifyingPropertiesException(e);
- } catch (NoSuchAlgorithmException e) {
- throw new QualifyingPropertiesException(e);
- }
-
- DigestAlgAndValueType digestAlgAndValueType = qpFactory.createDigestAlgAndValueType();
- digestAlgAndValueType.setDigestMethod(digestMethodType);
- digestAlgAndValueType.setDigestValue(digest);
-
- return digestAlgAndValueType;
-
- }
-
- public X509IssuerSerialType createX509IssuerSerialType(X509Certificate certificate) {
-
- String name = certificate.getIssuerX500Principal().getName("RFC2253");
- BigInteger serialNumber = certificate.getSerialNumber();
-
- X509IssuerSerialType issuerSerialType = dsFactory.createX509IssuerSerialType();
- issuerSerialType.setX509IssuerName(name);
- issuerSerialType.setX509SerialNumber(serialNumber);
-
- return issuerSerialType;
-
- }
-
- public DataObjectFormatType createDataObjectFormatType(String objectReference, String mimeType, String description) {
-
- DataObjectFormatType dataObjectFormatType = qpFactory.createDataObjectFormatType();
- dataObjectFormatType.setObjectReference(objectReference);
-
- if (mimeType != null) {
- dataObjectFormatType.setMimeType(mimeType);
- }
- if (description != null) {
- dataObjectFormatType.setDescription(description);
- }
-
- return dataObjectFormatType;
- }
-
- public JAXBElement<QualifyingPropertiesType> createQualifyingProperties111(Date signingTime, List<X509Certificate> certificates, String idValue, List<DataObjectFormatType> dataObjectFormats) throws QualifyingPropertiesException {
-
- GregorianCalendar gregorianCalendar = new GregorianCalendar();
- gregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC"));
- gregorianCalendar.setTime(signingTime);
-
- SignedSignaturePropertiesType signedSignaturePropertiesType = qpFactory.createSignedSignaturePropertiesType();
-
- // SigningTime
- XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(gregorianCalendar);
- xmlGregorianCalendar.setFractionalSecond(null);
- signedSignaturePropertiesType.setSigningTime(xmlGregorianCalendar);
-
- // SigningCertificate
- CertIDListType certIDListType = qpFactory.createCertIDListType();
- List<CertIDType> certIDs = certIDListType.getCert();
-
- for (X509Certificate certificate : certificates) {
-
- CertIDType certIDType = qpFactory.createCertIDType();
- certIDType.setCertDigest(createDigestAlgAndValueType(certificate));
- certIDType.setIssuerSerial(createX509IssuerSerialType(certificate));
-
- certIDs.add(certIDType);
-
- }
- signedSignaturePropertiesType.setSigningCertificate(certIDListType);
-
- // SignaturePolicy
- SignaturePolicyIdentifierType signaturePolicyIdentifierType = qpFactory.createSignaturePolicyIdentifierType();
- signaturePolicyIdentifierType.setSignaturePolicyImplied(new SignaturePolicyIdentifierType.SignaturePolicyImplied());
- signedSignaturePropertiesType.setSignaturePolicyIdentifier(signaturePolicyIdentifierType);
-
- // SignedProperties
- SignedPropertiesType signedPropertiesType = qpFactory.createSignedPropertiesType();
- signedPropertiesType.setSignedSignatureProperties(signedSignaturePropertiesType);
-
- // DataObjectFormat
- if (dataObjectFormats != null && !dataObjectFormats.isEmpty()) {
- SignedDataObjectPropertiesType signedDataObjectPropertiesType = qpFactory.createSignedDataObjectPropertiesType();
- List<DataObjectFormatType> dataObjectFormatTypes = signedDataObjectPropertiesType.getDataObjectFormat();
- dataObjectFormatTypes.addAll(dataObjectFormats);
- signedPropertiesType.setSignedDataObjectProperties(signedDataObjectPropertiesType);
- }
-
- signedPropertiesType.setId(idValue);
-
- // QualifyingProperties
- QualifyingPropertiesType qualifyingPropertiesType = qpFactory.createQualifyingPropertiesType();
- qualifyingPropertiesType.setSignedProperties(signedPropertiesType);
-
- return qpFactory.createQualifyingProperties(qualifyingPropertiesType);
-
- }
-
- public void marshallQualifyingProperties(JAXBElement<QualifyingPropertiesType> qualifyingProperties, Node parent) throws JAXBException {
-
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
-
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
-
- marshaller.marshal(qualifyingProperties, parent);
- } catch (PropertyException e) {
- throw new RuntimeException(e);
- }
-
- }
-
-}
+package at.gv.egiz.xades;
+
+import at.gv.egiz.marshal.MarshallerFactory;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.crypto.dsig.DigestMethod;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.etsi.uri._01903.v1_1.CertIDListType;
+import org.etsi.uri._01903.v1_1.CertIDType;
+import org.etsi.uri._01903.v1_1.DataObjectFormatType;
+import org.etsi.uri._01903.v1_1.DigestAlgAndValueType;
+import org.etsi.uri._01903.v1_1.QualifyingPropertiesType;
+import org.etsi.uri._01903.v1_1.SignaturePolicyIdentifierType;
+import org.etsi.uri._01903.v1_1.SignedDataObjectPropertiesType;
+import org.etsi.uri._01903.v1_1.SignedPropertiesType;
+import org.etsi.uri._01903.v1_1.SignedSignaturePropertiesType;
+import org.w3._2000._09.xmldsig_.DigestMethodType;
+import org.w3._2000._09.xmldsig_.X509IssuerSerialType;
+import org.w3c.dom.Node;
+
+public class QualifyingPropertiesFactory {
+
+ public static String NS_URI_V1_1_1 = "http://uri.etsi.org/01903/v1.1.1#";
+
+ public static String SIGNED_PROPERTIES_REFERENCE_TYPE_V1_1_1 = NS_URI_V1_1_1 + "SignedProperties";
+
+ private static QualifyingPropertiesFactory instance;
+
+ /**
+ * The <code>JAXBContext</code>.
+ */
+ private static JAXBContext jaxbContext;
+
+ public static synchronized QualifyingPropertiesFactory getInstance() {
+ if (instance == null) {
+ instance = new QualifyingPropertiesFactory();
+ }
+ return instance;
+ }
+
+ private DatatypeFactory datatypeFactory;
+
+ private org.etsi.uri._01903.v1_1.ObjectFactory qpFactory;
+
+ private org.w3._2000._09.xmldsig_.ObjectFactory dsFactory;
+
+ public QualifyingPropertiesFactory() {
+
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+
+ qpFactory = new org.etsi.uri._01903.v1_1.ObjectFactory();
+
+ dsFactory = new org.w3._2000._09.xmldsig_.ObjectFactory();
+
+ StringBuffer packageNames = new StringBuffer();
+
+ packageNames.append(org.etsi.uri._01903.v1_1.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
+
+ try {
+ jaxbContext = JAXBContext.newInstance(packageNames.toString());
+ } catch (JAXBException e) {
+ // we should not get an JAXBException initializing the JAXBContext
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public DigestAlgAndValueType createDigestAlgAndValueType(X509Certificate certificate) throws QualifyingPropertiesException {
+
+ DigestMethodType digestMethodType = dsFactory.createDigestMethodType();
+ digestMethodType.setAlgorithm(DigestMethod.SHA1);
+
+ byte[] digest;
+ try {
+ MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
+ digest = messageDigest.digest(certificate.getEncoded());
+ } catch (CertificateEncodingException e) {
+ throw new QualifyingPropertiesException(e);
+ } catch (NoSuchAlgorithmException e) {
+ throw new QualifyingPropertiesException(e);
+ }
+
+ DigestAlgAndValueType digestAlgAndValueType = qpFactory.createDigestAlgAndValueType();
+ digestAlgAndValueType.setDigestMethod(digestMethodType);
+ digestAlgAndValueType.setDigestValue(digest);
+
+ return digestAlgAndValueType;
+
+ }
+
+ public X509IssuerSerialType createX509IssuerSerialType(X509Certificate certificate) {
+
+ String name = certificate.getIssuerX500Principal().getName("RFC2253");
+ BigInteger serialNumber = certificate.getSerialNumber();
+
+ X509IssuerSerialType issuerSerialType = dsFactory.createX509IssuerSerialType();
+ issuerSerialType.setX509IssuerName(name);
+ issuerSerialType.setX509SerialNumber(serialNumber);
+
+ return issuerSerialType;
+
+ }
+
+ public DataObjectFormatType createDataObjectFormatType(String objectReference, String mimeType, String description) {
+
+ DataObjectFormatType dataObjectFormatType = qpFactory.createDataObjectFormatType();
+ dataObjectFormatType.setObjectReference(objectReference);
+
+ if (mimeType != null) {
+ dataObjectFormatType.setMimeType(mimeType);
+ }
+ if (description != null) {
+ dataObjectFormatType.setDescription(description);
+ }
+
+ return dataObjectFormatType;
+ }
+
+ public JAXBElement<QualifyingPropertiesType> createQualifyingProperties111(Date signingTime, List<X509Certificate> certificates, String idValue, List<DataObjectFormatType> dataObjectFormats) throws QualifyingPropertiesException {
+
+ GregorianCalendar gregorianCalendar = new GregorianCalendar();
+ gregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC"));
+ gregorianCalendar.setTime(signingTime);
+
+ SignedSignaturePropertiesType signedSignaturePropertiesType = qpFactory.createSignedSignaturePropertiesType();
+
+ // SigningTime
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(gregorianCalendar);
+ xmlGregorianCalendar.setFractionalSecond(null);
+ signedSignaturePropertiesType.setSigningTime(xmlGregorianCalendar);
+
+ // SigningCertificate
+ CertIDListType certIDListType = qpFactory.createCertIDListType();
+ List<CertIDType> certIDs = certIDListType.getCert();
+
+ for (X509Certificate certificate : certificates) {
+
+ CertIDType certIDType = qpFactory.createCertIDType();
+ certIDType.setCertDigest(createDigestAlgAndValueType(certificate));
+ certIDType.setIssuerSerial(createX509IssuerSerialType(certificate));
+
+ certIDs.add(certIDType);
+
+ }
+ signedSignaturePropertiesType.setSigningCertificate(certIDListType);
+
+ // SignaturePolicy
+ SignaturePolicyIdentifierType signaturePolicyIdentifierType = qpFactory.createSignaturePolicyIdentifierType();
+ signaturePolicyIdentifierType.setSignaturePolicyImplied(new SignaturePolicyIdentifierType.SignaturePolicyImplied());
+ signedSignaturePropertiesType.setSignaturePolicyIdentifier(signaturePolicyIdentifierType);
+
+ // SignedProperties
+ SignedPropertiesType signedPropertiesType = qpFactory.createSignedPropertiesType();
+ signedPropertiesType.setSignedSignatureProperties(signedSignaturePropertiesType);
+
+ // DataObjectFormat
+ if (dataObjectFormats != null && !dataObjectFormats.isEmpty()) {
+ SignedDataObjectPropertiesType signedDataObjectPropertiesType = qpFactory.createSignedDataObjectPropertiesType();
+ List<DataObjectFormatType> dataObjectFormatTypes = signedDataObjectPropertiesType.getDataObjectFormat();
+ dataObjectFormatTypes.addAll(dataObjectFormats);
+ signedPropertiesType.setSignedDataObjectProperties(signedDataObjectPropertiesType);
+ }
+
+ signedPropertiesType.setId(idValue);
+
+ // QualifyingProperties
+ QualifyingPropertiesType qualifyingPropertiesType = qpFactory.createQualifyingPropertiesType();
+ qualifyingPropertiesType.setSignedProperties(signedPropertiesType);
+
+ return qpFactory.createQualifyingProperties(qualifyingPropertiesType);
+
+ }
+
+ public void marshallQualifyingProperties(JAXBElement<QualifyingPropertiesType> qualifyingProperties, Node parent) throws JAXBException {
+
+ try {
+ Marshaller marshaller = MarshallerFactory.createMarshaller(jaxbContext, true);
+
+ marshaller.marshal(qualifyingProperties, parent);
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+}