aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java23
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOAHelper.java2
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java22
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java20
-rw-r--r--pdf-as-lib/src/main/resources/config/pdf-as.properties2
5 files changed, 60 insertions, 9 deletions
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
index 83bf046..56aca34 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
@@ -96,6 +96,10 @@ public class DetachedLocRefMOAConnector implements Connector
{
this.environment = new Environment(profile, signature_data_url);
}
+
+ public void loadXades14() throws ConnectorException {
+ this.environment.loadXades14();
+ }
protected String prepareSignRequest(SignatureData data) throws ConnectorException
{
@@ -516,6 +520,25 @@ public class DetachedLocRefMOAConnector implements Connector
this.cert_alg_rsa = settings.getValueFromKey(RSA_CERT_ALG_KEY);
}
+
+ public void loadXades14() throws ConnectorException {
+
+ SettingsReader settings = null;
+ try {
+ settings = SettingsReader.getInstance();
+ } catch (SettingsException e) {
+ throw new ConnectorException(300, e);
+ }
+
+ String verify_filename = TEMPLATE_FILE_PREFIX
+ + DetachedLocRefMOAIdFormatter.SIG_ID_X14_PREFIX
+ + VERIFY_TEMPLATE_SUFIX;
+ // this.verify_template =
+ // FileHelper.readFromFile(SettingsReader.relocateFile(verify_filename));
+ this.verify_template = settings
+ .readInternalResourceAsString(verify_filename);
+ }
+
public String getProfile()
{
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOAHelper.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOAHelper.java
index 8cb9a92..1919cb8 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOAHelper.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOAHelper.java
@@ -220,7 +220,7 @@ public class MOAHelper
- so.id = id_formatter.formatIds(null, algs);
+ so.id = id_formatter.formatIds(new String[] {xmlResponse}, algs);
return so;
}
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java
index 99b39f7..3f24ec1 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java
@@ -270,9 +270,11 @@ public class MOASoapWithAttachmentConnector implements Connector {
log.debug("MOA signature detected.");
return prepareXMLContent(data, so);
} else if (SigKZIDHelper.isMOAXAdES14Signed(so)) {
- log.debug("The signature is MOA XAdES 1.4 signed -> getting XML content from DetachedLocRefMOA connector.");
+ log.debug("The signature is MOA XAdES 1.4 signed -> getting different verify template");
+ this.environment.loadXades14();
DetachedLocRefMOAConnector moa_conn = new DetachedLocRefMOAConnector(
this.environment.getProfile(), "loc ref not needed here");
+ moa_conn.loadXades14();
return moa_conn.prepareXMLContent(data, so);
// ATRUST
// MOCCA
@@ -694,6 +696,24 @@ public class MOASoapWithAttachmentConnector implements Connector {
}
+ public void loadXades14() throws ConnectorException {
+
+ SettingsReader settings = null;
+ try {
+ settings = SettingsReader.getInstance();
+ } catch (SettingsException e) {
+ throw new ConnectorException(300, e);
+ }
+
+ String verify_filename = TEMPLATE_FILE_PREFIX
+ + DetachedLocRefMOAIdFormatter.SIG_ID_X14_PREFIX
+ + VERIFY_TEMPLATE_SUFIX;
+ // this.verify_template =
+ // FileHelper.readFromFile(SettingsReader.relocateFile(verify_filename));
+ this.verify_template = settings
+ .readInternalResourceAsString(verify_filename);
+ }
+
public String getProfile() {
return this.profile;
}
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java
index 3c67d54..f5b3cf5 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java
@@ -51,32 +51,40 @@ public class DetachedLocRefMOAIdFormatter implements IdFormatter
*/
public static final String SIG_ID_PROPERTY_KEY = "default.moa.algorithm.id";
+ public static final String oldSignature = "http://uri.etsi.org/01903/v1.1.1#SignedProperties";
+
/**
* @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[])
*/
public String formatIds(String[] ids, String algorithmParams)
{
// read id from property file and use it
-
+ String sigIDPrefix = SIG_ID_PREFIX;
try
{
// dferbas
// if (!BooleanUtils.toBoolean(SettingsReader.getInstance().getValueFromKey("moa.id.field.visible"))) {
// return null;
// }
-
-
- SIG_ID_PREFIX = SettingsReader.getInstance().getValueFromKey(SIG_ID_PROPERTY_KEY);
+
+
+ SIG_ID_PREFIX = SettingsReader.getInstance().getValueFromKey(SIG_ID_PROPERTY_KEY);
} catch (SettingsException e)
{
logger_.error(e.getMessage(), e);
}
+ if(!ids[0].contains(oldSignature)) {
+ sigIDPrefix = SIG_ID_X14_PREFIX;
+ } else {
+ sigIDPrefix = SIG_ID_PREFIX;
+ }
+
// dferbas
if (algorithmParams != null && algorithmParams.length() > 0) {
- return SIG_ID_PREFIX + ":" + algorithmParams;
+ return sigIDPrefix + ":" + algorithmParams;
} else {
- return SIG_ID_PREFIX;
+ return sigIDPrefix;
}
}
}
diff --git a/pdf-as-lib/src/main/resources/config/pdf-as.properties b/pdf-as-lib/src/main/resources/config/pdf-as.properties
index fce8664..5f34cca 100644
--- a/pdf-as-lib/src/main/resources/config/pdf-as.properties
+++ b/pdf-as-lib/src/main/resources/config/pdf-as.properties
@@ -14,7 +14,7 @@ cert.alg.ecdsa=http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1
default.bku.algorithm.id=etsi-bka-1.0
# MOA Algorithm - Kennzeichnung
-default.moa.algorithm.id=etsi-bka-moa-1.1
+default.moa.algorithm.id=etsi-bka-moa-1.0
#default.moa.algorithm.id=etsi-moc-1.2
# MOCCA Algorithm - Kennzeichnung