aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
diff options
context:
space:
mode:
authorbschnalzer <bianca.schnalzer@egiz.gv.at>2017-08-09 13:56:12 +0200
committerbschnalzer <bianca.schnalzer@egiz.gv.at>2017-08-09 13:56:14 +0200
commit7fe464cc98d714179b907c142bdd2fabfd009aa3 (patch)
tree328c53a9b60dfa1106c6b9d930d75ab127dce33f /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
parent17be060a4d2d79ee75036a2f785d4a4913f7935f (diff)
downloadpdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.tar.gz
pdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.tar.bz2
pdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.zip
Fixed problem with PAdES Signatures, removed some attributes from CAdES signatures which are not required, minor bug fixes, implemented new style (lineCenter)4.1.1-RC
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java16
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java42
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java34
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/settings/Settings.java1
4 files changed, 80 insertions, 13 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
index 14aca130..364acb44 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
@@ -50,15 +50,10 @@ public interface IConfigurationConstants {
public static final String PLACEHOLDER_SEARCH_ENABLED = "enable_placeholder_search";
public static final String DEFAULT_SIGNATURE_PROFILE = SIG_OBJECT + SEPERATOR + TYPE + SEPERATOR + DEFAULT;
-
+
public static final String CONFIG_BKU_URL = "bku.sign.url";
/**
- * Signature object Prefix
- */
- public static final String SIG_OBJECT_PREFIX = "sig_obj.";
-
- /**
* MOA SS Signing Key Identifier
*/
public static final String MOA_SS_KEY_IDENTIFIER = "moa.sign.KeyIdentifier";
@@ -103,10 +98,17 @@ public interface IConfigurationConstants {
* Signature object Prefix
*/
public static final String SIG_RESERVED_SIZE = "signatureSize";
-
+
/**
* Visual Signature placement
*/
public static final String BG_COLOR_DETECTION = "sigblock.placement.bgcolor.detection.enabled";
public static final String SIG_PLACEMENT_DEBUG_OUTPUT = "sigblock.placement.debug.file";
+
+
+ /**
+ * PADES Constants
+ */
+ public static final String SIG_PADES_FORCE_FLAG= SIG_OBJECT + SEPERATOR+"PAdESCompatibility";
+ public static final String SIG_PADES_INTELL_FLAG = SIG_OBJECT + SEPERATOR+"CheckPAdESCompatibility";
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
index ec030388..6e91e808 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
@@ -24,7 +24,23 @@
package at.gv.egiz.pdfas.lib.impl.configuration;
import at.gv.egiz.pdfas.common.settings.ISettings;
+import at.gv.egiz.pdfas.common.settings.Profiles;
+import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
+import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.impl.PdfAsImpl;
+import at.gv.egiz.pdfas.lib.impl.PdfAsParameterImpl;
+import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData;
+import at.gv.egiz.pdfas.lib.impl.status.OperationStatus;
+import at.gv.egiz.pdfas.lib.settings.Settings;
+import at.gv.egiz.pdfas.lib.util.SignatureUtils;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import com.sun.corba.se.spi.orb.Operation;
+
+import java.security.Signature;
+import java.util.Properties;
+
public class PlaceholderConfiguration extends SpecificBaseConfiguration
implements IConfigurationConstants {
@@ -34,13 +50,33 @@ public class PlaceholderConfiguration extends SpecificBaseConfiguration
}
public boolean isGlobalPlaceholderEnabled() {
- if(configuration.hasValue(PLACEHOLDER_SEARCH_ENABLED)) {
+ if (configuration.hasValue(PLACEHOLDER_SEARCH_ENABLED)) {
String value = configuration.getValue(PLACEHOLDER_SEARCH_ENABLED);
- if(value.equalsIgnoreCase(TRUE)) {
+ if (value.equalsIgnoreCase(TRUE)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Match selected Profile for Placeholder
+ * Enables to activate placeholder search/match for different profiles
+ * @return
+ */
+ public boolean isProfileConfigurationEnabled(String selectedProfileID)
+ {
+ String profileMatch = SIG_OBJECT+SEPERATOR+selectedProfileID+SEPERATOR+PLACEHOLDER_SEARCH_ENABLED;
+ if (configuration.hasValue(profileMatch)) {
+ String value = configuration.getValue(profileMatch);
+ if (value.equalsIgnoreCase(TRUE)) {
return true;
}
}
return false;
}
-
}
+
+
+
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java
index 19ea496d..9906fd6a 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java
@@ -63,7 +63,35 @@ public class PlaceholderFilter implements IConfigurationConstants,
.extract(status.getPdfObject(), placeholderID, placeholderMode);
return signaturePlaceholderData;
- }
+ } else
+ //filter for local placeholder in selected profiles
+ if (status.getPlaceholderConfiguration().isProfileConfigurationEnabled(status.getRequestedSignature().getSignatureProfileID())) {
+ PlaceholderExtractor extractor = status.getBackend()
+ .getPlaceholderExtractor();
+ String placeholderID = settings.getValue(PLACEHOLDER_ID);
+ String placeholderModeString = settings.getValue(PLACEHOLDER_MODE);
+ int placeholderMode = PLACEHOLDER_MATCH_MODE_MODERATE;
+ if (placeholderModeString != null) {
+ try {
+ placeholderMode = Integer.parseInt(placeholderModeString);
+
+ if (placeholderMode < PLACEHOLDER_MODE_MIN
+ || placeholderMode > PLACEHOLDER_MODE_MAX) {
+ throw new PdfAsErrorCarrier(new PDFASError(
+ PDFASError.ERROR_INVALID_PLACEHOLDER_MODE));
+ }
+ } catch (NumberFormatException e) {
+ throw new PdfAsErrorCarrier(new PDFASError(
+ PDFASError.ERROR_INVALID_PLACEHOLDER_MODE, e));
+ }
+ }
+ SignaturePlaceholderData signaturePlaceholderData = extractor
+ .extract(status.getPdfObject(), placeholderID, placeholderMode);
+
+ return signaturePlaceholderData;
+
+
+
+ }
return null;
- }
-}
+ }} \ No newline at end of file
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/settings/Settings.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/settings/Settings.java
index c5879783..c5b6dc57 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/settings/Settings.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/settings/Settings.java
@@ -399,6 +399,7 @@ public class Settings implements ISettings, IProfileConstants {
while (keyIterator.hasNext()) {
String key = keyIterator.next().toString();
+
if (key.startsWith(prefix)) {
valueMap.put(key, props.getProperty(key));
}