From 759f2277f9b6cf339d8fcc5631ea547855ab9e56 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Fri, 25 Jun 2021 13:10:41 +0200 Subject: seems to work on most systems .. --- .../common/settings/DefaultSignatureProfileSettings.java | 3 +-- .../pdfas/common/utils/CheckSignatureBlockParameters.java | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'pdf-as-common/src/main/java/at') diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java index ff9c6d0f..6e288a27 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java @@ -68,8 +68,7 @@ public class DefaultSignatureProfileSettings { public static final String SIG_BLOCK_PARAMETER_DEFAULT_KEY_REGEX = "^([A-za-z]){1,20}$"; // public static final String SIG_BLOCK_PARAMETER_DEFAULT_VALUE_REGEX = "^([\\p{Print}-ß_'\\+\\!\u00e4\u00f6\u00fc" + // "\u00c4\u00d6\u00dc]){1,100}$"; -public static final String SIG_BLOCK_PARAMETER_DEFAULT_VALUE_REGEX = "^([\\p{Print}ߧ€\u00e4\u00f6\u00fc\u00c4\u00d6" + - "\u00dc]){1,100}$"; +public static final String SIG_BLOCK_PARAMETER_DEFAULT_VALUE_REGEX = "^([\\p{Print}\u00df\u00A7\u20AC\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc]){1,100}$"; static { profileSettings.put(KEY_SIG_SUBJECT, new SignatureProfileEntry(KEY_SIG_SUBJECT, KEY_SIG_SUBJECT_DEFAULT, VALUE_SIG_SUBJECT_DEFAULT) ); diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/CheckSignatureBlockParameters.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/CheckSignatureBlockParameters.java index c2e6b81d..756a240c 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/CheckSignatureBlockParameters.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/CheckSignatureBlockParameters.java @@ -1,24 +1,35 @@ package at.gv.egiz.pdfas.common.utils; import at.gv.egiz.pdfas.common.settings.DefaultSignatureProfileSettings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class CheckSignatureBlockParameters { + private static final Logger logger = LoggerFactory + .getLogger(CheckSignatureBlockParameters.class); public static boolean checkSignatureBlockParameterMapIsValid(Map map, String keyRegex, String valueRegex) { + + logger.trace("regex1:"+keyRegex+", regex1:"+valueRegex); if(keyRegex == null || keyRegex.length() == 0) { keyRegex = DefaultSignatureProfileSettings.SIG_BLOCK_PARAMETER_DEFAULT_KEY_REGEX; } if(valueRegex == null || valueRegex.length() == 0) { valueRegex = DefaultSignatureProfileSettings.SIG_BLOCK_PARAMETER_DEFAULT_VALUE_REGEX; } + logger.trace("regex2:"+keyRegex+", regex2:"+valueRegex); for(String key : map.keySet()){ - if(isValid(key, keyRegex) == false) + if(isValid(key, keyRegex) == false) { + logger.error("Invalid key:"+key+", regex:"+keyRegex); return false; - if(isValid(map.get(key), valueRegex) == false) + } + if(isValid(map.get(key), valueRegex) == false) { + logger.error("Invalid value:"+map.get(key)+", regex:"+valueRegex); return false; + } } return true; -- cgit v1.2.3