aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/knowcenter/wag')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java44
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java32
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java4
4 files changed, 26 insertions, 56 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index 9315477..6a19b42 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -50,7 +50,6 @@ import at.gv.egiz.pdfas.impl.api.commons.PdfDataSourceAdapter;
import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
import at.gv.egiz.pdfas.utils.PDFASUtils;
-import at.gv.egiz.pdfas.web.VerifySessionInformation;
import at.knowcenter.wag.egov.egiz.cfg.OverridePropertyHolder;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
@@ -824,50 +823,35 @@ public abstract class PdfAS
}
/**
+ * Verify a list of signatures
*
- * @param extended_signature_info
- * @param connectorType
+ * @param extended_signature_info a list of {@link ExtendedSignatureInformation} to be verified
+ * @param connectorType the connector to use for verification
* @param returnHashInputData
* @param verificationTime
- * @return
+ * @param verifySignatureAtIndex only verify the signature at the given index in the extended_signature_info list. A value < 0 means to verify all signatures in the list.
+ * @return a list of {@link SignatureResponse}s
* @throws PDFDocumentException
* @throws NormalizeException
* @throws SignatureException
* @throws ConnectorException
* @throws ConnectorFactoryException
*/
- public static List verifyExtendedSignatureHolders(List extended_signature_info, String connectorType, boolean returnHashInputData, Date verificationTime) throws PDFDocumentException, NormalizeException, SignatureException, ConnectorException, ConnectorFactoryException
+ public static List verifyExtendedSignatureHolders(List extended_signature_info, String connectorType, boolean returnHashInputData, Date verificationTime, int verifySignatureAtIndex) throws PDFDocumentException, NormalizeException, SignatureException, ConnectorException, ConnectorFactoryException
{
List results = new ArrayList();
for (int i = 0; i < extended_signature_info.size(); i++)
{
- ExtendedSignatureInformation sigInfo = (ExtendedSignatureInformation) extended_signature_info.get(i);
- SignatureInformation si = sigInfo.getSignatureInformation();
- SignatureHolder holder = (SignatureHolder) si.getInternalSignatureInformation();
-
- SignatureResponse result = verify(holder, connectorType, returnHashInputData, verificationTime, sigInfo.getXmlDsigData());
- results.add(result);
- }
- return results;
- }
-
- public static List verifySignatureHoldersWeb(List signature_holders,
- VerifySessionInformation si, String loc_ref) throws PDFDocumentException, NormalizeException, SignatureException, ConnectorException
- {
- List results = new ArrayList();
-
- for (int i = 0; i < signature_holders.size(); i++)
- {
- SignatureHolder holder = (SignatureHolder) signature_holders.get(i);
+ if (verifySignatureAtIndex < 0 || verifySignatureAtIndex == i)
+ {
+ ExtendedSignatureInformation sigInfo = (ExtendedSignatureInformation) extended_signature_info.get(i);
+ SignatureInformation si = sigInfo.getSignatureInformation();
+ SignatureHolder holder = (SignatureHolder) si.getInternalSignatureInformation();
- // store the current holder on the session so that moa can obtain
- // it from the RetrieveSignatureDataServlet.
- si.moa_holder = holder;
-
- SignatureResponse result = verifyWeb(holder, si.connector, loc_ref);
- results.add(result);
+ SignatureResponse result = verify(holder, connectorType, returnHashInputData, verificationTime, sigInfo.getXmlDsigData());
+ results.add(result);
+ }
}
-
return results;
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
index 6151b24..1bd6c03 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
@@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.api.exceptions.ConfigUtilsException;
import at.gv.egiz.pdfas.utils.ConfigUtils;
-import at.gv.egiz.pdfas.web.helper.TempDirHelper;
+import at.gv.egiz.pdfas.utils.TempDirHelper;
import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
index ac6e221..da98d47 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
@@ -14,8 +14,6 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.servlet.http.HttpServletRequest;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -24,6 +22,7 @@ import at.gv.egiz.pdfas.algorithmSuite.AlgorithmMapper;
import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteObject;
import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteUtil;
import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.api.internal.LocalBKUParams;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException;
import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
@@ -626,6 +625,11 @@ public final class BKUHelper
String bkuUserAgentHeader = parsedResponseProperties.getProperty(BKUPostConnection.BKU_USER_AGENT_HEADER_KEY);
String bkuSignatureLayout = parsedResponseProperties.getProperty(BKUPostConnection.BKU_SIGNATURE_LAYOUT_HEADER_KEY);
+
+ return getBKUIdentifier(bkuServerHeader, bkuUserAgentHeader, bkuSignatureLayout);
+ }
+
+ public static String getBKUIdentifier(String bkuServerHeader, String bkuUserAgentHeader, String bkuSignatureLayout) {
log.debug("BKU response header \"user-agent\": " + bkuUserAgentHeader);
log.debug("BKU response header \"server\": " + bkuServerHeader);
@@ -660,27 +664,9 @@ public final class BKUHelper
return result;
}
-
- public static String getBKUIdentifier(HttpServletRequest request) {
- return getBKUIdentifier(getBKUProperties(request));
- }
-
- public static Properties getBKUProperties(HttpServletRequest request) {
- Properties props = new Properties();
- String server = request.getHeader("server");
- String userAgent = request.getHeader("user-agent");
- String signatureLayout = request.getHeader(Constants.BKU_HEADER_SIGNATURE_LAYOUT);
- if (server != null) {
- props.setProperty(BKUPostConnection.BKU_SERVER_HEADER_KEY, server);
- }
- if (userAgent != null) {
- props.setProperty(BKUPostConnection.BKU_USER_AGENT_HEADER_KEY, userAgent);
- }
- if (signatureLayout != null) {
- props.setProperty(BKUPostConnection.BKU_SIGNATURE_LAYOUT_HEADER_KEY, signatureLayout);
- }
- return props;
+
+ public static String getBKUIdentifier(LocalBKUParams bkuParams) {
+ return getBKUIdentifier(bkuParams.getServer(), bkuParams.getUserAgent(), bkuParams.getSignatureLayout());
}
-
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java
index 09b7e6b..cbe9aaa 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java
@@ -53,8 +53,8 @@ public class SignSignatureObject implements Serializable, MandatorySignatureInfo
public X509Certificate x509Certificate = null;
// dferbas
- private Map subjectDNMap = new HashMap();
- private Map issuerDNMap = new HashMap();
+ public Map subjectDNMap = new HashMap();
+ public Map issuerDNMap = new HashMap();
/**
* @see at.knowcenter.wag.egov.egiz.sig.signatureobject.MandatorySignatureInformation#getDate()