summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java21
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java25
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java61
-rw-r--r--BKULocalApp/pom.xml1
-rw-r--r--BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/Container.java2
-rw-r--r--BKUViewer/.classpath2
-rw-r--r--BKUViewer/.project4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java2
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java66
9 files changed, 70 insertions, 114 deletions
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java
index cbe5af7a..8f04d733 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java
@@ -1,4 +1,19 @@
-
+/*
+ * 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.local.stal;
import at.gv.egiz.bku.slcommands.impl.DataObjectHashDataInput;
@@ -19,6 +34,10 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
public class LocalSecureViewer implements SecureViewer {
private static final Log log = LogFactory.getLog(LocalSignRequestHandler.class);
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
index 492b8a05..9ae1d9b9 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
@@ -16,39 +16,27 @@
*/
package at.gv.egiz.bku.local.stal;
-import at.gv.egiz.bku.smccstal.SecureViewer;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.smccstal.SignRequestHandler;
-import at.gv.egiz.stal.HashDataInput;
+import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
-import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
-import at.gv.egiz.stal.signedinfo.ReferenceType;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
/**
*
- * @author clemens
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
public class LocalSignRequestHandler extends SignRequestHandler {
-// implements SecureViewer {
private static final Log log = LogFactory.getLog(LocalSignRequestHandler.class);
- protected LocalSecureViewer secureViewer;
-
public LocalSignRequestHandler(LocalSecureViewer secureViewer) {
super(secureViewer);
}
-
/**
* If the request is a SIGN request, it contains a list of DataObjectHashDataInput
* providing the pre-digested input stream (that can be obtained repeatedly) if
@@ -63,8 +51,13 @@ public class LocalSignRequestHandler extends SignRequestHandler {
if (request instanceof SignRequest) {
SignRequest signReq = (SignRequest) request;
- secureViewer.setDataToBeSigned(signReq.getHashDataInput());
+ ((LocalSecureViewer) secureViewer).setDataToBeSigned(signReq.getHashDataInput());
+ return super.handleRequest(request);
+ } else {
+ log.fatal("Got unexpected STAL request: " + request);
+ return new ErrorResponse(1000);
}
- return super.handleRequest(request);
+
+
}
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
index b39b4d02..be37488b 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
@@ -23,14 +23,12 @@ import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import at.gv.egiz.bku.binding.BindingProcessorManager;
import at.gv.egiz.bku.binding.HTTPBindingProcessor;
import at.gv.egiz.bku.binding.HttpUtil;
import at.gv.egiz.bku.conf.Configurator;
@@ -44,25 +42,32 @@ public class BKURequestHandler extends SpringBKUServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, java.io.IOException {
- log.debug("Got new request");
- String lang = req.getHeader("Accept-Language");
- Locale locale = AcceptLanguage.getLocale(lang);
- log.debug("Using locale: " + locale);
- HTTPBindingProcessor bindingProcessor;
- bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
- .createBindingProcessor(req.getRequestURL().toString(), null, locale);
- Map<String, String> headerMap = new HashMap<String, String>();
- for (Enumeration<String> headerName = req.getHeaderNames(); headerName
- .hasMoreElements();) {
- String header = headerName.nextElement();
- if (header != null) {
- headerMap.put(header, req.getHeader(header));
- }
- }
- headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, req.getContentType() + ";"
- + req.getCharacterEncoding());
- bindingProcessor.setHTTPHeaders(headerMap);
- bindingProcessor.consumeRequestStream(req.getInputStream());
+
+ log.debug("Received SecurityLayer request");
+
+ String acceptLanguage = req.getHeader("Accept-Language");
+ Locale locale = AcceptLanguage.getLocale(acceptLanguage);
+ log.debug("Accept-Language locale: " + locale);
+
+ HTTPBindingProcessor bindingProcessor;
+ bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
+ .createBindingProcessor(req.getRequestURL().toString(), null, locale);
+ Map<String, String> headerMap = new HashMap<String, String>();
+ for (Enumeration<String> headerName = req.getHeaderNames(); headerName
+ .hasMoreElements();) {
+ String header = headerName.nextElement();
+ if (header != null) {
+ headerMap.put(header, req.getHeader(header));
+ }
+ }
+ String charset = req.getCharacterEncoding();
+ String contentType = req.getContentType();
+ if (charset != null) {
+ contentType += ";" + charset;
+ }
+ headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType);
+ bindingProcessor.setHTTPHeaders(headerMap);
+ bindingProcessor.consumeRequestStream(req.getInputStream());
// fixxme just for testing
bindingProcessor.run();
@@ -84,13 +89,13 @@ public class BKURequestHandler extends SpringBKUServlet {
log.debug("Do not set siglayout header");
}
- if (configurator.getProperty(Configurator.USERAGENT_CONFIG_P) != null) {
- resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, configurator
- .getProperty(Configurator.USERAGENT_CONFIG_P));
- } else {
- resp.setHeader(HttpUtil.HTTP_HEADER_SERVER,
- Configurator.USERAGENT_DEFAULT);
- }
+ if (configurator.getProperty(Configurator.USERAGENT_CONFIG_P) != null) {
+ resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, configurator
+ .getProperty(Configurator.USERAGENT_CONFIG_P));
+ } else {
+ resp.setHeader(HttpUtil.HTTP_HEADER_SERVER,
+ Configurator.USERAGENT_DEFAULT);
+ }
resp.setContentType(bindingProcessor.getResultContentType());
resp.setCharacterEncoding(ENCODING);
diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml
index 8450c440..dc1583c5 100644
--- a/BKULocalApp/pom.xml
+++ b/BKULocalApp/pom.xml
@@ -96,5 +96,4 @@
<version>6.1.15</version>
</dependency>
</dependencies>
-
</project> \ No newline at end of file
diff --git a/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/Container.java b/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/Container.java
index 833dbf4d..8e3c3a6a 100644
--- a/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/Container.java
+++ b/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/Container.java
@@ -51,7 +51,7 @@ public class Container {
webappcontext.setContextPath("/");
webappcontext.setExtractWAR(false);
System.out.println(getClass().getClassLoader().getResource("log4j.properties"));
- webappcontext.setWar("BKULocal-1.0.2-SNAPSHOT.war");
+ webappcontext.setWar("BKULocal-1.0.4-SNAPSHOT.war");
handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() });
diff --git a/BKUViewer/.classpath b/BKUViewer/.classpath
index 1041acfa..dbf1e20c 100644
--- a/BKUViewer/.classpath
+++ b/BKUViewer/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
diff --git a/BKUViewer/.project b/BKUViewer/.project
index 5b3b191f..ea84ea41 100644
--- a/BKUViewer/.project
+++ b/BKUViewer/.project
@@ -16,12 +16,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java b/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
index b203ae52..066880b0 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
@@ -349,7 +349,7 @@ public class DefaultReader implements CCID {
if (resp == (byte) 0x00) {
synchronized(this) {
try {
- wait(200);
+ wait(10);
} catch (InterruptedException ex) {
log.error("interrupted in MODIFY_PIN");
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 56fc8804..560f1373 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -50,9 +50,7 @@ public class SignRequestHandler extends AbstractRequestHandler {
private static Log log = LogFactory.getLog(SignRequestHandler.class);
private static JAXBContext jaxbContext;
-// private PINProviderFactory pinProviderFactory;
- private SecureViewer secureViewer;
-
+
static {
try {
jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
@@ -61,6 +59,8 @@ public class SignRequestHandler extends AbstractRequestHandler {
}
}
+ protected SecureViewer secureViewer;
+
public SignRequestHandler(SecureViewer secureViewer) {
this.secureViewer = secureViewer;
}
@@ -142,64 +142,4 @@ public class SignRequestHandler extends AbstractRequestHandler {
return true;
}
-// class SoftwarePinProvider implements PINProvider {
-//
-// protected SignedInfoType signedInfo;
-// protected List<HashDataInput> hashDataInputs;
-// private boolean retry = false;
-//
-// public SoftwarePinProvider(SignedInfoType signedInfo) {
-// this.signedInfo = signedInfo;
-// }
-//
-// private void showSignaturePINDialog(PINSpec spec, int retries) {
-// if (retry) {
-// gui.showSignaturePINRetryDialog(spec, retries, SignRequestHandler.this, "sign", SignRequestHandler.this,
-// "cancel", SignRequestHandler.this, "hashData");
-// } else {
-// gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this,
-// "hashData");
-// }
-// }
-//
-// @Override
-// public char[] providePIN(PINSpec spec, int retries)
-// throws CancelledException, InterruptedException {
-// showSignaturePINDialog(spec, retries);
-//
-// do {
-// waitForAction();
-// gui.showWaitDialog(null);
-// if (actionCommand.equals("hashData")) {
-//
-// showSignaturePINDialog(spec, retries);
-//
-// try {
-// displayHashDataInputs(signedInfo.getReference());
-//
-// } catch (DigestException ex) {
-// log.error("Bad digest value: " + ex.getMessage());
-// gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
-// new Object[] {ex.getMessage()},
-// SignRequestHandler.this, "error");
-// } catch (Exception ex) {
-// log.error("Could not display hashdata inputs: " +
-// ex.getMessage());
-// gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
-// new Object[] {ex.getMessage()},
-// SignRequestHandler.this, "error");
-// }
-// } else if (actionCommand.equals("sign")) {
-// retry = true;
-// return gui.getPin();
-// } else if (actionCommand.equals("hashDataDone")) {
-// showSignaturePINDialog(spec, retries);
-// } else if (actionCommand.equals("cancel") ||
-// actionCommand.equals("error")) {
-// throw new CancelledException(spec.getLocalizedName() +
-// " entry cancelled");
-// }
-// } while (true);
-// }
-// }
}